sepayvn/laravel-sepay

Laravel Package cho SePay - Giải pháp tự động hóa cho thanh toán chuyển khoản ngân hàng

v1.0.0 2023-11-28 10:05 UTC

This package is auto-updated.

Last update: 2024-04-29 10:35:09 UTC


README

Installation

You can install the package via composer:

composer require sepayvn/laravel-sepay

You can publish and run the migrations with:

php artisan vendor:publish --tag="sepay-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="sepay-config"

This is the contents of the published config file:

return [
    'webhook_token' => env('SEPAY_WEBHOOK_TOKEN'),
    'pattern' => env('SEPAY_MATCH_PATTERN', 'SE'),
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="sepay-views"

Usage

Tạo SePayWebhookListener

php artisan make:listener SePayWebhookListener
<?php

namespace App\Listeners;

use SePay\SePay\Events\SePayWebhookEvent;

class SePayWebhookListener
{
    /**
     * Create the event listener.
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     */
    public function handle(SePayWebhookEvent $event): void
    {
        // Xử lý nạp tiền / rút tiền
    }
}

Đăng ký SePayWebhookListener vào app/Providers/EventServiceProvider.php

    protected $listen = [
        ...
        \SePay\SePay\Events\SePayWebhookEvent::class => [
            \App\Listeners\SePayWebhookListener::class,
        ],
    ];

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.