You are here

commerce_avatax.rules.inc in Drupal Commerce Connector for AvaTax 7.5

Same filename and directory in other branches
  1. 7.4 commerce_avatax.rules.inc

Rules supporting AvaTax Order Processing.

File

commerce_avatax.rules.inc
View source
<?php

/**
 * @file
 * Rules supporting AvaTax Order Processing.
 */

/**
 * Implements hook_rules_action_info().
 */
function commerce_avatax_rules_action_info() {
  return array(
    'commerce_avatax_calculate_tax' => array(
      'label' => t('Calculate sales tax for an order'),
      'group' => t('Commerce Avatax'),
      'parameter' => _commerce_avatax_rules_order_parameter_info(TRUE),
    ),
    'commerce_avatax_delete_tax_line_items' => array(
      'label' => t('Delete Avatax line items'),
      'group' => t('Commerce Avatax'),
      'parameter' => _commerce_avatax_rules_order_parameter_info(TRUE),
    ),
    'commerce_avatax_commit_transaction' => array(
      'label' => t('Commit a SalesOrder transaction'),
      'group' => t('Commerce AvaTax'),
      'parameter' => _commerce_avatax_rules_order_parameter_info(),
    ),
    'commerce_avatax_void_transaction' => array(
      'label' => t('Void a transaction in Avatax'),
      'group' => t('Commerce AvaTax'),
      'parameter' => _commerce_avatax_rules_order_parameter_info() + array(
        'code' => array(
          'type' => 'token',
          'label' => t('Void code'),
          'description' => t('The reason for voiding or cancelling this transaction'),
          'options list' => 'commerce_avatax_void_codes_list',
          'optional' => TRUE,
          'default value' => 'DocDeleted',
        ),
      ),
    ),
  );
}

/**
 * Helper function that returns the order parameter.
 */
function _commerce_avatax_rules_order_parameter_info($wrapped = FALSE) {
  $parameter = array(
    'commerce_order' => array(
      'type' => 'commerce_order',
      'label' => t('Commerce Order'),
    ),
  );
  if ($wrapped) {
    $parameter['commerce_order']['wrapped'] = TRUE;
  }
  return $parameter;
}

Functions

Namesort descending Description
commerce_avatax_rules_action_info Implements hook_rules_action_info().
_commerce_avatax_rules_order_parameter_info Helper function that returns the order parameter.