您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

27 行
735B

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