Tutorials > Contracts



Canadian tax configuration

This sample demonstrates how to load the 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 Update the WebSphere Commerce tax configuration to match the current tax rate.

In this tutorial you complete the following steps:


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...

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.


Procedure

  1. Copy the JSP files from the zip file to the consumer direct sample store directory.

  2. Update the MultiAddressCheckout.jsp and SingleAddressCheckout.jsp files to show Canadian taxes:

       &lt%
            orderTax = orderBean.getTaxes();
            Hashtable orderTaxExample =
    orderTax.getCategorizedAmountsAndNames();
            String nameTx, valueTx;
            if (orderTaxExample!=null) {
                    for (Enumeration eTx=orderTaxExample.keys();
    eTx.hasMoreElements();) {
                            nameTx = (String)eTx.nextElement();
                            MonetaryAmount amtTx =
    (MonetaryAmount)orderTaxExample.get(nameTx);
                            if (amtTx!=null) {
                                    if (amtTx.getValue().compareTo(new
    BigDecimal("0.0"))!=0) {
                                           
    FormattedMonetaryAmountDataBean amtDBTx =
                                            new
    FormattedMonetaryAmountDataBean(new
    MonetaryAmount(amtTx.getValue(),                                        
    amtTx.getCurrency()),orderTax.getStoreAccessBean(),orderTax.getLangId());
            %>   
            &lttr>
             &lttd align="right" colspan="5">
              &ltfont class="price">&ltb>&lt%=nameTx%>
    &lt/b&gt;&lt/font&gt;</td>
            
    <td align="right" valign="top">
             
    <font class="price"><%=amtDBTx.toString()%>
              
    </font>
            
    </td>
           
    </tr><%
                    }
                }
              }
            }
            %>
    

  3. Save and close the files.

  4. Open the tax.xml file.

    1. Replace all references to @storeent_id_1 to the STOREENT_ID value from the database to update.

    2. Replace all references to @ffmcenter_id_1 to the FFMCENTER_ID value from the database to update.

    3. Replace the wcs.dtd path with the path of the Commerce Server wcs.dtd file. For example:

      <!DOCTYPE import SYSTEM "E:\WebSphere\Commerce\schema\xml\wcs.dtd">
      

  5. Change directory to the extracted zip directory and locate the env.bat file.

  6. Update the env.bat file to match the environment:

    DBNAME

    Name of the database.

    DBUSER

    Database user name for the database.

    DBPWD

    Password associated with the user name for the database.

    RESGENFILE

    The path of the output resolved file.

    INPUTFILE

    The path of the input file tax.xml.

    processType

    Set to processType=server.

    TOOLKITDIR

    The target WebSphere Commerce toolkit installation directory.

    WCSHOME

    The path to the WebSphereCommerce Server.

    PATH

    The PATH to add the WCSHOME parameter.

  7. Run the appropriate command:

    • Run the batch file Step1-idresgen.bat.

    • idresgen -dbname %DBNAME% -dbuser %DBUSER% -dbpwd %DBPWD% -infile %INFILE% -outfile %OUTFILE% -method mixed -schemaname %DBUSER%

    • idresgen -dbname %DBNAME% -dbuser %DBUSER% -dbpwd %DBPWD% -infile %INFILE% -outfile %OUTFILE% -method mixed -schemaname %DBUSER% -customizer %CUSTOMIZEFILE%

  8. Run the appropriate command:

    • Run the batch file Step2-massload.bat.

    • massload -dbname %DBNAME% -dbuser %DBUSER% -dbpwd %DBPWD% -infile %RESGENFILE% -method sqlimport -commitcount 20 -schemaname %DBUSER%

      • In the env.bat file, set CUSTOMIZEFILE=WC_INSTALL\properties\OracleConnectionCustomizer.properties

      • massload -dbname %DBNAME% -dbuser %DBUSER% -dbpwd %DBPWD% -infile %RESGENFILE% -method sqlimport -commitcount 20 -schemaname %DBUSER%

  9. After 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
    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


Related concepts

Calculation framework

Overview of the mass load utilities


+

Search Tips   |   Advanced Search