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

37 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\Facades\Event;
2026-08-04 22:23:54 +07:00
use Illuminate\Support\ServiceProvider;
use Modules\Payment\Enums\PaymentMethod;
use Modules\Payment\Events\PaymentCompleted;
use Modules\Payment\Events\RefundProcessed;
use Modules\Payment\Factories\PaymentGatewayFactory;
use Modules\Payment\Gateways\KbzMiniAppGateway;
use Modules\Payment\Listeners\MarkBookingPaid;
use Modules\Payment\Listeners\MarkBookingRefunded;
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
{
Event::listen(PaymentCompleted::class, MarkBookingPaid::class);
Event::listen(RefundProcessed::class, MarkBookingRefunded::class);
2026-08-19 21:43:00 +07:00
Payment::observe(PaymentObserver::class);
}
2026-08-04 22:23:54 +07:00
}