mirror of
https://github.com/kikobar/hikashoppayment-triplea.git
synced 2024-12-22 05:44:11 +00:00
Replace PHP variables for arrays in POST request
This commit is contained in:
parent
26185c90a7
commit
47ed0b4366
|
@ -25,19 +25,27 @@ class plgHikashoppaymentTriplea extends hikashopPaymentPlugin{
|
||||||
function onAfterOrderConfirm(&$order,&$methods,$method_id){
|
function onAfterOrderConfirm(&$order,&$methods,$method_id){
|
||||||
parent::onAfterOrderConfirm($order, $methods, $method_id);
|
parent::onAfterOrderConfirm($order, $methods, $method_id);
|
||||||
|
|
||||||
$notify_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=notify¬if_payment=triplea&tmpl=component&&invoice='.$order->order_id.'lang='.$this->locale.$this->url_itemid;
|
$postvars = array();
|
||||||
$success_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id='.$order->order_id.$this->url_itemid;
|
|
||||||
$cancel_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id='.$order->order_id.$this->url_itemid;
|
$postvars['notify_url'] = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=notify¬if_payment=triplea&tmpl=component&&invoice='.$order->order_id.'lang='.$this->locale.$this->url_itemid;
|
||||||
$type = 'triplea';
|
$postvars['success_url'] = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id='.$order->order_id.$this->url_itemid;
|
||||||
$merchant_key = $pluginConfig['merchant_key'];
|
$postvars['cancel_url'] = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id='.$order->order_id.$this->url_itemid;
|
||||||
$access_token = $pluginConfig['access_token'];
|
$postvars['type'] = 'triplea';
|
||||||
$order_currency = $this->currency->currency_code;
|
$postvars['merchant_key'] = $pluginConfig['merchant_key'];
|
||||||
$order_amount = $order->order_full_price;
|
$postvars['access_token'] = $pluginConfig['access_token'];
|
||||||
$notify_secret = $pluginConfig['notify_secret'];
|
$postvars['order_currency'] = $this->currency->currency_code;
|
||||||
$notify_txs = true;
|
$postvars['order_amount'] = $order->order_full_price;
|
||||||
$payer_id = $order->order_uer_id;
|
$postvars['notify_secret'] = $pluginConfig['notify_secret'];
|
||||||
$order_id = $order->order_id;
|
$postvars['notify_txs'] = true;
|
||||||
$sandbox = $pluginConfig['sandbox'];
|
$postvars['payer_id'] = $order->order_uer_id;
|
||||||
|
$postvars['order_id'] = $order->order_id;
|
||||||
|
$postvars['sandbox'] = $pluginConfig['sandbox'];
|
||||||
|
$postvars['webhook_data'] = array(
|
||||||
|
"order_id" => $order_id);
|
||||||
|
|
||||||
|
$httpheader = array();
|
||||||
|
$httpheader['Autorization'] = "Bearer $access_token";
|
||||||
|
$httpheader['Content-Type'] = "application/json";
|
||||||
|
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
|
|
||||||
|
@ -50,25 +58,8 @@ class plgHikashoppaymentTriplea extends hikashopPaymentPlugin{
|
||||||
CURLOPT_FOLLOWLOCATION => true,
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||||
CURLOPT_POSTFIELDS =>'{
|
CURLOPT_POSTFIELDS => $postvars,
|
||||||
"type": "'.$type.'",
|
CURLOPT_HTTPHEADER => $httpheader
|
||||||
"merchant_key": "'.$merchant_key.'",
|
|
||||||
"order_currency": "'.$order_currency.'",
|
|
||||||
"order_amount": '.$order_amount.',
|
|
||||||
"payer_id": "'.$payer_id.'",
|
|
||||||
"success_url": "'.$success_url.'",
|
|
||||||
"cancel_url": "'.$cancel_url.'",
|
|
||||||
"notify_url": "'.$notiry_url.'",
|
|
||||||
"notify_secret": "'.$notify_secret.'",
|
|
||||||
"notify_txs": '.$notify_txs.',
|
|
||||||
"webhook_data": {
|
|
||||||
"order_id": "'.$order_id.'"
|
|
||||||
},
|
|
||||||
"sandbox": '.$sandbox.'
|
|
||||||
}',
|
|
||||||
CURLOPT_HTTPHEADER => array(
|
|
||||||
'Authorization: Bearer '.$access_token,
|
|
||||||
'Content-Type: application/json'
|
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue