ryandadeng / securepay-secureframe
SecurePay SecureFrame for Laravel 5
dev-master
2018-08-14 05:47 UTC
Requires
- php: >=5.3.0
- illuminate/support: ~5.1
This package is auto-updated.
Last update: 2024-10-24 21:27:20 UTC
README
A SecureFrame solution for SecurePay.
Installation
Add the following line to the require section of composer.json:
{ "require": { "ryandadeng/securepay-secureframe": "dev-master" } }
Set up for Laravel <= 5.4
- In /config/app.php, add the following to providers:
Ryandadeng\Securepayframe\SecurePayFrameServiceProvider::class
- run
php artisan vendor:publish --provider="Ryandadeng\Securepayframe\SecurePayFrameServiceProvider"
Set up for Laravel >= 5.5
Just run php artisan vendor:publish --provider="Ryandadeng\Securepayframe\SecurePayFrameServiceProvider"
Guideline - How to use
- Create an implmentation class for SecurePayCustomDataInterface
- Implement your own custom dynamic data
- For return URL, please provide your own route url.
- Create a controller to send and receive data from SecurePay
Example:
namespace App\Http\Controllers; use Illuminate\Http\Request; use Ryandadeng\Securepayframe\Services\SecurePayFactory; class SecurePayFrameController { // GET - used to populate SecurePay by using SecureFrame public function send() { $send = SecurePayFactory::send(new SecurePaySecurePayCustomData()); return view('welcome', ['sender' => $send]); } // POST - This route will be hooked when SecurePay return response. This request should not be accessed publicly which means it should not be have any auth middleware attached. public function receive(Request $request) { // test received data $receiver = SecurePayFactory::receive($request->all()); if ($receiver->fails()) { return $receiver->errors(); } else { return 'success'; } } }
- Register your two routes for send and receive request respectively.