Created
February 15, 2016 11:01
-
-
Save AlaaAttya/9d73b22e14a312d1d36b to your computer and use it in GitHub Desktop.
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
$nbe = array( | |
'Title' => 'E7gezly', | |
'vpc_AccessCode' => Configure::read('Payment.vpc_AccessCode'), | |
'vpc_Amount' => $this->request->data['Order']['total_amount'] * 100, | |
'vpc_Command' => 'pay', | |
'vpc_Locale' => Configure::read("Config.language") == "ara" ? 'ar' : 'en', | |
'vpc_MerchTxnRef' => $this->Order->id, | |
'vpc_Merchant' => Configure::read('Payment.vpc_merchant'), | |
'vpc_OrderInfo' => "TMT_ORDER" . $this->Order->id, | |
'vpc_ReturnURL' => Router::url(array('language' => Configure::read("Config.language"), 'plugin' => 'events', 'controller' => 'book', 'action' => 'nbe_call_back'), true), | |
'vpc_Version' => Configure::read('Payment.vpc_Version') | |
); | |
$SECURE_SECRET = Configure::read('Payment.secure_secret'); | |
$md5HashData = $SECURE_SECRET; | |
$vpcURL = Configure::read('Payment.api_url') . '?'; | |
$appendAmp = 0; | |
foreach ($nbe as $key => $value) { | |
if (strlen($value) > 0) { | |
if ($appendAmp == 0) { | |
$vpcURL .= urlencode($key) . '=' . urlencode($value); | |
$appendAmp = 1; | |
} else { | |
$vpcURL .= '&' . urlencode($key) . "=" . urlencode($value); | |
} | |
$md5HashData .= $value; | |
} | |
} | |
if (strlen($SECURE_SECRET) > 0) { | |
$vpcURL .= "&vpc_SecureHash=" . strtoupper(md5($md5HashData)); | |
} | |
header("Location: " . $vpcURL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment