Merge branch 'ticket-payboxAgreement' into develop

This commit is contained in:
Marion Muszynski 2016-07-18 12:47:23 +02:00
commit a65cb5e4d9
3 changed files with 11 additions and 12 deletions

View File

@ -19,7 +19,7 @@ if ($id_paybox_card) {
WHERE `id_customer` = '.(int)$cart->id_customer.'
AND `id_paybox_card` = '.(int)$id_paybox_card.'
');
if(empty($paybox_card)) {
if(empty($paybox_card) || (int)$paybox_card['id_customer']!=(int)$cart->id_customer) {
Tools::redirect('order.php?step=3&cgv=1&paybox_error=1');
}
}
@ -43,10 +43,8 @@ Configuration::updateValue('NUM_QUESTION_PAYBOX', $num_question);
$montant == (int)sprintf('%010d', number_format(Tools::convertPrice($cart->getOrderTotal(), null, false), 2, '.', '') * 100);
$devise = 978;
$card_info = explode('++', $paybox_card['handle']);
$numbers = urldecode($card_info[0]);
$dateval = $card_info[1];
$cvv = $card_info[2];
$numbers = urldecode($paybox_card['handle']);
$dateval = $paybox_card['date'];
$customer = new Customer((int)$cart->id_customer);
$refabonne = md5($customer->email);
@ -60,7 +58,7 @@ $postfields = array(
'MONTANT' => $montant,
'DEVISE' => $devise,
'REFERENCE' => (int)$cart->id,
'REFABONNE' => md5($customer),
'REFABONNE' => $refabonne,
'PORTEUR' => $numbers,
'DATEVAL' => $dateval,
'ACTIVITE' => '027',

View File

@ -269,13 +269,13 @@ class Paybox extends PaymentModule
* Save Information de Paiement Paybox (retour de la banque)
* @param array $values Tableau de retour Paybox
**/
public function saveInformationPaiement($values,$id_customer=null,$direct_plus=false) {
public function saveInformationPaiement($values,$id_customer=0,$direct_plus=false) {
mail('marion@antadis.com', 'Transaction value', http_build_query($values,'',', ')); // dev
if(isset($values['u'])
|| !empty($values['u'])
&& $id_customer!=null
&& (int)$id_customer!=0
&& !$direct_plus
) {
$this->saveInformationCB($values,$id_customer);
@ -316,11 +316,12 @@ class Paybox extends PaymentModule
public function saveInformationCB($values,$id_customer) {
mail('marion@antadis.com', 'Transaction value + Save CB', http_build_query($values,'',', ')); // dev
$handle = explode(' ',$values['u']);
$exists = Db::getInstance()->getValue('
SELECT `id_paybox_card`
FROM `ps_paybox_customer_agreement`
WHERE `handle` = "'.pSQL($values["u"]).'"
WHERE `handle` = "'.pSQL($handle[0]).'"
AND `date`='.(int)$values["d"].'
AND `refabonne`='.(int)$values['b'].'
AND `id_customer`='.(int)$id_customer.'
@ -330,11 +331,11 @@ class Paybox extends PaymentModule
$num_value = (int)$values["n"].'XXXXX'.(int)$values["j"];
$save = Db::getInstance()->execute('
INSERT INTO `ps_paybox_customer_agreement`
(`id_customer`, `handle`, `refabonne`,`value`,`date`,`payment_type`)
(`id_customer`,`refabonne`,`handle`,`value`,`date`,`payment_type`)
VALUES (
'. (int)$id_customer .',
'. (int)$values["b"] .',
"'. pSQL($values["u"]) .'",
"'. pSQL($handle[0]) .'",
"'. pSQL($num_value) .'",
'. (int)$values["d"] .',
"'. pSQL($values["c"]) .'"

View File

@ -89,7 +89,7 @@ if (!$cart->id)
if ($id_order = (int)Order::getOrderByCartId($cart->id))
{
$paybox->saveInformationPaiement($values,$cart->id_customer);
$paybox->saveInformationPaiement($values,(int)$cart->id_customer);
if (empty($error))
{