34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Modules\Payment\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Modules\Payment\Enums\PaymentMethod;
|
|
use Modules\Payment\Factories\PaymentGatewayFactory;
|
|
use Modules\Payment\Gateways\KbzMiniAppGateway;
|
|
use Modules\Payment\Models\Payment;
|
|
use Modules\Payment\Observers\PaymentObserver;
|
|
|
|
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;
|
|
});
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
// 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).
|
|
Payment::observe(PaymentObserver::class);
|
|
}
|
|
}
|