You are here

function payment_rules_condition_payment_amount_comparison in Payment 7

Implements Rules condition callback: compare the payment amount.

Parameters

Payment $payment: The payment of which to compare the amount.

string $comparison_operator:

string $comparison_amount:

Return value

boolean

File

./payment.rules.inc, line 583
Rules integration.

Code

function payment_rules_condition_payment_amount_comparison(Payment $payment, $operator, $comparison_amount) {
  $payment_amount = $payment
    ->totalAmount(TRUE);
  switch ($operator) {
    case '<':
      return $payment_amount < $comparison_amount;
    case '<=':
      return $payment_amount <= $comparison_amount;
    case '=':
      return $payment_amount == $comparison_amount;
    case '>=':
      return $payment_amount >= $comparison_amount;
    case '>':
      return $payment_amount > $comparison_amount;
  }
  return FALSE;
}