You are here

function commerce_sagepay_rules_action_info in Drupal Commerce SagePay Integration 7

Implements hook_rules_action_info().

File

./commerce_sagepay.rules.inc, line 37
Implements new rules events actions and conditions.

Code

function commerce_sagepay_rules_action_info() {
  $actions = array();
  $actions['commerce_sagepay_set_transaction_account'] = array(
    'label' => t('Set the account for this transaction.'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'account_type' => array(
        'type' => 'text',
        'label' => t('Account Type'),
        'options list' => 'commerce_sagepay_account_type_list',
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_update_order_account',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_set_transaction_type'] = array(
    'label' => t('Set the transaction type for this transaction.'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'transaction_type' => array(
        'type' => 'text',
        'label' => t('Transaction Type'),
        'options list' => 'commerce_sagepay_transaction_type_list',
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_update_order_transaction_type',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_set_vendor'] = array(
    'label' => t('Set the vendor name for this transaction.'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'vendor_name' => array(
        'type' => 'text',
        'label' => t('Vendor Name'),
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_update_order_vendor_name',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_set_apply_avscv2'] = array(
    'label' => t('Set which AVS / CV2 checks are applied for this transaction.'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'avscv2' => array(
        'type' => 'text',
        'label' => t('AVS CV2 Checks'),
        'options list' => 'commerce_sagepay_avs_flag_list',
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_update_order_avs_flag',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_set_apply_3ds'] = array(
    'label' => t('Set which 3D Secure checks are applied for this transaction.'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'avscv2' => array(
        'type' => 'text',
        'label' => t('3D Secure Checks'),
        'options list' => 'commerce_sagepay_3ds_flag_list',
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_update_order_3ds_flag',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_request_token'] = array(
    'label' => t('Request a token when creating the transaction (if available)
    .'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'token' => array(
        'type' => 'text',
        'label' => t('Request Token'),
        'options list' => 'commerce_sagepay_request_token_list',
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_update_order_token_flag',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_remove_overrides'] = array(
    'label' => t('Removes transaction overrides set by previous rules.'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_remove_overrides',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_repeat_charge_card'] = array(
    'label' => t('Charge an order using a repeat payment'),
    'group' => t('Commerce SagePay'),
    '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,
      ),
    ),
    'provides' => array(
      'charge_card_response' => array(
        'type' => 'commerce_cardonfile_charge_card_response',
        'label' => t('Charge Card Response'),
        'save' => FALSE,
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_rules_action_repeat_charge_card',
    ),
  );
  $actions['commerce_sagepay_cancel_order_transaction'] = array(
    'label' => t('Cancel Order Transactions'),
    'parameter' => array(
      'order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'transaction_type' => array(
        'type' => 'text',
        'label' => t('Transaction Type'),
        'options list' => 'commerce_sagepay_transaction_type_list',
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_cancel_order_transaction',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_abort_order_transaction'] = array(
    'label' => t('Abort Order Transactions'),
    'parameter' => array(
      'order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'transaction_type' => array(
        'type' => 'text',
        'label' => t('Transaction Type'),
        'options list' => 'commerce_sagepay_transaction_type_list',
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_abort_order_transaction',
    ),
    'group' => t('Commerce SagePay'),
  );
  $actions['commerce_sagepay_release_order_transaction'] = array(
    'label' => t('Release Order Transactions'),
    'parameter' => array(
      'order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
      'transaction_type' => array(
        'type' => 'text',
        'label' => t('Transaction Type'),
        'options list' => 'commerce_sagepay_transaction_type_list',
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_sagepay_release_order_transaction',
    ),
    'group' => t('Commerce SagePay'),
  );
  return $actions;
}