Introduction
The IBM® WebSphere® Commerce Calculation Framework uses a shopper's address to provide order calculations for tax and shipping costs. In cases where shoppers do not provide their correct city or state or country as input text, we can work with the out-of-the-box implementation in order to catch any address differences.
With the out-of-the-box implementation of WebSphere Commerce, the checkout billing and shipping pages prompt the shopper for input, through means such as text entry fields. The instances where the state/province, city, or country is not input as expected result in spurious order calculations for tax and shipping costs. To compensate for faulty shopper input, we can preload the jurisdiction mapping to allow for those alternative address inputs.
There can be multiple mapped jurisdiction representations to the same calculation rule. Therefore, the calculation rules can be independently defined apart from the multiple jurisdiction references. The alternative address inputs can then be defined for a single rule by mapping to several juridiction references.
The following section explains how to set up a Canadian tax implementation. It also includes excerpts that you can use to provide alternative jurisdiction mapping to prepare for calculating based on shopping input:
You will need to:
- Open the tax.xml file and add extra alternative jurisdiction mappings
- Run ID Resolver on the tax.xml file
- Run Massload on the resolved tax.xml file
- Test some data using the above tax matrix
Steps
- Extract the CanadianTaxJursMapping.zip file into a temporary directory.
- Change directory to the extracted zip directory and locate the env.bat file
- Update the env.bat file to match your WebSphere Commerce Server environment
- Set DBNAME to represent the database user of the WebSphere Commerce Server
- Set DBUSER to represent the database user of the WebSphere Commerce Server
- Set DBPWD to represent the database password of the WebSphere Commerce Server
- Set RESGENFILE to represent the output resolved file
- Set INPUTFILE to represent the input file tax.xml
- Set processType to represent the target type. For Commerce v5.6 Toolkit, set processType=toolkit. For all others, set processType=server.
- Set TOOLKITDIR to represent the target toolkit installation directory for WebSphere Commerce v5.6 Toolkit
- Set WCSHOME to represent the path of the Commerce Server
- Set PATH use to update the PATH to add the WCSHOME parameter
- Open the tax.xml file and replace all references to @storeent_id_1 with the STOREENT_ID value from the database you want to update.
- From the opened tax.xml file, replace all references to @ffmcenter_id_1 with the FFMCENTER_ID value from the database you want to update.
- From the opened tax.xml file, replace the wcs.dtd path with the path of your Commerce Server wcs.dtd file:
<!DOCTYPE import SYSTEM "E:\WebSphere\CommerceStudio55\Commerce\schema\xml\wcs.dtd"> - From the opened tax.xml file, update the XML for Ontario Canada.
We will plan to make alternative address entries that the Calculation Framework can include in order processing:
These entries already exist:
<jurst jurst_id="@jurst_id_20004" country="Canada" storeent_id="@storeent_id_1" code="20004" subclass="2" state="Ontario" stateabbr="ON" countryabbr="CA" markfordelete="0"/>
<jurstgroup jurstgroup_id="@jurstgroup_id_20001" description="PST jurisdiction group ON" subclass="2" storeent_id="@storeent_id_1" code="PST Group ON" markfordelete="0"/>
<jurstgprel jurst_id="@jurst_id_20004" jurstgroup_id="@jurstgroup_id_20001" subclass="2"/>
<jurstgprel jurst_id="@jurst_id_20004" jurstgroup_id="@jurstgroup_id_50000" subclass="2"/>
Now, for us to catch other alternatives, we can just add in new entries and load them. To do this, open the JursMapping.txt file and append to the top of the tax.xml file after the few lines listed above.
NOTE: the JursMapping.txt file provides examples to catch customer data alternative entries for the following variations (see Resources for more information):- Canada
- CANADA
- CA
- Can
- Ontario
- ONTARIO
- ontario
- ON
- ONT
- Ont
- Run the batch file "Step1-idresgen.bat" (in a Windows environment).
- Run the batch file "Step2-massload.bat" (in a Windows environment).
- Once the data is loaded, test a shopping flow against the following
Canadian tax matrix:
Province
Name of Relevant Statute
General Rate of Tax
Display
Base for PST Incl. GST
Newfoundland
HST
15% (GST incl.)
HST only
Nova Scotia
HST
15% (GST incl.)
HST only
New Brunswick
HST
15% (GST incl.)
HST only
Prince Edward Island
Revenue Tax Act
10%
GST and PST
Yes (PST charged on GST)
Ontario
Retail Sales Tax Act
8%
GST and PST
No
ONTARIO
Retail Sales Tax Act
8%
GST and PST
No
ON
Retail Sales Tax Act
8%
GST and PST
No
ontario
Retail Sales Tax Act
8%
GST and PST
No
ONT
Retail Sales Tax Act
8%
GST and PST
No
Ont
Retail Sales Tax Act
8%
GST and PST
No
Manitoba
Retail Sales Tax Act
7%
GST and PST
No
Saskatchewan
Education and Health Tax Act
6%
GST and PST
No
British Columbia
Social Service Tax Act
7%
GST and PST
No
Quebec
QST - see QST Manual
7.5% (tax on GST as well, so therefore closer to 8.03%)
GST and VAT
Yes (VAT on GST)
Alberta
No PST
GST only
Yukon
No PST
GST only
N.W.T.
No PST
GST only
Resources
- Download the Jurs Mapping Text example which contains the alternative address entries for the jurisdiction mapping.
- Download the zip file containing all the code related to this article.