You are here

function commerce_gc_giftcard_minimum_balance in Commerce GC 7

1 string reference to 'commerce_gc_giftcard_minimum_balance'
commerce_gc_commerce_coupon_condition_component_alter in ./commerce_gc.module

File

./commerce_gc.rules.inc, line 73

Code

function commerce_gc_giftcard_minimum_balance(EntityDrupalWrapper $coupon_wrapper, $minimum = 0) {
  $amount = commerce_gc_giftcard_balance($coupon_wrapper->coupon_id
    ->value());
  if ($amount > (int) $minimum) {
    return TRUE;
  }
  else {
    $code = $coupon_wrapper->code
      ->value();
    $error =& drupal_static('commerce_coupon_error_' . strtolower($code));
    $name = $coupon_wrapper->commerce_gc_name
      ->value() ? $coupon_wrapper->commerce_gc_name
      ->value() : $code;
    $error = t('The giftcard %name does not have sufficient balance.', array(
      '%name' => $name,
    ));
  }
}