You are here

function commerce_cardonfile_rules_action_info in Commerce Card on File 7.2

Implements hook_rules_action_info().

File

./commerce_cardonfile.rules.inc, line 84
Provides Rules integration

Code

function commerce_cardonfile_rules_action_info() {
  $actions = array();
  $actions['commerce_cardonfile_order_select_card'] = array(
    'label' => t('Select card on file to charge'),
    'group' => t('Commerce Card on File'),
    'parameter' => array(
      'order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'forced_instance_id' => array(
        'type' => 'text',
        'label' => t('Payment method instance ID'),
        'description' => t('If provided, then the instance ID must match that of the card data.'),
        'options list' => 'commerce_cardonfile_rules_payment_instance_charge_options_list',
        'optional' => TRUE,
      ),
    ),
    'provides' => array(
      'select_card_response' => array(
        'type' => 'commerce_cardonfile_charge_card_response',
        'label' => t('Select card response'),
        'save' => FALSE,
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_cardonfile_rules_action_order_select_card',
    ),
  );
  $actions['commerce_cardonfile_order_charge_card'] = array(
    'label' => t('charge an order with a card on file'),
    'group' => t('Commerce Card on File'),
    'parameter' => array(
      'order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'charge' => array(
        'type' => 'commerce_price',
        'label' => t('Charge'),
        'description' => t('The charge amount and currency. If not provided, then the order balance will be used.'),
        'optional' => TRUE,
      ),
      'select_card_response' => array(
        'type' => 'commerce_cardonfile_charge_card_response',
        'label' => t('Select Card Response'),
        'description' => t('If provided, Card Data parameter can be omitted.'),
        'optional' => TRUE,
      ),
      'card_data' => array(
        'type' => 'commerce_cardonfile',
        'label' => t('Card'),
        'description' => t('If provided, Select Card Response will be ignored.'),
        'optional' => TRUE,
      ),
      'forced_instance_id' => array(
        'type' => 'text',
        'label' => t('Payment method instance id'),
        'description' => t('If provided and Card Data is provided, then the instance id must match that of the card data.'),
        'options list' => 'commerce_cardonfile_rules_payment_instance_charge_options_list',
        'optional' => TRUE,
      ),
    ),
    'provides' => array(
      'charge_card_response' => array(
        'type' => 'commerce_cardonfile_charge_card_response',
        'label' => t('charge Card Response'),
        'save' => FALSE,
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_cardonfile_rules_action_order_charge_card',
    ),
  );
  $actions['commerce_cardonfile_update_anonymous'] = array(
    'label' => t('Update anonymous card data'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Newly created order'),
      ),
    ),
    'group' => t('Commerce Card On File'),
    'callbacks' => array(
      'execute' => 'commerce_cardonfile_update_anonymous',
    ),
  );
  return $actions;
}