mirror of
https://github.com/kikobar/hikashoppayment-triplea.git
synced 2024-11-16 12:12:16 +00:00
Add shopping cart to payment gateway
This commit is contained in:
parent
c2213d53ca
commit
22ae8137ac
|
@ -9,7 +9,7 @@ Smart Accounts ( https://www.smt-acc.com )
|
|||
Smart Accounts ( https://www.smt-acc.com )
|
||||
|
||||
## More details
|
||||
**This version of the code is work-in-progress and should not be use in any production site.**
|
||||
**This version of the code is released for testing. Use carefully on production sites.**
|
||||
At this stage the plugin is able to accept payments, but cannot receive payment notifications or process refunds.
|
||||
|
||||
The TripleA Cryptocurrency Payments API is documented here:
|
||||
|
|
|
@ -26,6 +26,23 @@ class plgHikashoppaymentTriplea extends hikashopPaymentPlugin{
|
|||
function onAfterOrderConfirm(&$order,&$methods,$method_id){
|
||||
parent::onAfterOrderConfirm($order, $methods, $method_id);
|
||||
|
||||
$tacart = array();
|
||||
foreach($order->cart->products as $v) {
|
||||
$temp = array();
|
||||
$temp['sku'] = $v->product_id;
|
||||
$temp['label'] = $v->order_product_name;
|
||||
$temp['quantity'] = (float)$v->order_product_quantity;
|
||||
$temp['amount'] = ((float)$v->order_product_price+(float)$v->order_product_tax)*$temp['quantity'];
|
||||
$tacart[] = $temp;
|
||||
};
|
||||
$tacart = array(
|
||||
"items"=>$tacart,
|
||||
"shipping_cost"=>$order->order_shipping_price, //includes tax
|
||||
"shipping_discount"=>$order->order_discount_price, //includes tax
|
||||
"tax_cost"=>0); //tax included above
|
||||
$tacart = json_encode($tacart);
|
||||
// var_dump($tacart); //debug only
|
||||
|
||||
$payment_url = $this->payment_params->url.'/payment';
|
||||
|
||||
$curl = curl_init();
|
||||
|
@ -44,6 +61,7 @@ class plgHikashoppaymentTriplea extends hikashopPaymentPlugin{
|
|||
"merchant_key": "'.$this->payment_params->merchant_key.'",
|
||||
"order_currency": "'.$this->currency->currency_code.'",
|
||||
"order_amount": '.$order->order_full_price.',
|
||||
"cart": '.$tacart.',
|
||||
"payer_id": "'.(string)$order->order_user_id.'",
|
||||
"payer_name": "'.$order->cart->billing_address->address_firstname.' '.$order->cart->billing_address->address_lastname.'",
|
||||
"payer_email": "'.$this->user->user_email.'",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" version="2.5" method="upgrade" group="hikashoppayment">
|
||||
<name>Hikashop TripleA Payment Plugin</name>
|
||||
<creationDate>17 July 2021</creationDate>
|
||||
<version>1.0.1</version>
|
||||
<creationDate>18 July 2021</creationDate>
|
||||
<version>1.1.0</version>
|
||||
<author>Enrique Barcelli</author>
|
||||
<authorEmail>e.barcelli@gmail.com</authorEmail>
|
||||
<authorUrl>http://www.smt-acc.com</authorUrl>
|
||||
|
|
Loading…
Reference in a new issue