Merge branch 'ticket-10945'
This commit is contained in:
commit
d598b4df54
@ -249,10 +249,10 @@ class Paybox extends PaymentModule
|
||||
'pbx_text' => $this->l('Pay by credit card with Paybox')
|
||||
));
|
||||
|
||||
return ($this->display(__FILE__, 'hookpayment.tpl'));
|
||||
return ($this->display(__FILE__, 'hookpayment.tpl'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save Information de Paiement Paybox (retour de la banque)
|
||||
* @param array $values Tableau de retour Paybox
|
||||
@ -264,7 +264,7 @@ class Paybox extends PaymentModule
|
||||
$exists = Db::getInstance()->getValue($sql_cart);
|
||||
|
||||
if (empty($exists)) {
|
||||
$sql = 'INSERT INTO `ps_paybox_transaction`
|
||||
$sql = 'INSERT INTO `ps_paybox_transaction`
|
||||
(`amount`, `id_cart`, `num_appel`, `num_autorisation`, `paiement`, `type`, `num_transaction`, `code_erreur`, `date_carte`, `date_add`)
|
||||
VALUES (
|
||||
'. (int)$values["m"] .',
|
||||
@ -293,17 +293,18 @@ class Paybox extends PaymentModule
|
||||
if(Tools::getValue('noCancelHook')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// if(Tools::isSubmit('generateDiscount'))
|
||||
// return false;
|
||||
|
||||
|
||||
if($params['order']->module != $this->name)
|
||||
return false;
|
||||
if(!($order = $params['order']) OR !Validate::isLoadedObject($order))
|
||||
return false;
|
||||
|
||||
|
||||
if($cookie->profile == 1
|
||||
|| $cookie->profile == 7
|
||||
|| $cookie->profile == 14
|
||||
|| $cookie->profile == 11) {
|
||||
if(!$order->hasBeenPaid()) {
|
||||
// mail('thibault@antadis.com', 'Erreur remboursement', 'Erreur de remboursement sur la commande ' . $order_detail->id_order . ' la commande n\'a pas été payée.');
|
||||
@ -324,7 +325,7 @@ class Paybox extends PaymentModule
|
||||
// if(Tools::isSubmit('generateDiscount')) {
|
||||
// return FALSE;
|
||||
// }
|
||||
|
||||
|
||||
if($params['order']->module != $this->name) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -342,8 +343,9 @@ class Paybox extends PaymentModule
|
||||
if (Tools::isSubmit('generateCreditSlip')) {
|
||||
if($cookie->profile == 1
|
||||
|| $cookie->profile == 7
|
||||
|| $cookie->profile == 14
|
||||
|| $cookie->profile == 11) {
|
||||
|
||||
|
||||
$order = new Order($order_detail->id_order);
|
||||
|
||||
if ($order->payment == "Paybox") {
|
||||
@ -356,7 +358,7 @@ class Paybox extends PaymentModule
|
||||
$this->refundProduct($params['id_order_detail']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -407,7 +409,7 @@ class Paybox extends PaymentModule
|
||||
$montant = min($amt, $order->total_paid_real - ((int) $total_shipping * $order->total_shipping) - $total_refunded);
|
||||
|
||||
$refund = $this->sendRefundPaybox($montant, 978, $transaction['num_transaction'], $order->id_cart, $transaction['num_appel']);
|
||||
|
||||
|
||||
if (!$refund) {
|
||||
// mail('thibault@antadis.com', 'Erreur dans le remboursement produit', 'Erreur remboursement échoué pour la commande ' . $order_detail->id_order);
|
||||
mail('karen@bebeboutik.com', 'Erreur dans le remboursement', 'Erreur remboursement échoué pour la commande ' . $order_detail->id_order);
|
||||
@ -449,12 +451,12 @@ class Paybox extends PaymentModule
|
||||
|
||||
if($montant > 0) {
|
||||
$refund = $this->sendRefundPaybox($montant, 978, $transaction['num_transaction'], $order->id_cart, $transaction['num_appel']);
|
||||
|
||||
|
||||
if (!$refund) {
|
||||
// mail('thibault@antadis.com', 'Erreur dans le remboursement des shippings', 'Erreur remboursement échoué pour la commande ' . $order->id);
|
||||
mail('karen@bebeboutik.com', 'Erreur dans le remboursement', 'Erreur remboursement échoué pour la commande ' . $order->id);
|
||||
mail('doreen@bebeboutik.com', 'Erreur dans le remboursement', 'Erreur remboursement échoué pour la commande ' . $order->id);
|
||||
mail('contact@bebeboutik.com', 'Erreur dans le remboursement', 'Erreur remboursement échoué pour la commande ' . $order->id);
|
||||
mail('doreen@bebeboutik.com', 'Erreur dans le remboursement', 'Erreur remboursement échoué pour la commande ' . $order->id);
|
||||
mail('contact@bebeboutik.com', 'Erreur dans le remboursement', 'Erreur remboursement échoué pour la commande ' . $order->id);
|
||||
} else {
|
||||
$this->refundSave($order->id, 0, $montant, $cookie->id_employee);
|
||||
}
|
||||
@ -473,10 +475,10 @@ class Paybox extends PaymentModule
|
||||
**/
|
||||
public function sendRefundPaybox($montant, $devise, $num_transaction, $reference, $num_appel) {
|
||||
$curl = curl_init('https://ppps.paybox.com/PPPS.php');
|
||||
|
||||
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
|
||||
|
||||
|
||||
$pbx_site = trim(Configuration::get('PBX_SITE'));
|
||||
$pbx_rang = trim(Configuration::get('PBX_RANG'));
|
||||
$pbx_id = trim(Configuration::get('PBX_ID'));
|
||||
@ -502,13 +504,13 @@ class Paybox extends PaymentModule
|
||||
'REFERENCE' => $reference,
|
||||
'DATEQ' => date('dmYHis')
|
||||
);
|
||||
|
||||
|
||||
$trame = http_build_query($postfields, '', '&');
|
||||
|
||||
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $trame);
|
||||
|
||||
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
|
||||
@ -537,7 +539,7 @@ class Paybox extends PaymentModule
|
||||
**/
|
||||
protected function refundSave($id_order, $id_order_detail = 0, $montant, $id_employee) {
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'refund_transaction`
|
||||
INSERT INTO `'._DB_PREFIX_.'refund_transaction`
|
||||
(`id_order`, `id_order_detail`, `amount`, `date`, `id_employee`)
|
||||
VALUES (
|
||||
'. (int)$id_order .',
|
||||
@ -549,7 +551,7 @@ class Paybox extends PaymentModule
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load les informations d'une transaction paybox
|
||||
* @param int $id_cart Numéro du panier à charger
|
||||
@ -558,7 +560,7 @@ class Paybox extends PaymentModule
|
||||
public function loadTransaction($id_cart) {
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'paybox_transaction`
|
||||
FROM `'._DB_PREFIX_.'paybox_transaction`
|
||||
WHERE `id_cart` = '. (int)$id_cart
|
||||
);
|
||||
}
|
||||
@ -567,7 +569,7 @@ class Paybox extends PaymentModule
|
||||
/**
|
||||
* Recupere la liste des remboursements effectués sur un id cmomande
|
||||
* @param int $order_id id de la commande
|
||||
* @return array
|
||||
* @return array
|
||||
**/
|
||||
public static function getAllRefundbyOrder($order_id) {
|
||||
return Db::getInstance()->executeS('
|
||||
@ -579,4 +581,4 @@ class Paybox extends PaymentModule
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user