Download the PHP package jack-walter-smith/bepaid-laravel without Composer
On this page you can find all versions of the php package jack-walter-smith/bepaid-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jack-walter-smith/bepaid-laravel
More information about jack-walter-smith/bepaid-laravel
Files in jack-walter-smith/bepaid-laravel
Package bepaid-laravel
Short Description A wrapper of https://github.com/begateway/begateway-api-php for Laravel
License MIT
Informations about the package bepaid-laravel
BePaid Laravel
A wrapper of BeGateway for Laravel (unofficial)
Documentation
Requirements
PHP >=7.1
Laravel >= 5.7
Installation
-
Add to composer json
-
Run
composer update
- Publish config
php artisan vendor:publish --provider="JackWalterSmith\BePaidLaravel\Providers\BePaidServiceProvider"
Usage
Basics
All you need to do is to create a new DTO and fill out original object with provided values.
Here is a simple example:
The table bellow illustrates which object in BeGateway
equals to object in BePaid Laravel
.
All of these objects in BePaid Laravel
package, that listed below, have public field $operation
,
which gives you access to original object.
This is in case if package features are not enough to reach goal.
You can check original package to see all available methods.
BeGateway | BePaid Laravel | Facade | DTO |
---|---|---|---|
AuthorizationOperation | Authorization | Authorization | AuthorizationDto |
CardToken | CardToken | CardToken | CardTokenDto |
PaymentOperation | Payment | Payment | PaymentDto |
GetPaymentToken | PaymentToken | PaymentToken | PaymentTokenDto |
Product | Product | Product | ProductDto |
QueryByPaymentToken | Query | Query | QueryByPaymentTokenDto |
QueryByTrackingId | Query | Query | QueryByTrackingIdDto |
QueryByUid | Query | Query | QueryByUidDto |
RefundOperation | Refund | Refund | RefundDto |
CreditOperation | Credit | Credit | CreditDto |
CaptureOperation | ChildTransaction | ChildTransaction | CaptureDto |
VoidOperation | ChildTransaction | ChildTransaction | VoidDto |
A few words about Query
and ChildTransaction
objects. They are also have $operation
public field,
but there are nuances. It depends on which DTO you will pass to fill()
or submit()
method. So let's say
you want to query for transaction by uid, in this case you'll create a new QueryByUidDto([...])
, then $operation
field becomes instance of \BeGateway\QueryByUid
.
Subscribe to events
BePaid Laravel
provides preconfigured routes that can be used in requests. Below is the list of it:
Method | Path | Name | Middleware | Event |
---|---|---|---|---|
POST | /bepaid/notifications | bepaid.notifications | bepaid.inject_basic_auth | bepaid.event.notification.success | bepaid.event.notification.fail |
GET | /bepaid/success | bepaid.success | - | bepaid.event.success |
GET | /bepaid/decline | bepaid.decline | - | bepaid.event.fail |
GET | /bepaid/fail | bepaid.fail | - | bepaid.event.return |
GET | /bapaid/cancel | bepaid.cancel | - | bepaid.event.cancel |
GET | /bepaid/return | bepaid.return | - | bepaid.event.decline |
The most important is notifications
. BePaid Laravel
already validates if the incoming request was sent by BePaid.
In success validation scenario it will fire bepaid.event.notification.success
and bepaid.event.notification.fail
if something
went wrong.
How to handle all this stuff?
BePaid Laravel
ships with abstract class BePaidSubscriber
which you need to extend.
Create and register a new Event Subscriber:
Now just extend BePaidSubscriber
and define all required methods. That's it.
All versions of bepaid-laravel with dependencies
laravel/framework Version ^5.7|^6|^7|^8
begateway/begateway-api-php Version dev-master as dev-3ceb96c
myclabs/php-enum Version dev-master