You are here

function commerce_payment_rules_event_info in Commerce Core 7

Implements hook_rules_event_info().

File

modules/payment/commerce_payment.rules.inc, line 14
Rules integration for payments.

Code

function commerce_payment_rules_event_info() {

  // So that we can use the entity_rules_events_variables() helper function.
  module_load_include('inc', 'entity', 'entity.rules');
  $events = array();
  $events['commerce_payment_methods'] = array(
    'label' => t('Select available payment methods for an order'),
    'group' => t('Commerce Payment'),
    'variables' => entity_rules_events_variables('commerce_order', t('Order', array(), array(
      'context' => 'a drupal commerce order',
    ))),
    'access callback' => 'commerce_order_rules_access',
  );
  $variables = array_merge(entity_rules_events_variables('commerce_order', t('Order', array(), array(
    'context' => 'a drupal commerce order',
  )), TRUE, TRUE), entity_rules_events_variables('commerce_payment_transaction', t('Last completed transaction'), TRUE));
  $events['commerce_payment_order_paid_in_full'] = array(
    'label' => t('When an order is first paid in full'),
    'group' => t('Commerce Payment'),
    'variables' => $variables,
    'access callback' => 'commerce_order_rules_access',
  );
  return $events;
}