You are here

function payment_rules_action_info in Payment 7

Implements hook_rules_action_info().

File

./payment.rules.inc, line 77
Rules integration.

Code

function payment_rules_action_info() {
  $actions['payment_rules_action_payment_set_status'] = array(
    'label' => t('Set payment status'),
    'access callback' => 'payment_rules_access',
    'parameter' => array(
      'payment' => array(
        'type' => 'payment',
        'label' => t('Label'),
      ),
      'status' => array(
        'type' => 'text',
        'label' => t('Status'),
        'options list' => 'payment_status_options',
      ),
    ),
    'group' => t('Payment'),
  );
  $actions['payment_rules_action_payment_line_item_delete'] = array(
    'label' => t('Delete a payment line item'),
    'access callback' => 'payment_rules_access',
    'group' => t('Payment'),
    'parameter' => array(
      'payment' => array(
        'type' => 'payment',
        'label' => t('Payment'),
      ),
      'name' => array(
        'type' => 'text',
        'label' => t('Machine name'),
      ),
    ),
  );
  $description = array(
    t('If the evaluated amount does not return a whole or fractional number, this action will do nothing.'),
  );
  $description[] = module_exists('ctools') ? t('You can use mathematical expressions.') : t('Enable <a href="http://drupal.org/project/ctools">Chaos tool suite</a> in order to use mathematical expressions.');
  $description = implode(' ', $description);
  $actions['payment_rules_action_payment_line_item_add'] = array(
    'label' => t('Add a line item'),
    'access callback' => 'payment_rules_access',
    'group' => t('Payment'),
    'parameter' => array(
      'payment' => array(
        'type' => 'payment',
        'label' => t('Payment'),
      ),
      'name' => array(
        'type' => 'text',
        'label' => t('Machine name'),
      ),
      'description' => array(
        'type' => 'text',
        'label' => t('Description'),
        'translatable' => TRUE,
      ),
      'tax_rate' => array(
        'type' => 'decimal',
        'label' => t('Tax rate'),
        'description' => t('Enter a (fractional) number between 0 and 1.'),
        'default value' => 0,
      ),
      'quantity' => array(
        'type' => 'integer',
        'label' => t('Quantity'),
        'default value' => 1,
      ),
      'amount' => array(
        'type' => 'text',
        'label' => t('Amount'),
        'description' => $description,
      ),
    ),
  );
  $actions['payment_rules_action_payment_invalidate'] = array(
    'label' => t('Invalidate the combination of payment and payment method'),
    'access callback' => 'payment_rules_access',
    'group' => t('Payment'),
    'parameter' => array(
      'message' => array(
        'type' => 'text',
        'label' => t('Message'),
      ),
    ),
  );
  return $actions;
}