Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

26 linhas
646B

  1. <?php
  2. namespace domain\Document\Invoice;
  3. use common\helpers\Price;
  4. use domain\Document\Document\DocumentSolver;
  5. use domain\Order\Order\Order;
  6. class InvoiceSolver extends DocumentSolver
  7. {
  8. public function getInvoiceAmountPaid(Invoice $invoice): float
  9. {
  10. $amountPaid = 0;
  11. foreach($invoice->payments as $payment) {
  12. $amountPaid += $payment->amount;
  13. }
  14. return $amountPaid;
  15. }
  16. public function isInvoicePaid(Invoice $invoice): bool
  17. {
  18. return $this->getInvoiceAmountPaid($invoice) >= Price::numberTwoDecimals($this->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL));
  19. }
  20. }