pdazcom/laravel-walletone
Laravel WalletOne
Implementation of WalletOne payments for laravel 5. There are form of payment and a middleware for processing requests for confirmation of payments from the walletone service. Based on two events - SuccessPayment and FailedPayment.
Install
Via Composer
$ composer require pdazcom/laravel-walletone
Then in config/app.php add service-provider and facade alias:
'providers' => [
...
Pdazcom\LaravelWalletOne\Providers\WalletoneServiceProvider::class,
...
];
'aliases' => [
...
'WalletOne' => Pdazcom\LaravelWalletOne\Facades\WalletOne::class,
...
];
Usage
First of all you need to run:
php artisan vendor:publish --provider='Pdazcom\LaravelWalletOne\Providers\WalletoneServiceProvider'
and then fill config/wallet-one.php file.
Then you can use \WalletOne facade.
To add options use \WalletOne::addWalletOptions($options)
$options = [
'WMI_DESCRIPTION' => 'Pay for account balance',
'WMI_PAYMENT_AMOUNT' => 100,
];
\WalletOne::addWalletOptions($options)
To get fields for payment form use \WalletOne::getFields(). And send it to your view:
$fields = \WalletOne::getFields()
To include payment form to your page just include it to view:
@include('wallet-one:form', $fields)
To process requests of WalletOne payment notifications just create listeners of two events:
Pdazcom\LaravelWalletOne\Events\FailedPayment and Pdazcom\LaravelWalletOne\Events\SuccessPayment
// FailedPaymentListener
public function handle(FailedPayment $event)
{
$postData = $event->postData;
$exception = $event->exception
}
// SuccessPaymentListener
public function handle(SuccessPayment $event)
{
$postData = $event->postData;
}
Testing
$ composer test
Security
If you discover any security related issues, please email kostya.dn@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.