samarkchaisanguan / rpp-payment
for rpp payment integration
1.0.0
2019-05-28 09:58 UTC
Requires
- php: >=7.1
- arcanedev/support: ^4.5
- guzzlehttp/guzzle: >=5.0.0
- illuminate/support: ^5.8
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: 4.*
README
for RPP payments integration
install
composer require samarkchaisanguan/rpp-payment
publish vendor configuration
php artisan vendor:publish --provider=Samark\RppPayment\Providers\RppServiceProvider
or
php artisan vendor:publish
config env
# Endpoint for getway rpp payment
RPP_PAYMENT_URL=https://alpha-gateway.weomni-test.com
# username and password for login basic authen
RPP_USERNAME=
RPP_PASSWORD=
# Endpont for getway merchant
RPP_MERCHANT_URL=https://staging-am-rpp.eggdigital.com
method can be using
- token
- getToken
- requestOtp
- verifyOtp
- charge
- cancel
example use
<?php namespace Samark\RppPayment\Http\Controllers; use Illuminate\Http\Request; use Samark\RppPayment\Facades\RppPayment; /** * Class RppController * @package App\Http\Controllers * @author samark chaisanguan <samarkchsngn@gmail.com> */ class RppController extends Controller { /** * @return string */ public function token() { return RppPayment::token(); } /** * @param \Illuminate\Http\Request $request * @return mixed */ public function requestOtp(Request $request) { return RppPayment::token() ->requestOtp(['mobile' => $request->mobile]); } /** * @param \Illuminate\Http\Request $request * @return mixed */ public function verify(Request $request) { return RppPayment::token() ->verifyOtp([ 'mobile' => $request->mobile, 'otpCode' => $request->otpCode, 'otpRef' => $request->otpRef, 'authCode' => $request->authCode, ]); } /** * @param \Illuminate\Http\Request $request * @return mixed */ public function charge(Request $request) { return RppPayment::token() ->charge([ 'amount' => $request->amount, 'currency' => $request->get('currency', 'thb'), 'name' => $request->get('name'), 'description' => $request->get('description'), 'mobile' => $request->mobile, 'channel' => $request->get('channel', 'POS'), 'txRefId' => $request->txRefId, 'merchantId' => $request->merchantId, 'outletId' => $request->outletId, 'terminalId' => $request->terminalId, 'paymentMethod' => $request->get('paymentMethod','WALLET'), 'tmnToken' => $request->tmnToken, ]); } /** * @param \Illuminate\Http\Request $request * @return mixed */ public function cancel(Request $request) { return RppPayment::token() ->cancel([ 'txRefId' => $request->txRefId, 'merchantId' => $request->merchantId, 'outletId' => $request->outletId, 'terminalId' => $request->terminalId, ]); } }
by pass token
/** * @param \Illuminate\Http\Request $request * @return mixed */ public function charge(Request $request) { return RppPayment::token($request->token) ->charge([ 'amount' => $request->amount, 'currency' => $request->get('currency', 'thb'), 'name' => $request->get('name'), 'description' => $request->get('description'), 'mobile' => $request->mobile, 'channel' => $request->get('channel', 'POS'), 'txRefId' => $request->txRefId, 'merchantId' => $request->merchantId, 'outletId' => $request->outletId, 'terminalId' => $request->terminalId, 'paymentMethod' => $request->get('paymentMethod','WALLET'), 'tmnToken' => $request->tmnToken, ]); }
config please read in comment in file how to change it.
config\rpp-payment.php