PaymentServiceProvider.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // Copyright 2019 Hackware SpA <human@hackware.cl>
  3. // This file is part of "Hackware Web Services Payment" and licensed under
  4. // the terms of the GNU Affero General Public License version 3, or (at your
  5. // option) a later version. You should have received a copy of this license
  6. // along with the software. If not, see <https://www.gnu.org/licenses/>.
  7. namespace Hawese\Payment\Providers;
  8. use Illuminate\Support\ServiceProvider;
  9. class PaymentServiceProvider extends ServiceProvider
  10. {
  11. const BASEDIR = __DIR__ . '/../..';
  12. public function register()
  13. {
  14. // General package config (not gateways)
  15. $this->mergeConfigFrom(
  16. self::BASEDIR . '/config/payment.php',
  17. 'payment'
  18. );
  19. // Load gateway config
  20. foreach (['flow', 'khipu'] as $gateway) {
  21. $this->mergeConfigFrom(
  22. self::BASEDIR . "/config/gateways/$gateway.php",
  23. "gateways.$gateway"
  24. );
  25. }
  26. }
  27. public function boot()
  28. {
  29. $this->loadRoutesFrom(self::BASEDIR . '/routes/payment.php');
  30. $this->loadMigrationsFrom(self::BASEDIR . '/database/migrations');
  31. // Policies
  32. $this->app['gate']->policy(
  33. Hawese\Payment\Payment::class,
  34. Hawese\Payment\Policies\PaymentPolicy::class
  35. );
  36. }
  37. }