You are here

function commerce_payment_rules_action_info in Commerce Core 7

Implements hook_rules_action_info().

File

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

Code

function commerce_payment_rules_action_info() {
  $actions = array();

  // Add an action for each available payment method.
  foreach (commerce_payment_methods() as $payment_method) {
    $actions['commerce_payment_enable_' . $payment_method['method_id']] = array(
      'label' => t('Enable payment method: @method', array(
        '@method' => $payment_method['title'],
      )),
      'parameter' => array(
        'commerce_order' => array(
          'type' => 'commerce_order',
          'label' => t('Order', array(), array(
            'context' => 'a drupal commerce order',
          )),
          'skip save' => TRUE,
        ),
        'payment_method' => array(
          'type' => 'commerce_payment_settings',
          'restriction' => 'input',
          'label' => t('Payment settings'),
          'payment_method' => $payment_method['method_id'],
        ),
      ),
      'group' => t('Commerce Payment'),
      'callbacks' => array(
        'execute' => 'commerce_payment_enable_method',
      ),
    );
  }
  $actions['commerce_payment_redirect_pane_previous_page'] = array(
    'label' => t('Redirect the checkout to the previous pane'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order', array(), array(
          'context' => 'a drupal commerce order',
        )),
        'skip save' => TRUE,
      ),
    ),
    'group' => t('Commerce Payment'),
    'callbacks' => array(
      'execute' => 'commerce_payment_rules_redirect_pane_previous_page',
    ),
  );
  $actions['commerce_payment_redirect_pane_next_page'] = array(
    'label' => t('Redirect the checkout to the next pane'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order', array(), array(
          'context' => 'a drupal commerce order',
        )),
        'skip save' => TRUE,
      ),
    ),
    'group' => t('Commerce Payment'),
    'callbacks' => array(
      'execute' => 'commerce_payment_rules_redirect_pane_next_page',
    ),
  );
  return $actions;
}