You are here

function commerce_purchase_order_rules_action_info in Commerce Purchase Order 7

Implements hook_rules_action_info().

File

./commerce_purchase_order.rules.inc, line 6

Code

function commerce_purchase_order_rules_action_info() {
  $actions = array();
  $actions['commerce_purchase_order_issue_po'] = array(
    'label' => t('charge an order with a purchase order'),
    'group' => t('Commerce Purchase Order'),
    '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,
      ),
      'po_number' => array(
        'type' => 'text',
        'label' => t('Purchase Order number'),
        'description' => t('If not provided, current timestamp and order ID will be used'),
        'optional' => TRUE,
      ),
      'forced_instance_id' => array(
        'type' => 'text',
        'label' => t('Payment method instance id'),
        'options list' => 'commerce_purchase_order_rules_payment_instance_charge_options_list',
        'optional' => TRUE,
      ),
    ),
    'provides' => array(
      'issue_po_response' => array(
        'type' => 'commerce_purchase_order_issue_po_response',
        'label' => t('issue PO Response'),
        'save' => FALSE,
      ),
    ),
    'callbacks' => array(
      'execute' => 'commerce_purchase_order_rules_issue_po_action',
    ),
  );
  return $actions;
}