Last active
May 8, 2017 12:44
-
-
Save samuraee/615e270ad6caaed3a0770f9167334485 to your computer and use it in GitHub Desktop.
Sample bpPayRequest call for Mallat gateway in Banktest - (1st STEP)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$soapOptions = [ | |
'stream_context' => stream_context_create( | |
[ | |
'ssl' => [ | |
'verify_peer' => false, | |
'verify_peer_name' => false, | |
], | |
] | |
) | |
]; | |
$sendParams = [ | |
'terminalId' = YOUR_MERCHANT_TERMINAL_ID, | |
'userName' => YOUR_MERCHANT_USERNAME, | |
'userPassword' => TOUR_MERCHANT_PASSWORD', | |
'orderId' => time(), // order ID | |
'amount' => 1000, | |
'localDate' => date('Ymd'), | |
'localTime' => date('His'), | |
'additionalData' => '', | |
'callBackUrl' => 'YOUR_CALLBACK_URL', | |
'payerId' => 0, | |
]; | |
try { | |
$soapClient = new SoapClient('BANK_TEST_WSDL_URL', $soapOptions); | |
$response = $soapClient->bpPayRequest($sendParams); | |
if (isset($response->return)) { | |
$response = explode(',', $response->return); | |
if ($response[0] == 0) { | |
return $response[1]; | |
} | |
else { | |
throw new Exception('response error: ' . $response[0]); | |
} | |
} else { | |
throw new Exception('Invalid response!'); | |
} | |
} catch (SoapFault $e) { | |
throw new Exception('SoapFault: ' . $e->getMessage() . ' #' . $e->getCode(), $e->getCode()); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment