Save refund message and transaction for shipping cost

This commit is contained in:
Michael RICOIS 2018-02-21 13:04:53 +01:00
parent 134af30198
commit f82639ca09
2 changed files with 12 additions and 10 deletions

View File

@ -1629,11 +1629,10 @@ class AdminOrders extends AdminTab
</div>';
}
$html .= '<div style="padding:10px 20px;background:#efefef;font-size: 12px;" '.(sizeof($slips)?'class="col-md-8"':'').'>';
if($order->module && $order->module=="paybox"){
if ($order->module && $order->module == "paybox") {
require_once dirname(__FILE__).'/../../modules/paybox/paybox.php';
$refundsPaybox = Paybox::getAllRefundbyOrder($order->id);
if (sizeof($refundsPaybox))
{
if (sizeof($refundsPaybox)) {
$html .='<table class="table table-condensed" width="100%;" cellspacing="0" cellpadding="0">';
foreach ($refundsPaybox as $refund) {
$html .='
@ -1646,7 +1645,7 @@ class AdminOrders extends AdminTab
} else {
$html .= '<p class="text-center">Pas de remboursement</p>';
}
} elseif($order->module && $order->module=="paypal") {
} elseif ($order->module && $order->module == "paypal") {
$paypal_messages = Db::getInstance()->ExecuteS('
SELECT `message`, `date_add`
FROM `ps_message`
@ -1659,12 +1658,11 @@ class AdminOrders extends AdminTab
$html .= '<p>('.date('d/m/Y',strtotime($message['message'])).'):<br>'.$message['message'].'</p>';
}
}
if(empty($paypal_messages)){
$html .= '<p class="text-center">Pas de remboursement</p>';
if (empty($paypal_messages)){
$html .= '<p class="text-center">Pas de remboursement</p>';
}
}
$html .='</div>
$html .='</div>
</div>
</div>
</div>
@ -1720,8 +1718,7 @@ class AdminOrders extends AdminTab
</div>
<div class="panel-content">';
if (sizeof($messages)) {
foreach ($messages as $message)
{
foreach ($messages as $message) {
$html.= '<div style="background:#efefef;padding:5px;margin-bottom:10px;overflow:auto;" '.($message['is_new_for_me'] ?'class="new_message"':'').'>';
if ($message['is_new_for_me']){
$html.= '<a class="new_message" title="'.$this->l('Mark this message as \'viewed\'').'" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&token='.$this->token.'&messageReaded='.(int)($message['id_message']).'"><img src="../img/admin/enabled.gif" alt="" /></a>';

View File

@ -725,6 +725,7 @@ class PayPal extends PaymentModule
// Get product amount to refund
$amount = $order->total_shipping;
$message = $this->l('Cancel shipping cost result:').'<br>';
if ($amount > 0){
$refund = $this->_makeRefund($paypal_order['id_transaction'], (int)$order->id, $amount);
@ -734,8 +735,12 @@ class PayPal extends PaymentModule
mail('contact@bebeboutik.com', 'Erreur dans le remboursement', 'Erreur remboursement échoué pour la commande ' . $order_detail->id_order);
} else {
$this->refundSave($order->id, 0, $amount, $cookie->id_employee);
$message .= $this->l('Transaction error because of the amount of the shipping cost!').'<br>';
}
}
$this->formatMessage($refund, $message);
$this->_addNewPrivateMessage((int)$order->id, $message);
}
public function hookCancelProduct($params)