Browse Source

[Administration] Documents > Factures : gestion des paiements #1219

feature/souke
Guillaume Bourgeois 1 year ago
parent
commit
52cb79be13
2 changed files with 7 additions and 2 deletions
  1. +5
    -2
      common/logic/Order/Order/Repository/OrderRepository.php
  2. +2
    -0
      common/logic/Order/Order/Service/OrderSolver.php

+ 5
- 2
common/logic/Order/Order/Repository/OrderRepository.php View File



public function isOrderPaid(Order $order): bool public function isOrderPaid(Order $order): bool
{ {
if($this->orderSolver->getOrderAmount($order, Order::AMOUNT_PAID)
>= $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL)) {
$amountPaid = $this->orderSolver->getOrderAmount($order, Order::AMOUNT_PAID);
$amountTotal = $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL);

if(abs($amountPaid - $amountTotal) < 0.00001
|| $amountPaid >= $amountTotal) {
return true; return true;
} }



+ 2
- 0
common/logic/Order/Order/Service/OrderSolver.php View File

$amount = $order->invoice_amount + $this->getOrderTotalVat($order, $type); $amount = $order->invoice_amount + $this->getOrderTotalVat($order, $type);
} }


$amount = round($amount, 2);

return $this->_getAmountGeneric($order, $type, $amount, $format); return $this->_getAmountGeneric($order, $type, $amount, $format);
} }



Loading…
Cancel
Save