Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop
This commit is contained in:
commit
1a8bec1390
@ -2,13 +2,48 @@
|
||||
<div class="inner">
|
||||
<div class="input_radio">
|
||||
<div class="hidden">
|
||||
<form data-module-name="paybox" action="{$pbx_link}" method="post" name="paybox_form">
|
||||
<input type="hidden" name="save_paybox" id="save_paybox" value="0"/>
|
||||
<input type="hidden" name="PBX_MODE" value="{$PBX_MODE}" />
|
||||
<input type="hidden" name="PBX_TOTAL" value="{$PBX_TOTAL}" />
|
||||
{if isset($PBX_PAYBOX)}<input type="hidden" name="PBX_PAYBOX" value="{$PBX_PAYBOX}" />{/if}
|
||||
{if isset($PBX_BACKUP1)}<input type="hidden" name="PBX_BACKUP1" value="{$PBX_BACKUP1}" />{/if}
|
||||
<form id="paybox_form" method="POST" action="{$pbx_paybox}">
|
||||
<input type="hidden" name="PBX_SITE" value="{$pbx_site}">
|
||||
<input type="hidden" name="PBX_RANG" value="{$pbx_rang}">
|
||||
<input type="hidden" name="PBX_IDENTIFIANT" value="{$pbx_id}">
|
||||
<input type="hidden" name="PBX_LANGUE" value="{$pbx_langue}">
|
||||
<input type="hidden" name="PBX_TOTAL" value="{$pbx_total}">
|
||||
<input type="hidden" name="PBX_DEVISE" value="{$pbx_devise}">
|
||||
<input type="hidden" name="PBX_CMD" value="{$pbx_cmd}">
|
||||
<input type="hidden" name="PBX_PORTEUR" value="{$pbx_porteur}">
|
||||
<input type="hidden" name="PBX_REFABONNE" value="{$pbx_refabonne}">
|
||||
<input type="hidden" name="PBX_RETOUR" value="{$pbx_retour}">
|
||||
<input type="hidden" name="PBX_EFFECTUE" value="{$pbx_confurl}">
|
||||
<input type="hidden" name="PBX_ANNULE" value="{$pbx_cancelurl}">
|
||||
<input type="hidden" name="PBX_REFUSE" value="{$pbx_confurl}">
|
||||
<input type="hidden" name="PBX_REPONDRE_A" value="{$pbx_ipn}">
|
||||
<input type="hidden" name="PBX_3DS" value="{$pbx_3ds}">
|
||||
<input type="hidden" name="PBX_HASH" value="{$pbx_hash}">
|
||||
<input type="hidden" name="PBX_TIME" value="{$pbx_time}">
|
||||
<input type="hidden" name="PBX_HMAC" value="{$pbx_hmac}">
|
||||
</form>
|
||||
{if $pbx_refabonne_save}
|
||||
<form id="paybox_form_save" method="POST" action="{$pbx_paybox}">
|
||||
<input type="hidden" name="PBX_SITE" value="{$pbx_site}">
|
||||
<input type="hidden" name="PBX_RANG" value="{$pbx_rang}">
|
||||
<input type="hidden" name="PBX_IDENTIFIANT" value="{$pbx_id}">
|
||||
<input type="hidden" name="PBX_LANGUE" value="{$pbx_langue}">
|
||||
<input type="hidden" name="PBX_TOTAL" value="{$pbx_total}">
|
||||
<input type="hidden" name="PBX_DEVISE" value="{$pbx_devise}">
|
||||
<input type="hidden" name="PBX_CMD" value="{$pbx_cmd}">
|
||||
<input type="hidden" name="PBX_PORTEUR" value="{$pbx_porteur}">
|
||||
<input type="hidden" name="PBX_REFABONNE" value="{$pbx_refabonne_save}">
|
||||
<input type="hidden" name="PBX_RETOUR" value="{$pbx_retour_save}">
|
||||
<input type="hidden" name="PBX_EFFECTUE" value="{$pbx_confurl}">
|
||||
<input type="hidden" name="PBX_ANNULE" value="{$pbx_cancelurl}">
|
||||
<input type="hidden" name="PBX_REFUSE" value="{$pbx_confurl}">
|
||||
<input type="hidden" name="PBX_REPONDRE_A" value="{$pbx_ipn}">
|
||||
<input type="hidden" name="PBX_3DS" value="{$pbx_3ds}">
|
||||
<input type="hidden" name="PBX_HASH" value="{$pbx_hash}">
|
||||
<input type="hidden" name="PBX_TIME" value="{$pbx_time}">
|
||||
<input type="hidden" name="PBX_HMAC" value="{$pbx_hmac_save}">
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
<input type="radio" name="paiement-method" data-module-name="paybox" value="">
|
||||
</div>
|
||||
|
@ -229,19 +229,6 @@ class Paybox extends PaymentModule
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
die(Tools::displayError());
|
||||
|
||||
if(_PS_MOBILE_) {
|
||||
$smarty->assign(array(
|
||||
'PBX_PAYBOX' => 'https://tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi',
|
||||
'PBX_BACKUP1' => 'https://tpeweb1.paybox.com/cgi/ChoixPaiementMobile.cgi'
|
||||
));
|
||||
}
|
||||
|
||||
$ps_url = ((Configuration::get('PS_SSL_ENABLED') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == '443')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].__PS_BASE_URI__;
|
||||
|
||||
$pbx_total = (int)sprintf('%f', number_format(Tools::convertPrice($cart->getOrderTotal(), null, false), 2, '.', '') * 100);
|
||||
$pbx_link = $ps_url.'modules/'.$this->name.'/paiement.php';
|
||||
$pbx_link_plus = $ps_url.'modules/'.$this->name.'/direct_paiement.php';
|
||||
|
||||
// verif if there's at least one order with this delivery address
|
||||
$orders_with_delivery_address = Db::getInstance()->getValue('
|
||||
SELECT COUNT(o.`id_order`)
|
||||
@ -256,13 +243,6 @@ class Paybox extends PaymentModule
|
||||
)
|
||||
)
|
||||
');
|
||||
// $isInGroupTest = Db::getInstance()->getValue('
|
||||
// SELECT COUNT(cg.`id_group`)
|
||||
// FROM '._DB_PREFIX_.'customer_group cg
|
||||
// WHERE cg.`id_customer` = '.(int)$cart->id_customer.'
|
||||
// AND cg.`id_group` = 2
|
||||
// ');
|
||||
//if ($isInGroupTest == 0 || $orders_with_delivery_address == 0){
|
||||
if ($orders_with_delivery_address == 0){
|
||||
$paybox_cards = array();
|
||||
} else {
|
||||
@ -276,13 +256,161 @@ class Paybox extends PaymentModule
|
||||
}
|
||||
}
|
||||
|
||||
// @Override Antadis HMAC
|
||||
$ps_url = ((Configuration::get('PS_SSL_ENABLED') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == '443')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].__PS_BASE_URI__;
|
||||
$pbx_link_plus = $ps_url.'modules/'.$this->name.'/direct_paiement.php';
|
||||
$pbx_site = trim(Configuration::get('PBX_SITE'));
|
||||
$pbx_rang = trim(Configuration::get('PBX_RANG'));
|
||||
$pbx_id = trim(Configuration::get('PBX_ID'));
|
||||
$pbx_cmd = $cart->id;
|
||||
$pbx_total = (int)sprintf('%f', number_format(Tools::convertPrice($cart->getOrderTotal(), null, false), 2, '.', '') * 100);
|
||||
$pbx_devise = 978; // euro
|
||||
$pbx_ipn = $ps_url.'modules/'.$module->name.'/validation.php';
|
||||
$pbx_porteur = $customer->email;
|
||||
$pbx_refabonne = $customer->email;
|
||||
$pbx_retour = 'm:M;r:R;t:T;a:A;b:B;p:P;c:C;s:S;y:Y;e:E;n:N;j:J;d:D;i:I;k:K';
|
||||
$pbx_retour_save = 'm:M;r:R;t:T;a:A;b:B;p:P;c:C;s:S;y:Y;e:E;n:N;j:J;d:D;u:U;i:I;k:K';
|
||||
|
||||
$language = new Language((int)$cart->id_lang);
|
||||
switch ($language->iso_code)
|
||||
{
|
||||
case 'fr':
|
||||
$pbx_langue = 'FRA';
|
||||
break;
|
||||
case 'es':
|
||||
$pbx_langue = 'ESP';
|
||||
break;
|
||||
case 'de':
|
||||
$pbx_langue = 'DEU';
|
||||
break;
|
||||
case 'it':
|
||||
$pbx_langue = 'ITA';
|
||||
break;
|
||||
case 'nl':
|
||||
$pbx_langue = 'NLD';
|
||||
break;
|
||||
case 'sv':
|
||||
$pbx_langue = 'SWE';
|
||||
break;
|
||||
case 'en-us':
|
||||
default:
|
||||
$pbx_langue = 'GBR';
|
||||
break;
|
||||
}
|
||||
unset($language);
|
||||
|
||||
$count_cards = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_paybox_card`)
|
||||
FROM `'._DB_PREFIX_.'paybox_customer_agreement`
|
||||
WHERE `id_customer` = '.(int)$cart->id_customer.'
|
||||
');
|
||||
if ($count_cards) {
|
||||
$pbx_refabonne_save = $customer->email.((int)$count_cards+1);
|
||||
} else {
|
||||
$pbx_refabonne_save = $customer->email;
|
||||
}
|
||||
|
||||
if (version_compare(_PS_VERSION_, '1.5', '>')){
|
||||
$pbx_confurl = $ps_url.'index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$module->id.'&key='.$customer->secure_key;
|
||||
$pbx_cancelurl = $ps_url.'index.php?controller=order&step=3';
|
||||
} else {
|
||||
$pbx_confurl = $ps_url.'order-confirmation.php?id_cart='.$cart->id.'&id_module='.$module->id.'&key='.$customer->secure_key;
|
||||
$pbx_cancelurl = $ps_url.'order.php?step=3';
|
||||
}
|
||||
|
||||
if(Configuration::get('PBX_DEMO_MODE') == 0){
|
||||
if (_PS_MOBILE_) {
|
||||
$pbx_paybox = "https://preprod-tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi";
|
||||
$pbx_backup1 = "https://preprod-tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi";
|
||||
} else {
|
||||
$pbx_paybox = "https://preprod-tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi";
|
||||
$pbx_backup1 = "https://preprod-tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi";
|
||||
}
|
||||
} else {
|
||||
if (_PS_MOBILE_) {
|
||||
$pbx_paybox = "https://tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi";
|
||||
$pbx_backup1 = "https://tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi";
|
||||
} else {
|
||||
$pbx_paybox = "https://tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi";
|
||||
$pbx_backup1 = "https://tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi";
|
||||
}
|
||||
}
|
||||
|
||||
// clef secrète du commerçant
|
||||
$secretKeyTest = Configuration::get('PBX_SECRETE_KEY');
|
||||
$binKey = pack("H*", $secretKeyTest);
|
||||
$pbx_hash = "SHA512";
|
||||
$pbx_time = date("c");
|
||||
$pbx_3ds = 'N';
|
||||
|
||||
// On crée la chaîne à hacher sans URLencodage
|
||||
$msg ="PBX_SITE=$pbx_site".
|
||||
"&PBX_RANG=$pbx_rang".
|
||||
"&PBX_IDENTIFIANT=$pbx_id".
|
||||
"&PBX_LANGUE=$pbx_langue".
|
||||
"&PBX_TOTAL=$pbx_total".
|
||||
"&PBX_DEVISE=$pbx_devise".
|
||||
"&PBX_CMD=$pbx_cmd".
|
||||
"&PBX_PORTEUR=$pbx_porteur".
|
||||
"&PBX_REFABONNE=$pbx_refabonne".
|
||||
"&PBX_RETOUR=$pbx_retour".
|
||||
"&PBX_EFFECTUE=$pbx_confurl".
|
||||
"&PBX_ANNULE=$pbx_cancelurl".
|
||||
"&PBX_REFUSE=$pbx_confurl".
|
||||
"&PBX_REPONDRE_A=$pbx_ipn".
|
||||
"&PBX_3DS=$pbx_3ds".
|
||||
"&PBX_HASH=$pbx_hash".
|
||||
"&PBX_TIME=$pbx_time";
|
||||
|
||||
// Chaine pour save la ref abonne au retour
|
||||
$msg_save ="PBX_SITE=$pbx_site".
|
||||
"&PBX_RANG=$pbx_rang".
|
||||
"&PBX_IDENTIFIANT=$pbx_id".
|
||||
"&PBX_LANGUE=$pbx_langue".
|
||||
"&PBX_TOTAL=$pbx_total".
|
||||
"&PBX_DEVISE=$pbx_devise".
|
||||
"&PBX_CMD=$pbx_cmd".
|
||||
"&PBX_PORTEUR=$pbx_porteur".
|
||||
"&PBX_REFABONNE=$pbx_refabonne_save".
|
||||
"&PBX_RETOUR=$pbx_retour_save".
|
||||
"&PBX_EFFECTUE=$pbx_confurl".
|
||||
"&PBX_ANNULE=$pbx_cancelurl".
|
||||
"&PBX_REFUSE=$pbx_confurl".
|
||||
"&PBX_REPONDRE_A=$pbx_ipn".
|
||||
"&PBX_3DS=$pbx_3ds".
|
||||
"&PBX_HASH=$pbx_hash".
|
||||
"&PBX_TIME=$pbx_time";
|
||||
|
||||
$pbx_hmac = strtoupper(hash_hmac('sha512', $msg, $binKey));
|
||||
$pbx_hmac_save = strtoupper(hash_hmac('sha512', $msg_save, $binKey));
|
||||
// @End override
|
||||
|
||||
$smarty->assign(array(
|
||||
'PBX_MODE' => 1,
|
||||
'pbx_link' => $pbx_link,
|
||||
'PBX_TOTAL' => $pbx_total,
|
||||
'pbx_picture' => 'paybox',
|
||||
'pbx_text' => $this->l('Pay by credit card with Paybox'),
|
||||
'paybox_cards' => $paybox_cards,
|
||||
'PBX_MODE' => 1,
|
||||
'pbx_paybox' => $pbx_paybox,
|
||||
'pbx_total' => $pbx_total,
|
||||
'pbx_site' => $pbx_site,
|
||||
'pbx_rang' => $pbx_rang,
|
||||
'pbx_id' => $pbx_id,
|
||||
'pbx_cmd' => $pbx_cmd,
|
||||
'pbx_total' => $pbx_total,
|
||||
'pbx_devise' => $pbx_devise,
|
||||
'pbx_ipn' => $pbx_ipn,
|
||||
'pbx_porteur' => $pbx_porteur,
|
||||
'pbx_refabonne' => $pbx_refabonne,
|
||||
'pbx_refabonne_save' => $pbx_refabonne_save,
|
||||
'pbx_retour' => $pbx_retour,
|
||||
'pbx_retour_save' => $pbx_retour_save,
|
||||
'pbx_confurl' => $pbx_confurl,
|
||||
'pbx_cancelurl' => $pbx_cancelurl,
|
||||
'pbx_3ds' => $pbx_3ds,
|
||||
'pbx_langue' => $pbx_langue,
|
||||
'pbx_hmac' => $pbx_hmac,
|
||||
'pbx_hmac_save' => $pbx_hmac_save,
|
||||
|
||||
'pbx_picture' => 'paybox',
|
||||
'pbx_text' => $this->l('Pay by credit card with Paybox'),
|
||||
'paybox_cards' => $paybox_cards,
|
||||
'pbx_link_plus' => $pbx_link_plus
|
||||
));
|
||||
|
||||
|
@ -74,13 +74,22 @@
|
||||
window.location = $input.val();
|
||||
}
|
||||
} else {
|
||||
$form = $input.parent().children('div.hidden').children('form');
|
||||
$name = $form.attr('data-module-name');
|
||||
// LOADER POUR PAYPAL
|
||||
if ($input.attr('data-module-name') == "paypal") {
|
||||
$('.overlay_bbb').fadeIn();
|
||||
$('.box_paypal').fadeIn();
|
||||
$name = 'paypal';
|
||||
if($input.attr('data-module-name') == "paybox"){
|
||||
if(!$('input#save_info_paybox:checked').length){
|
||||
$form = $input.parent().children('form#paybox_form');
|
||||
} else {
|
||||
$form = $input.parent().children('form#paybox_form_save');
|
||||
}
|
||||
$name = "paybox";
|
||||
} else {
|
||||
$form = $input.parent().children('div.hidden').children('form');
|
||||
$name = $form.attr('data-module-name');
|
||||
// LOADER POUR PAYPAL
|
||||
if ($input.attr('data-module-name') == "paypal") {
|
||||
$('.overlay_bbb').fadeIn();
|
||||
$('.box_paypal').fadeIn();
|
||||
$name = 'paypal';
|
||||
}
|
||||
}
|
||||
if (window.ga && ga.create){
|
||||
// submit form by GA send event
|
||||
|
@ -73,13 +73,22 @@
|
||||
window.location = $input.val();
|
||||
}
|
||||
} else {
|
||||
$form = $input.parent().children('div.hidden').children('form');
|
||||
$name = $form.attr('data-module-name');
|
||||
// LOADER POUR PAYPAL
|
||||
if ($input.attr('data-module-name') == "paypal") {
|
||||
$('.overlay_bbb').fadeIn();
|
||||
$('.box_paypal').fadeIn();
|
||||
$name = 'paypal';
|
||||
if($input.attr('data-module-name') == "paybox"){
|
||||
if(!$('input#save_info_paybox:checked').length){
|
||||
$form = $input.parent().children('form#paybox_form');
|
||||
} else {
|
||||
$form = $input.parent().children('form#paybox_form_save');
|
||||
}
|
||||
$name = "paybox";
|
||||
} else {
|
||||
$form = $input.parent().children('div.hidden').children('form');
|
||||
$name = $form.attr('data-module-name');
|
||||
// LOADER POUR PAYPAL
|
||||
if ($input.attr('data-module-name') == "paypal") {
|
||||
$('.overlay_bbb').fadeIn();
|
||||
$('.box_paypal').fadeIn();
|
||||
$name = 'paypal';
|
||||
}
|
||||
}
|
||||
if (window.ga && ga.create){
|
||||
// submit form by GA send event
|
||||
|
Loading…
Reference in New Issue
Block a user