function uc_payment_condition_order_balance in Ubercart 6.2
Same name and namespace in other branches
- 7.3 payment/uc_payment/uc_payment.rules.inc \uc_payment_condition_order_balance()
Check the current order balance.
3 string references to 'uc_payment_condition_order_balance'
- uc_payment_ca_condition in payment/
uc_payment/ uc_payment.ca.inc - Implements hook_ca_condition().
- uc_payment_ca_predicate in payment/
uc_payment/ uc_payment.ca.inc - Implements hook_ca_predicate().
- _ca_convert_conditions in ca/
ca.admin.inc - Helper function for converting Ubercart's Workflow-ng conditions.
File
- payment/
uc_payment/ uc_payment.ca.inc, line 183 - This file contains the Conditional Actions hooks and functions necessary to make the order related entity, conditions, events, and actions work.
Code
function uc_payment_condition_order_balance($order, $settings) {
$balance = uc_payment_balance($order);
if (!empty($settings['include_authorizations'])) {
foreach ((array) $order->data['cc_txns']['authorizations'] as $auth_id => $data) {
$balance -= $data['amount'];
}
}
switch ($settings['balance_comparison']) {
case 'less':
return $balance < 0;
case 'less_equal':
return $balance <= 0.01;
case 'equal':
return $balance < 0.01 && $balance > -0.01;
case 'greater':
return $balance >= 0.01;
}
}