adding refabonne as parameter
This commit is contained in:
parent
0cc31c3d61
commit
578f689093
@ -441,14 +441,14 @@ class Paybox extends PaymentModule
|
||||
* Save Information de Paiement Paybox (retour de la banque)
|
||||
* @param array $values Tableau de retour Paybox
|
||||
**/
|
||||
public function saveInformationPaiement($values,$direct_plus=false) {
|
||||
public function saveInformationPaiement($values,$direct_plus=false, $refabonne = null) {
|
||||
|
||||
if(isset($values['u'])
|
||||
|| !empty($values['u'])
|
||||
&& !$direct_plus
|
||||
) {
|
||||
$cart = new Cart((int)$values["r"]);
|
||||
$this->saveInformationCB($values,$cart->id_customer);
|
||||
$this->saveInformationCB($values,$cart->id_customer, $refabonne);
|
||||
}
|
||||
|
||||
$sql_cart = 'SELECT `num_transaction`
|
||||
@ -485,12 +485,11 @@ class Paybox extends PaymentModule
|
||||
* Save Information de carte Paiement Paybox (retour de la banque + handle de la cart)
|
||||
* @param array $values Tableau de retour Paybox
|
||||
**/
|
||||
public function saveInformationCB($values,$id_customer) {
|
||||
public function saveInformationCB($values,$id_customer, $refabonne = null) {
|
||||
$handle = explode(' ',$values['u']);
|
||||
$date = substr($values["d"], -2).substr($values["d"], 0, 2);
|
||||
$payment = str_replace("_", " ",$values["c"]);
|
||||
$customer = new Customer((int)$id_customer);
|
||||
$refabonne = $customer->email;
|
||||
|
||||
$exists = Db::getInstance()->getValue('
|
||||
SELECT `id_paybox_card`
|
||||
@ -502,14 +501,17 @@ class Paybox extends PaymentModule
|
||||
');
|
||||
|
||||
if (empty($exists)) {
|
||||
$count_cards = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_paybox_card`)
|
||||
FROM `'._DB_PREFIX_.'paybox_customer_agreement`
|
||||
WHERE `id_customer` = '.(int)$id_customer.'
|
||||
');
|
||||
if ($count_cards) {
|
||||
$refabonne = $customer->email.((int)$count_cards+1);
|
||||
}
|
||||
if ($refabonne === null) {
|
||||
$refabonne = $customer->email;
|
||||
$count_cards = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_paybox_card`)
|
||||
FROM `'._DB_PREFIX_.'paybox_customer_agreement`
|
||||
WHERE `id_customer` = '.(int)$id_customer.'
|
||||
');
|
||||
if ($count_cards) {
|
||||
$refabonne = $customer->email.((int)$count_cards+1);
|
||||
}
|
||||
}
|
||||
$num_value = $values["n"].'XXXXX'.$values["j"];
|
||||
$save = Db::getInstance()->execute('
|
||||
INSERT INTO `ps_paybox_customer_agreement`
|
||||
|
Loading…
Reference in New Issue
Block a user