Laravel WalletOne
![Software License][ico-license]
![Total Downloads][ico-downloads], (*1)
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., (*2)
Install
Via Composer, (*3)
``` bash
$ composer require pdazcom/laravel-walletone, (*4)
Then in config/app.php add service-provider and facade alias:
'providers' => [
...
Pdazcom\LaravelWalletOne\Providers\WalletoneServiceProvider::class,
...
];, (*5)
'aliases' => [
...
'WalletOne' => Pdazcom\LaravelWalletOne\Facades\WalletOne::class,
...
];, (*6)
## Usage
First of all you need to run:
php artisan vendor:publish --provider='Pdazcom\LaravelWalletOne\Providers\WalletoneServiceProvider', (*7)
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,
];, (*8)
\WalletOne::addWalletOptions($options), (*9)
To get fields for payment form use `\WalletOne::getFields()`. And send it to your view:
```$xslt
$fields = \WalletOne::getFields()
To include payment form to your page just include it to view:, (*10)
@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
, (*11)
// FailedPaymentListener
public function handle(FailedPayment $event)
{
$postData = $event->postData;
$exception = $event->exception
}
```
// SuccessPaymentListener
public function handle(SuccessPayment $event)
{
$postData = $event->postData;
}, (*12)
## Testing
``` bash
$ composer test
Security
If you discover any security related issues, please email kostya.dn@gmail.com instead of using the issue tracker., (*13)
Credits
License
The MIT License (MIT). Please see License File for more information., (*14)