payments as $payment) { $amountPaid += $payment->amount; } return $amountPaid; } public function isInvoicePaid(Invoice $invoice): bool { return $this->getInvoiceAmountPaid($invoice) >= Price::numberTwoDecimals($this->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL)); } }