From 00164033fe535189ed1b5b713053e56de6f9cd09 Mon Sep 17 00:00:00 2001 From: Emilio Davis Date: Mon, 11 May 2020 16:39:49 -0400 Subject: [PATCH] Use of order-confirmation page trackers compliance --- KhipuPostBack.php | 2 +- config.xml | 2 +- config_es.xml | 2 +- controllers/front/manual.php | 2 +- controllers/front/payme.php | 2 +- controllers/front/simplified.php | 2 +- controllers/front/validate.php | 27 ++++++++++++--------------- controllers/front/webpay.php | 2 +- controllers/front/webpaypsp.php | 2 +- khipupayment.php | 2 +- 10 files changed, 21 insertions(+), 24 deletions(-) diff --git a/KhipuPostBack.php b/KhipuPostBack.php index de5a133..26329c3 100644 --- a/KhipuPostBack.php +++ b/KhipuPostBack.php @@ -18,7 +18,7 @@ class KhipuPostback { - const PLUGIN_VERSION = '4.0.9'; + const PLUGIN_VERSION = '4.0.10'; public function init() { diff --git a/config.xml b/config.xml index 22e4a0e..3f35742 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ khipupayment - + diff --git a/config_es.xml b/config_es.xml index 1730663..907615b 100644 --- a/config_es.xml +++ b/config_es.xml @@ -2,7 +2,7 @@ khipupayment - + diff --git a/controllers/front/manual.php b/controllers/front/manual.php index c6580e7..c5d0dcf 100644 --- a/controllers/front/manual.php +++ b/controllers/front/manual.php @@ -71,7 +71,7 @@ public function initContent() $opts = array( 'transaction_id' => $order->reference , - 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference)) + 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference, "cartId"=>$cart->id)) , 'cancel_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"cancel", "reference"=>$order->reference)) , diff --git a/controllers/front/payme.php b/controllers/front/payme.php index 23306ec..68143c9 100644 --- a/controllers/front/payme.php +++ b/controllers/front/payme.php @@ -70,7 +70,7 @@ public function initContent() $opts = array( 'transaction_id' => $order->reference , - 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference)) + 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference, "cartId"=>$cart->id)) , 'cancel_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"cancel", "reference"=>$order->reference)) , diff --git a/controllers/front/simplified.php b/controllers/front/simplified.php index 3ac436f..08febfe 100644 --- a/controllers/front/simplified.php +++ b/controllers/front/simplified.php @@ -71,7 +71,7 @@ public function initContent() $opts = array( 'transaction_id' => $order->reference , - 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference)) + 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference, "cartId"=>$cart->id)) , 'cancel_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"cancel", "reference"=>$order->reference)) , diff --git a/controllers/front/validate.php b/controllers/front/validate.php index 249f3e8..58e6b23 100644 --- a/controllers/front/validate.php +++ b/controllers/front/validate.php @@ -32,6 +32,7 @@ public function initContent() private function handleGET() { + $cart_id = Tools::getValue('cartId'); $reference = Tools::getValue('reference'); $orders = Order::getByReference($reference); if (count($orders) == 0) { @@ -43,8 +44,10 @@ private function handleGET() ); } + $customer = $orders[0]->getCustomer(); + if (Tools::getValue('return') == 'cancel') { foreach ($orders as $order) { if ($order->current_state == (int)Configuration::get('PS_OS_KHIPU_OPEN')) { @@ -60,21 +63,15 @@ private function handleGET() } else { if (Tools::getValue('return') == 'ok') { - if ($this->context->customer->isLogged()) { - Tools::redirect( - Context::getContext()->link->getPageLink( - 'order-detail', true, null, - array("id_order" => $orders[0]->id) - ) - ); - } else { - Tools::redirect( - Context::getContext()->link->getPageLink( - 'guest-tracking', true, null, - array("order_reference" => $orders[0]->reference, "email" => $customer->email) - ) - ); - } + Tools::redirect( + Context::getContext()->link->getPageLink( + 'order-confirmation', true, null, + array("id_cart" => $cart_id + , "id_module" => Module::getInstanceByName($orders[0]->module)->id + , "id_order" => $orders[0]->id + , "key" => $customer->secure_key) + ) + ); } } } diff --git a/controllers/front/webpay.php b/controllers/front/webpay.php index 32bd508..b80b45c 100644 --- a/controllers/front/webpay.php +++ b/controllers/front/webpay.php @@ -71,7 +71,7 @@ public function initContent() $opts = array( 'transaction_id' => $order->reference , - 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference)) + 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference, "cartId"=>$cart->id)) , 'cancel_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"cancel", "reference"=>$order->reference)) , diff --git a/controllers/front/webpaypsp.php b/controllers/front/webpaypsp.php index 9a1dc2a..a6ff9d1 100644 --- a/controllers/front/webpaypsp.php +++ b/controllers/front/webpaypsp.php @@ -71,7 +71,7 @@ public function initContent() $opts = array( 'transaction_id' => $order->reference , - 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference)) + 'return_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"ok", "reference"=>$order->reference, "cartId"=>$cart->id)) , 'cancel_url' => Context::getContext()->link->getModuleLink($this->module->name, 'validate', array("return"=>"cancel", "reference"=>$order->reference)) , diff --git a/khipupayment.php b/khipupayment.php index b8593fc..d99d41a 100644 --- a/khipupayment.php +++ b/khipupayment.php @@ -36,7 +36,7 @@ public function __construct() { $this->name = 'khipupayment'; $this->tab = 'payments_gateways'; - $this->version = '4.0.9'; + $this->version = '4.0.10'; $this->apiVersion = '2.0'; $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); $this->author = 'Khipu SpA';