You are here

function commerce_coupon_rules_action_info in Commerce Coupon 7

Same name and namespace in other branches
  1. 7.2 commerce_coupon.rules.inc \commerce_coupon_rules_action_info()

Implements hook_rules_action_info().

File

./commerce_coupon.rules.inc, line 52
Coupon rules integration file.

Code

function commerce_coupon_rules_action_info() {
  $actions = array();
  $actions['commerce_coupon_action_is_valid_coupon'] = array(
    'label' => t('Set coupon as valid'),
    'parameter' => array(
      'override' => array(
        'type' => 'boolean',
        'label' => t('Override'),
        'description' => t('Normaly the validation result is concatenated by an AND operator. Here you can bypass this and set the value to true.'),
      ),
    ),
    'group' => t('Commerce Coupon'),
    'base' => 'commerce_coupon_action_is_valid_coupon',
    'callbacks' => array(
      'execute' => 'commerce_coupon_action_is_valid_coupon',
    ),
  );
  $actions['commerce_coupon_action_is_invalid_coupon'] = array(
    'label' => t('Set coupon as invalid'),
    'group' => t('Commerce Coupon'),
    'base' => 'commerce_coupon_action_is_invalid_coupon',
    'callbacks' => array(
      'execute' => 'commerce_coupon_action_is_invalid_coupon',
    ),
  );
  $actions['commerce_coupon_action_create_coupon_line_item'] = array(
    'label' => t('Create coupon line item'),
    'parameter' => array(
      'commerce_coupon' => array(
        'type' => 'commerce_coupon',
        'label' => t('Commerce Coupon'),
      ),
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('commerce order'),
      ),
      'amount' => array(
        'type' => 'decimal',
        'label' => t('coupon amount'),
      ),
      'component_name' => array(
        'type' => 'text',
        'label' => t('Price component type'),
        'description' => t('Price components track changes to prices made during the price calculation process, and they are carried over from the unit price to the total price of a line item. When an order total is calculated, it combines all the components of every line item on the order. When the unit price is altered by this action, the selected type of price component will be added to its data array and reflected in the order total display when it is formatted with components showing. Defaults to base price, which displays as the order Subtotal.'),
        'options list' => 'commerce_price_component_titles',
        'default value' => 'base_price',
      ),
      'currency_code' => array(
        'type' => 'text',
        'label' => t('coupon amount currency code'),
      ),
    ),
    'provides' => array(
      'commerce_coupon_line_item' => array(
        'type' => 'commerce_line_item',
        'label' => t('commerce coupon line item'),
      ),
    ),
    'group' => t('Commerce Coupon'),
    'base' => 'commerce_coupon_action_create_coupon_line_item',
    'callbacks' => array(
      'execute' => 'commerce_coupon_action_create_coupon_line_item',
    ),
  );
  $actions['commerce_coupon_action_get_coupons_for_order'] = array(
    'label' => t('Get coupons for order'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Commerce order'),
      ),
    ),
    'provides' => array(
      'order_coupons' => array(
        'type' => 'list<commerce_coupon>',
        'label' => t('Coupons attached to this order'),
      ),
    ),
    'group' => t('Commerce Coupon'),
    'base' => 'commerce_coupon_action_get_coupons_for_order',
  );
  $actions['commerce_coupon_action_get_coupon_uses'] = array(
    'label' => t('Get the redemption number of a coupon'),
    'parameter' => array(
      'commerce_coupon' => array(
        'type' => 'commerce_coupon',
        'label' => t('Commerce Coupon'),
      ),
    ),
    'group' => t('Commerce Coupon'),
    'provides' => array(
      'number_of_uses' => array(
        'type' => 'integer',
        'label' => t('number of uses'),
      ),
    ),
  );
  $actions['commerce_coupon_action_remove_coupon_from_order'] = array(
    'label' => t('Remove a coupon from an order'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Commerce Order'),
      ),
      'commerce_coupon' => array(
        'type' => 'commerce_coupon',
        'label' => t('Commerce Coupon'),
      ),
    ),
    'group' => t('Commerce Coupon'),
  );
  $actions['commerce_coupon_action_remove_all_coupons_from_order'] = array(
    'label' => t('Remove all coupons from an order'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Commerce Order'),
      ),
    ),
    'group' => t('Commerce Coupon'),
  );
  return $actions;
}