pdazcom / laravel-walletone by pdazcom

Laravel integration walletone.com
448
1
2
Package Data
Maintainer Username: pdazcom
Maintainer Contact: kostya.dn@gmail.com (Konstantin A.)
Package Create Date: 2017-03-18
Package Last Update: 2017-03-25
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:07:58
Package Statistics
Total Downloads: 448
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 1
Total Open Issues: 1

Laravel WalletOne

Latest Version on Packagist Software License Total Downloads

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.