Skip to main content
Decision rules are a dynamic way to change system behavior without making code changes per merchant. Each decision rule utilizes a predefined object or a defined function. Decision rules are a a proprietary tool. Decision rules are not visible or accessible to merchants. Merchants provide their input to related features and Vindicia inputs the values as decision rules. Despite this, decision rules are a powerful tool as they allow dynamic behavior per merchant and new rules can be defined using the tools we have in place already. The rule main syntax is: an IF condition followed by a THEN answer = value FLAG The value entered for the decision rule is received and acted on by the Vindicia codebase. A decision rule can contain several condition statements that are evaluated in descending order, from the highest ordinary to the lowest one. Conditions can use data elements from objects, that are specified by ”@” , or from another object that was passed to the decision rule from the caller side.Those are marked by ”_”. The table below details the entities that are used for each decision rule and the ”_” data that can be used for each rule. The FLAG allows additional flexibility, such as an option to mark a label on the IF condition and to define the behavior in a different rule Example : IF @.country = “US” THEN :=‘Do_US’ IF @.country = ‘CA’ THEN :=‘Do_Canada’ STOP :Do_US IF @.district = ‘AL’ THEN ans=“Alabama” IF @.district = ‘CA’ THEN ans=“California” IF 1 THEN STOP This topic provides explanations of how to define decision rules. In configuration pages appearing later in this book, the required decision rule and functionality is explained not how to write the syntax. These are the decision rules in use and their respective objects:

Additional Decision Rules, Not as widely used

Sales Tax Specific Decision rules

Outside tax vendor types have some common features:
  • Writing tax vendor rules requires deep knowledge of vendor requests and through testing.
  • Their only use is custom modifications of the tax vendor requests fr special cases.
    • DirecTV uses this to convert from our Vertex default version of 7/9 to their version 6.
  • Uses any taxable class:
    • Transaction
    • TransactionBilling
    • Chargeback
    • Refund
    • MerchantCustomer when dealing with exemptions. These are obsolete but the code is still active.
  • Data is tax data:
    • addr is the possibly-mangled sales tax address.
    • caller is a string identifying the calling method:
      • calculate_tax
      • ping
      • post
      • void
      • “_item” will be appended on each line item, as opposed to the entire request. Yes, there can be separate rules for the entire request and for line items.
    • req is the specific line item hashref of the request; not the entire request.
  • Returned tax data
    • This is a very peculiar hashref. See SalesTax::merge_request() et al for details.
For more information on decision rules syntax, see the Writing Decision Rules Vindicia wiki page