Files
famous-ly4-ev/app-modules/payment/src/Providers/PaymentServiceProvider.php
T

34 lines
1.1 KiB
PHP
Raw Normal View History

2026-08-04 22:23:54 +07:00
<?php
namespace Modules\Payment\Providers;
use Illuminate\Support\ServiceProvider;
use Modules\Payment\Enums\PaymentMethod;
use Modules\Payment\Factories\PaymentGatewayFactory;
use Modules\Payment\Gateways\KbzMiniAppGateway;
2026-08-19 21:43:00 +07:00
use Modules\Payment\Models\Payment;
use Modules\Payment\Observers\PaymentObserver;
2026-08-04 22:23:54 +07:00
class PaymentServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton(PaymentGatewayFactory::class, function (): PaymentGatewayFactory {
$factory = new PaymentGatewayFactory;
$factory->register(PaymentMethod::KbzMiniApp, KbzMiniAppGateway::class);
return $factory;
});
}
2026-08-04 22:23:54 +07:00
public function boot(): void
{
2026-08-23 20:44:52 +07:00
// MarkBookingPaid/MarkBookingRefunded are auto-discovered by
// internachi/modular's EventsPlugin (any Listeners/*.php with a
// handle(SomeEvent $event) signature) — registering them here too
// used to double-dispatch both listeners (see DriverAssigned's
// BookingServiceProvider for the same fix).
2026-08-19 21:43:00 +07:00
Payment::observe(PaymentObserver::class);
}
2026-08-04 22:23:54 +07:00
}