Skip to content

Commit

Permalink
Use of order-confirmation page trackers compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
edavism committed May 11, 2020
1 parent 0069226 commit 0016403
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion KhipuPostBack.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class KhipuPostback
{

const PLUGIN_VERSION = '4.0.9';
const PLUGIN_VERSION = '4.0.10';

public function init()
{
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>khipupayment</name>
<displayName><![CDATA[khipu]]></displayName>
<version><![CDATA[4.0.9]]></version>
<version><![CDATA[4.0.10]]></version>
<description><![CDATA[Pago usando khipu]]></description>
<author><![CDATA[khipu]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
2 changes: 1 addition & 1 deletion config_es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>khipupayment</name>
<displayName><![CDATA[khipu]]></displayName>
<version><![CDATA[4.0.9]]></version>
<version><![CDATA[4.0.10]]></version>
<description><![CDATA[Recibe pagos con khipu]]></description>
<author><![CDATA[khipu]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/manual.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
,
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/payme.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
,
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/simplified.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
,
Expand Down
27 changes: 12 additions & 15 deletions controllers/front/validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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')) {
Expand All @@ -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)
)
);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/webpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
,
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/webpaypsp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
,
Expand Down
2 changes: 1 addition & 1 deletion khipupayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 0016403

Please sign in to comment.