You are here

public function Invoice::isPaid in Commerce Invoice 8.2

Gets whether the invoice has been fully paid.

Invoices are considered fully paid once their balance becomes zero or negative.

Return value

bool TRUE if the invoice has been fully paid, FALSE otherwise.

Overrides InvoiceInterface::isPaid

File

src/Entity/Invoice.php, line 458

Class

Invoice
Defines the invoice entity class.

Namespace

Drupal\commerce_invoice\Entity

Code

public function isPaid() {
  $total_price = $this
    ->getTotalPrice();
  if (!$total_price) {
    return FALSE;
  }
  $balance = $this
    ->getBalance();
  return $balance
    ->isNegative() || $balance
    ->isZero();
}