Canadian tax configuration

This tutorial demonstrates how to load Canadian taxes into a WebSphere Commerce database and test the taxes in the store using a modified JSP page. This is a sample scenario you can follow the instructions and modify the rates to match the current tax rates and settings. For more information about changing the tax rates, see Updating the WebSphere Commerce tax configuration to match the current tax rate.

Before you begin

Before beginning this tutorial ensure you have completed the following tasks:
  • Publish the consumer direct sample store.
  • Download the zip file containing all the code related to this article and extract it to a temporary directory.

About this task

In this tutorial you will learn how to perform the following steps:
  • Add a JSP file to the consumer direct sample store
  • Run the idresgen utility on the tax.xml file
  • Run the massload utility on the resolved tax.xml file
  • Complete a shopping flow for various jurisdictions following a tax matrix

Calculation Rule Assignments

The calculation codes (in the CALCODE table) have been broken up to represent the different Canadian tax categories: GST, PST, HST, and QST. The significance of breaking up tax categories into isolated calculation codes resolves complications resulting from having to deal with multiple tax categories (GST, PST, HST and QST). This breakup can be applied to any jurisdiction tax system such as the American tax system where levels are distinguished by COUNTRY, TERRITORY, STATE, CITY, LOCAL, SECONDARY STATE, SECONDARY LOCAL, and so on. Each jurisdiction level may have their own isolated tax rate or exemption. The ship-to address that qualifies for a particular order item resolves to a distinct set of jurisdiction levels. For the example illustrated in this paper, all Canadian tax rules have been defined by distinguished jurisdiction level values. Four calculation codes created, each having a CALCODE.GROUPBY value of 8 to allow for OrderItems with different shipping addresses to be grouped separately. Each calculation code is then associated with four tax categories. At a more fine-grained level, several calculation rules are assigned for PST. The split for PST is as follows:
  • Calculation rule for PST rate for Prince Edward Island jurisdiction
  • Calculation rule for PST rate for Ontario jurisdiction
  • Calculation rule for PST rate for Manitoba jurisdiction
  • Calculation rule for PST rate for Saskatchewan jurisdiction
  • Calculation rule for PST rate for British Columbia jurisdiction

The PST split allows for the calculation framework to represent the same Tax Category with different tax rates. See the testing matrix later in this document for a detailed breakdown.


  1. Copy the JSP file from the zip file to the Deprecated featureMadisons sample store directory.
    • WCDE_installdir\workspace\Stores\WebContent\Madisons\ShoppingArea\CheckoutSection\SingleShipment
  2. Update the SingleShipmentOrderTotalsSummary.jsp file to show Canadian taxes by copying the following code into the end of the file, before the final closing element:
            orderTax = orderBean.getTaxes();
            Hashtable orderTaxExample =
            String nameTx, valueTx;
            if (orderTaxExample!=null) {
                    for (Enumeration eTx=orderTaxExample.keys();
    eTx.hasMoreElements();) {
                            nameTx = (String)eTx.nextElement();
                            MonetaryAmount amtTx =
                            if (amtTx!=null) {
                                    if (amtTx.getValue().compareTo(new
    BigDecimal("0.0"))!=0) {
    FormattedMonetaryAmountDataBean amtDBTx =
             &lttd align="right" colspan="5">
              &ltfont class="price">&ltb>&lt%=nameTx%>
             <td align="right" valign="top">
              <font class="price"><%=amtDBTx.toString()%>
  3. Save and close the file.
  4. Open the tax.xml file and complete the following:
    1. Replace all references to @storeent_id_1 to the STOREENT_ID value from the store database you want to update. For example:
    2. Replace all references to @ffmcenter_id_1 to the FFMCENTER_ID value from the database you want to update. For example:
    3. Replace the wcs.dtd path with the path of your Commerce Server wcs.dtd file. For example:
      <!DOCTYPE import SYSTEM "WCDE_installdir\workspace\WC\xml\schema\dtd\wcs.dtd">
  5. Save and close the file.
  6. Open the env.bat file for editing and update it to match your environment by filling in the following:
    Name of the database.
    Database user name for the database.
    Password associated with the user name for the database.
    The target type:
    • WebSphere Commerce DeveloperApache Derbytoolkit
    • SolarisLinuxWindowsAIXserver
    The target WebSphere Commerce Developer installation directory. For example:
    set TOOLKITDIR=WC_installdir
    The path to the WebSphereCommerce Server. For example:
    set WCSHOME=WC_installdir
    The path to add the WCSHOME parameter. For example:
    set PATH=.;%WCSHOME%\bin;%PATH%
  7. Run the appropriate command:
    • Apache DerbyRun the batch file Step1-idresgen.bat.
    • DB2idresgen -dbname name -dbuser user -dbpwd password-infile %INFILE% -outfile %OUTFILE% -method mixed -schemaname user
    • Oracleidresgen -dbname name -dbuser user -dbpwd password -infile %INFILE% -outfile %OUTFILE% -method mixed -schemaname user -customizer %CUSTOMIZEFILE%
  8. Run the appropriate command:
    • Apache DerbyRun the batch file Step2-massload.bat.
    • DB2massload -dbname name -dbuser user -dbpwd password -infile %INFILE% -method sqlimport -commitcount 20 -schemaname user
    • Oracle
      • In the env.bat file, set CUSTOMIZEFILE=WC_installdir\properties\
      • massload -dbname name -dbuser user -dbpwd password -infile %INFILE% -method sqlimport -commitcount 20 -schemaname user
  9. Place an order in your storefront to test the Canadian tax rates. Ensure the tax rates match 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
    Manitoba Retail Sales Tax Act 7% GST and PST No
    Saskatchewan Education and Health Tax Act 7% GST and PST No
    British Columbia Social Service Tax Act 7% GST and PST No
    Quebec QST - please 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