@@ -1479,7 +1479,7 @@ class DistributionController extends BackendController | |||
'type' => $typePaymentTiller, | |||
'amount' => $orderManager->getOrderAmountWithTax( | |||
$order, | |||
Order::AMOUNT_TOTAL | |||
Order::AMOUNT_PAID | |||
) * 100, | |||
'status' => 'ACCEPTED', | |||
'date' => $strDate |
@@ -102,11 +102,11 @@ class Tiller | |||
if (isset($ordersTiller->orders)) { | |||
foreach ($ordersTiller->orders as $orderTiller) { | |||
if ($orderOpendistrib->tiller_external_id == $orderTiller->id) { | |||
$amountTotalOrderOpendistrib = (int)round( | |||
$orderManager->getOrderAmountWithTax($orderOpendistrib, Order::AMOUNT_TOTAL) * 100 | |||
$amountTotalPaidOrderOpendistrib = (int)round( | |||
$orderManager->getOrderAmountWithTax($orderOpendistrib, Order::AMOUNT_PAID) * 100 | |||
); | |||
if ($amountTotalOrderOpendistrib >= (int)$orderTiller->currentPayedAmount | |||
|| $amountTotalOrderOpendistrib >= (int)$orderTiller->currentBill) { | |||
if ($amountTotalPaidOrderOpendistrib >= (int)$orderTiller->currentPayedAmount | |||
|| $amountTotalPaidOrderOpendistrib >= (int)$orderTiller->currentBill) { | |||
$ordersOpendistribSynchro[$orderOpendistrib->id] = true; | |||
} | |||
} |
@@ -419,11 +419,14 @@ class OrderBuilder extends AbstractBuilder | |||
*/ | |||
public function initOrderPaidAmount(Order $order): void | |||
{ | |||
if (isset($order->creditHistory)) { | |||
// Attention : $order->creditHistory pas à jour si un paiement vient d'avoir lieu | |||
/*if (isset($order->creditHistory)) { | |||
$history = $order->creditHistory; | |||
} else { | |||
$history = $this->creditHistoryRepository->getByOrder($order); | |||
} | |||
}*/ | |||
$history = $this->creditHistoryRepository->getByOrder($order); | |||
$order->paid_amount = 0; | |||
@@ -513,9 +516,9 @@ class OrderBuilder extends AbstractBuilder | |||
if (!is_null($synchroTiller)) { | |||
$order->tiller_synchronization = $synchroTiller; | |||
} else { | |||
$paymentStatus = $this->orderSolver->getPaymentStatus($order); | |||
$amountPaid = $this->orderSolver->getOrderAmount($order, Order::AMOUNT_PAID); | |||
if ($paymentStatus == Order::PAYMENT_PAID) { | |||
if ($amountPaid >= 0.01) { | |||
$order->tiller_synchronization = 1; | |||
} else { | |||
$order->tiller_synchronization = 0; |
@@ -533,6 +533,7 @@ class OrderController extends ProducerBaseController | |||
} | |||
} | |||
$orderManager->initOrder($order); | |||
$orderManager->updateOrderTillerSynchronization($order); | |||
} | |||