public function Order::isPaid in Commerce Core 8.2
Gets whether the order has been fully paid.
Free orders (total price is zero) are considered fully paid once they have been placed.
Non-free orders are considered fully paid once their balance becomes zero or negative.
Return value
bool TRUE if the order has been fully paid, FALSE otherwise.
Overrides OrderInterface::isPaid
File
- modules/
order/ src/ Entity/ Order.php, line 506
Class
- Order
- Defines the order entity class.
Namespace
Drupal\commerce_order\EntityCode
public function isPaid() {
$total_price = $this
->getTotalPrice();
if (!$total_price) {
return FALSE;
}
$balance = $this
->getBalance();
// Free orders are considered fully paid once they have been placed.
if ($total_price
->isZero()) {
return $this
->getState()
->getId() != 'draft';
}
else {
return $balance
->isNegative() || $balance
->isZero();
}
}