From d0639cf70f40e29014564eb413888eae4e4f78e9 Mon Sep 17 00:00:00 2001
From: Willy Aguirre
Date: Mon, 20 Feb 2017 16:52:48 -0500
Subject: [PATCH 1/5] add table for control orders of prestashop and culqi
---
culqi.php | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/culqi.php b/culqi.php
index 4c79445..9b27f98 100755
--- a/culqi.php
+++ b/culqi.php
@@ -44,6 +44,17 @@ public function __construct()
public function install()
{
+ // Run sql for creating DB tables
+ Db::getInstance()->execute("CREATE TABLE IF NOT EXISTS "._DB_PREFIX_."culqi_order (
+ id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
+ culqi_charge_id varchar(255) NULL,
+ amount int NULL,
+ installments int NULL,
+ email varchar(255) NULL,
+ prestashop_order_id varchar(255) NULL
+ ) ENGINE=" . _MYSQL_ENGINE_ . " DEFAULT CHARSET=utf8
+ ");
+
$this->createStates();
return (
@@ -102,9 +113,13 @@ public function charge($token_id, $installments)
$culqi = new Culqi\Culqi(array('api_key' => Configuration::get('CULQI_LLAVE_COMERCIO')));
+ $amount = $this->removeComma($cart->getOrderTotal(true, Cart::BOTH));
+ $email = $this->context->customer->email;
+ $order_id = (string)$cart->id;
+
$cargo = $culqi->Charges->create(
array(
- "amount" => $this->removeComma($cart->getOrderTotal(true, Cart::BOTH)),
+ "amount" => $amount,
"antifraud_details" => array(
"address" => $this->getAddress($userAddress),
"address_city" => $userAddress->city,
@@ -117,11 +132,22 @@ public function charge($token_id, $installments)
"currency_code" => "PEN",
"description" => "Orden de compra ".$cart->id,
"installments" => $installments,
- "metadata" => array("order_id"=>(string)$cart->id),
- "email" => $this->context->customer->email,
+ "metadata" => array("order_id"=>$order_id),
+ "email" => $email,
"source_id" => $token_id
)
);
+
+ if($cargo->object == "charge") {
+ Db::getInstance()->insert('culqi_order', array(
+ 'culqi_charge_id' => (string)$cargo->id,
+ 'amount' => $amount,
+ 'installments' => $installments,
+ 'email' => $email,
+ 'prestashop_order_id' => $order_id
+ ));
+ }
+
return $cargo;
} catch(Exception $e){
return $e->getMessage();
@@ -194,6 +220,8 @@ public function uninstallStates()
public function uninstall()
{
+ Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'culqi_order');
+
if (!parent::uninstall()
|| !Configuration::deleteByName('CULQI_STATE_OK')
|| !Configuration::deleteByName('CULQI_STATE_ERROR')
From b3e91d27a9d2f775f19830c66fa0d9d31a8f4458 Mon Sep 17 00:00:00 2001
From: LizRuelas
Date: Thu, 23 Feb 2017 11:54:01 -0500
Subject: [PATCH 2/5] Update payment_execution.tpl
---
views/templates/front/payment_execution.tpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/views/templates/front/payment_execution.tpl b/views/templates/front/payment_execution.tpl
index 42f7d9d..40ceadd 100755
--- a/views/templates/front/payment_execution.tpl
+++ b/views/templates/front/payment_execution.tpl
@@ -9,7 +9,7 @@
Usted ha elegido pagar con tarjeta de crédito o débito. Solo cuenta con 10 minutos para realizar el pago, de lo contrario este expirará.
- - {l s='El monto total a cancelar es deeeee:' mod='culqi'}
+ - {l s='El monto total a cancelar es de:' mod='culqi'}
{displayPrice price=$total}
From 2e99c2c7b74ad64da2a48cf2dd46b7e8501610d0 Mon Sep 17 00:00:00 2001
From: Brayan Cruces
Date: Wed, 12 Jun 2019 17:45:45 -0500
Subject: [PATCH 3/5] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 473b8c2..fd0922b 100755
--- a/README.md
+++ b/README.md
@@ -11,9 +11,9 @@ donde encontraras tus llaves `` : ` :
+`` :
![Imgur](https://i.imgur.com/dMjMefw.png)
From ede5c1966f593ee526f3730f79798a37a3f22fe2 Mon Sep 17 00:00:00 2001
From: Brayan Cruces
Date: Wed, 19 Jun 2019 18:25:06 -0500
Subject: [PATCH 4/5] =?UTF-8?q?Configuraci=C3=B3n=20de=20imagen=20de=20tar?=
=?UTF-8?q?jetas/efectivo?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
culqi.php | 7 +++++--
views/templates/hook/payment.tpl | 2 +-
views/templates/hook/payment_multi.tpl | 17 +++++++++++++++++
3 files changed, 23 insertions(+), 3 deletions(-)
create mode 100755 views/templates/hook/payment_multi.tpl
diff --git a/culqi.php b/culqi.php
index ab72124..e564b53 100755
--- a/culqi.php
+++ b/culqi.php
@@ -206,8 +206,11 @@ public function hookPayment($params)
$this->smarty->assign(array(
'this_path' => $this->_path,
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
- ));
- return $this->display(__FILE__, 'payment.tpl');
+ ));
+
+ if(Configuration::get('CULQI_ENABLED_MULTIPAYMENT')) return $this->display(__FILE__, 'payment_multi.tpl');
+
+ return $this->display(__FILE__, 'payment.tpl');
}
public function hookPaymentReturn($params)
diff --git a/views/templates/hook/payment.tpl b/views/templates/hook/payment.tpl
index 0dcc026..afe65fb 100755
--- a/views/templates/hook/payment.tpl
+++ b/views/templates/hook/payment.tpl
@@ -1,7 +1,7 @@
diff --git a/views/templates/hook/payment_multi.tpl b/views/templates/hook/payment_multi.tpl
new file mode 100755
index 0000000..6f3a12d
--- /dev/null
+++ b/views/templates/hook/payment_multi.tpl
@@ -0,0 +1,17 @@
+
+
+
From f8301d25db62680cf30dcd017e722aca2b13c920 Mon Sep 17 00:00:00 2001
From: Brayan Cruces
Date: Wed, 19 Jun 2019 18:30:49 -0500
Subject: [PATCH 5/5] Change version
---
culqi.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/culqi.php b/culqi.php
index e564b53..1494d2e 100755
--- a/culqi.php
+++ b/culqi.php
@@ -27,7 +27,7 @@ public function __construct()
{
$this->name = 'culqi';
$this->tab = 'payments_gateways';
- $this->version = '2.3.0';
+ $this->version = '2.3.1';
$this->controllers = array('chargeajax', 'payment', 'validation', 'postpayment', 'postpendingpayment', 'orderajax');
$this->author = "Team Culqi (Brayan Cruces)";
$this->need_instance = 0;