diff --git a/modules/paybox/direct_paiement.php b/modules/paybox/direct_paiement.php index 16b16370..2a30f55a 100644 --- a/modules/paybox/direct_paiement.php +++ b/modules/paybox/direct_paiement.php @@ -11,17 +11,16 @@ $controller->preProcess(); if (!$cookie->isLogged()) Tools::redirect('authentication.php'); -if (Tools::getValue('id_paybox_card')) { - $paybox_card = Db::getInstance()->getValue(' +$id_paybox_card = Tools::getValue('id_paybox_card', false); +if ($id_paybox_card) { + $paybox_card = Db::getInstance()->getRow(' SELECT * FROM `ps_paybox_customer_agreement` - WHERE `handle` = "'.pSQL($values["u"]).'" - AND `date`='.(int)$values["d"].' - AND `refabonne`='.(int)$value['b'].' - AND `id_customer`='.(int)$id_customer.' + WHERE `id_customer` = '.(int)$cart->id_customer.' + AND `id_paybox_card` = '.(int)$id_paybox_card.' '); if(empty($paybox_card)) { - Tools::redirect('authentication.php'); + Tools::redirect('order.php?step=3&cgv=1&paybox_error=1'); } } include(dirname(__FILE__).'/../../header.php'); @@ -44,7 +43,10 @@ Configuration::updateValue('NUM_QUESTION_PAYBOX', $num_question); $montant == (int)sprintf('%010d', number_format(Tools::convertPrice($cart->getOrderTotal(), null, false), 2, '.', '') * 100); $devise = 978; -$cvv = explode('++', $paybox_card['handle']); +$card_info = explode('++', $paybox_card['handle']); +$numbers = urldecode($card_info[0]); +$dateval = $card_info[1]; +$cvv = $card_info[2]; $customer = new Customer((int)$cart->id_customer); $refabonne = md5($customer->email); @@ -59,9 +61,10 @@ $postfields = array( 'DEVISE' => $devise, 'REFERENCE' => (int)$cart->id, 'REFABONNE' => md5($customer), - 'PORTEUR' => $paybox_card['handle'], - 'DATEVAL' => $paybox_card['date'], - 'CVV' => Configuration::get('PBX_DEMO_MODE') == 0 ?'123':$cvv, + 'PORTEUR' => $numbers, + 'DATEVAL' => $dateval, + 'ACTIVITE' => '027', + /*'CVV' => Configuration::get('PBX_DEMO_MODE') == 0 ?'123':$cvv,*/ 'DATEQ' => date('dmYHis') ); @@ -81,7 +84,7 @@ mail('marion@antadis.com', 'Paiement reponse globale', http_build_query($respons // payment success if (Configuration::get('PBX_DEMO_MODE') == 0) { - if ($code_reponse[1] == "XXXXXX" || $code_reponse[0] == "XXXXXX") { + if ($code_reponse[1] == "00000" || $code_reponse[0] == "00000") { return true; } } else { diff --git a/modules/paybox/hookpayment.tpl b/modules/paybox/hookpayment.tpl index ea0a0b77..c2756ad2 100755 --- a/modules/paybox/hookpayment.tpl +++ b/modules/paybox/hookpayment.tpl @@ -3,6 +3,7 @@
- +
{/foreach} {/if} - \ No newline at end of file +
+
+
+

{l s='Mémorisation de vos données bancaires' mod='paybox'}

+
+ {l s='Fermer la fenètre'} +
+
+

+ {l s='Lors du passage d\'une commande, vous pouvez choisir de mémoriser vos coordonnées de carte bancaire. Ces dernières seront alors enregistrées sur les serveurs sécurisés de Paybox. Votre compte enregistré vous sera proposé pour vos prochaines commandes sans que vous n\'ayez besoin de saisir de nouveau vos données.' mod='paybox'} +

+

+ {l s='Quelle que soit l\'option choisie, seul paybox a accès à vos informations, et en aucun cas Bébé Boutik.' mod='paybox'} +

+

+ {l s='Vous pouvez à tout moment voir et supprimer vos cartes enregistrées sur la page « Gérer mes moyens de paiement » dans le menu « Mon compte ».' mod='paybox'} +

+
+
+
+ + + + +{literal} + +{/literal} \ No newline at end of file diff --git a/modules/paybox/paiement.php b/modules/paybox/paiement.php index 8db68c2f..ef900faf 100755 --- a/modules/paybox/paiement.php +++ b/modules/paybox/paiement.php @@ -22,8 +22,9 @@ $ps_url = 'http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__; $pbx_site = trim(Configuration::get('PBX_SITE')); $pbx_rang = trim(Configuration::get('PBX_RANG')); $pbx_id = trim(Configuration::get('PBX_ID')); +$save_paybox = Tools::getValue('save_paybox', false); -if(Tools::getValue('save_info_paybox')) { +if($save_paybox) { $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;u:U;k:K'; } else { $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;k:K'; diff --git a/modules/paybox/paybox.php b/modules/paybox/paybox.php index dd01bb4d..88d85ad5 100755 --- a/modules/paybox/paybox.php +++ b/modules/paybox/paybox.php @@ -307,7 +307,7 @@ class Paybox extends PaymentModule **/ public function saveInformationCB($values,$id_customer) { - mail('marion@antadis.com', 'Transaction value', http_build_query($values,'',', ')); // dev + mail('marion@antadis.com', 'Transaction value + Save CB', http_build_query($values,'',', ')); // dev $exists = Db::getInstance()->getValue(' SELECT `id_paybox_card` diff --git a/modules/paymentinfo/manage.php b/modules/paymentinfo/manage.php index 7f528fb6..a1cccb23 100644 --- a/modules/paymentinfo/manage.php +++ b/modules/paymentinfo/manage.php @@ -10,7 +10,7 @@ if (!$cookie->isLogged()) include(dirname(__FILE__).'/../../header.php'); -// DELTE ACCOUNT PAYPAL +// DELETE ACCOUNT PAYPAL if (Tools::getValue('delete_agreement')) { $id_paypal_agreement = Tools::getValue('delete_agreement'); @@ -34,6 +34,31 @@ if (Tools::getValue('delete_agreement')) { 'delete' => true, )); } +// DELETE PAYBOX CARD +if (Tools::getValue('delete_card')) { + $id_paybox_card = Tools::getValue('delete_card'); + + $id_customer_test = Db::getInstance()->getValue(' + SELECT `id_customer` + FROM `'._DB_PREFIX_.'paybox_customer_agreement` + WHERE `id_paybox_card`= '.(int) $id_paybox_card.' + '); + if(empty($id_customer_test)) { + return false; + } + if($id_customer_test != $cookie->id_customer) { + return false; + } + // DELETE + Db::getInstance()->execute(' + DELETE FROM `'._DB_PREFIX_.'paybox_customer_agreement` + WHERE `id_paybox_card`= '.(int) $id_paybox_card + ); + $smarty->assign(array( + 'delete' => true, + )); +} + // account paypal $paypal_accounts = Db::getInstance()->executes(' SELECT `id_paypal_agreement`, `email`, `name`, `city`, `date_add` @@ -41,8 +66,16 @@ $paypal_accounts = Db::getInstance()->executes(' WHERE `id_customer`= '.(int) $cookie->id_customer.' '); +// account paybox +$paybox_accounts = Db::getInstance()->executes(' + SELECT `id_paybox_card`, `value`, `date`, `payment_type` + FROM `'._DB_PREFIX_.'paybox_customer_agreement` + WHERE `id_customer`= '.(int) $cookie->id_customer.' +'); + $smarty->assign(array( 'paypal_accounts' => $paypal_accounts, + 'paybox_accounts' => $paybox_accounts, )); diff --git a/themes/site/css/style.css b/themes/site/css/style.css index ad48f800..e5a18532 100755 --- a/themes/site/css/style.css +++ b/themes/site/css/style.css @@ -6571,6 +6571,24 @@ table#carrierTable tbody td { text-align:center; } +/***** Paybox save CB *****/ +.paybox_account { + background: #fff none repeat scroll 0 0; + border: 1px solid #ccc; + margin: 10px 0 5px; + padding: 15px; + overflow: auto; +} +.paybox_account input[type="radio"] { + float: left; + margin-right: 7px; + position: relative; + top: 3px; +} +.paybox_account label { + float: left; +} + @keyframes slideInDown { 0% { -webkit-transform: translateY(-500px); diff --git a/themes/site/modules/paymentinfo/paymentinfo.tpl b/themes/site/modules/paymentinfo/paymentinfo.tpl index 47c04b75..fe0e2dfa 100644 --- a/themes/site/modules/paymentinfo/paymentinfo.tpl +++ b/themes/site/modules/paymentinfo/paymentinfo.tpl @@ -37,4 +37,33 @@

{l s='No account register' mod='paymentinfo'}

+{/if} + +
+ +

{l s='My Cards' mod='paymentinfo'}

+ +{if $paybox_accounts} + + + + + + + + + {foreach from=$paybox_accounts item=paybox} + + + + + + + {/foreach} + +
{l s='Payment type' mod='paymentinfo'}{l s='Number' mod='paymentinfo'}{l s='Date validity' mod='paymentinfo'}{l s='Action' mod='paymentinfo'}
{$paybox.payment_type}{$paybox.value}{substr_replace($paybox.date,'/',-2,0)}{l s='Delete' mod='paymentinfo'}
+{else} +
+

{l s='No card register' mod='paymentinfo'}

+
{/if} \ No newline at end of file diff --git a/themes/site_mobile/modules/paymentinfo/paymentinfo.tpl b/themes/site_mobile/modules/paymentinfo/paymentinfo.tpl index 277cd023..46182351 100644 --- a/themes/site_mobile/modules/paymentinfo/paymentinfo.tpl +++ b/themes/site_mobile/modules/paymentinfo/paymentinfo.tpl @@ -37,6 +37,29 @@
+

{l s='My cards' mod='paymentinfo'}

+ +{if $paybox_accounts} + + + {foreach from=$paybox_accounts item=paybox} + + + + + {/foreach} + +
+ {$paybox.payment_type} - {$paybox.value} {substr_replace($paybox.date,'/',-2,0)} + {l s='Delete' mod='paymentinfo'}
+{else} +
+

{l s='No card register' mod='paymentinfo'}

+
+{/if} + +
+