function uc_payment_balance in Ubercart 8.4
Same name and namespace in other branches
- 5 payment/uc_payment/uc_payment.module \uc_payment_balance()
- 6.2 payment/uc_payment/uc_payment.module \uc_payment_balance()
- 7.3 payment/uc_payment/uc_payment.module \uc_payment_balance()
Returns the balance of payments on an order.
Parameters
\Drupal\uc_order\OrderInterface $order: An order entity.
6 calls to uc_payment_balance()
- CreditCardTerminalForm::buildForm in payment/
uc_credit/ src/ Form/ CreditCardTerminalForm.php - Form constructor.
- Payment::view in payment/
uc_payment/ src/ Plugin/ Ubercart/ OrderPane/ Payment.php - Returns the contents of an order pane as a store administrator.
- PaymentBalanceCondition::doEvaluate in payment/
uc_payment/ src/ Plugin/ Condition/ PaymentBalanceCondition.php - Condition: Check the current order balance.
- ReceiveCheckForm::buildForm in payment/
uc_payment_pack/ src/ Form/ ReceiveCheckForm.php - Form constructor.
- uc_payment_tokens in payment/
uc_payment/ uc_payment.tokens.inc - Implements hook_tokens().
File
- payment/
uc_payment/ uc_payment.module, line 285 - Defines the payment API that lets payment modules interact with Ubercart.
Code
function uc_payment_balance(OrderInterface $order) {
$total = $order
->getTotal();
$payments = uc_payment_load_payments($order
->id());
if ($payments === FALSE) {
return $total;
}
foreach ($payments as $payment) {
$total -= $payment
->getAmount();
}
return $total;
}