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