Skip to content

Commit

Permalink
Merge pull request #79 from culqi/fix/installments
Browse files Browse the repository at this point in the history
Fix/installments
  • Loading branch information
JoseHCalderon authored Sep 17, 2024
2 parents 6ab98c4 + f74bb92 commit 167bd47
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
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>culqi</name>
<displayName><![CDATA[Culqi]]></displayName>
<version><![CDATA[3.1.1]]></version>
<version><![CDATA[3.1.2]]></version>
<description><![CDATA[Con&eacute;ctate a nuestra pasarela de pagos para aumentar tus ventas.]]></description>
<author><![CDATA[Culqi]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
3 changes: 3 additions & 0 deletions controllers/front/chargeajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public function displayAjax()
if (Tools::getValue("parameters3DS") !== FALSE) {
$args_charge['authentication_3DS'] = Tools::getValue("parameters3DS");
}
if (Tools::getValue("installments") !== FALSE) {
$args_charge['installments'] = Tools::getValue("installments");
}
$culqi_charge = $culqi->Charges->create($args_charge);

} catch (Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion culqi.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if (!defined('_PS_VERSION_'))
exit;

define('CULQI_PLUGIN_VERSION', '3.1.1');
define('CULQI_PLUGIN_VERSION', '3.1.2');

define('URLAPI_INTEG', 'https://integ-panel.culqi.com');
define('URLAPI_PROD', 'https://panel.culqi.com');
Expand Down
43 changes: 24 additions & 19 deletions views/templates/front/payment_execution_payme.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,21 @@ const run_waitMe = (bg='rgba(0,0,0, 0.7)') => {
$(document).ajaxComplete(function () {
});

var installments = (Culqi.token.metadata == undefined || Culqi.token.metadata.installments == undefined) ? 0 : Culqi.token.metadata.installments;
var payloadCharge = {
ajax: true,
action: 'displayAjax',
token_id: Culqi.token.id,
email: Culqi.token.email,
device: device,
parameters3DS: parameters3DS
};
if (Culqi.token.metadata != undefined && Culqi.token.metadata.installments != undefined){
payloadCharge.installments = Culqi.token.metadata.installments;
}

$.ajax({
url: fnReplace("{/literal}{$link->getModuleLink('culqi', 'chargeajax', [], true)|escape:'htmlall':'UTF-8'}{literal}"),
data: {
ajax: true,
action: 'displayAjax',
token_id: Culqi.token.id,
installments: installments,
email: Culqi.token.email,
device: device,
parameters3DS: parameters3DS
},
data: payloadCharge,
type: "POST",
dataType: 'json',
success: function (data, textStatus, xhr) {
Expand Down Expand Up @@ -441,17 +443,20 @@ const run_waitMe = (bg='rgba(0,0,0, 0.7)') => {
$(document).ajaxComplete(function () {
});

var installments = (Culqi.token.metadata == undefined || Culqi.token.metadata.installments == undefined) ? 0 : Culqi.token.metadata.installments;
var payloadCharge = {
ajax: true,
action: 'displayAjax',
token_id: Culqi.token.id,
email: Culqi.token.email,
device: device
};
if (Culqi.token.metadata != undefined && Culqi.token.metadata.installments != undefined){
payloadCharge.installments = Culqi.token.metadata.installments;
}

$.ajax({
url: fnReplace("{/literal}{$link->getModuleLink('culqi', 'chargeajax', [], true)|escape:'htmlall':'UTF-8'}{literal}"),
data: {
ajax: true,
action: 'displayAjax',
token_id: Culqi.token.id,
installments: installments,
email: Culqi.token.email,
device: device
},
data: payloadCharge,
type: "POST",
dataType: 'json',
success: function (data, textStatus, xhr) {
Expand Down

0 comments on commit 167bd47

Please sign in to comment.