Tutorials > Contracts


Tutorial: Catching shopper address alternatives in the calculation framework

The calculation framework uses a shopper's address to provide order calculations for tax and shipping costs. If a shopper does not provide the correct city or state or country as input text, you can use the default implementation to catch any address differences.


Before you begin

In the default implementation of WebSphere Commerce, the checkout billing and shipping pages prompt the shopper for input, using 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 load 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 jurisdiction 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:

The tax rate described in the tutorial is for sample only . For more information about changing the tax rates, see Update the WebSphere Commerce tax configuration to match the current tax rate.

You will need to:


Procedure

  1. Extract the JursMapping.zip file into a temporary directory.

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

  3. Update the env.bat file to match the WebSphere Commerce Server environment

    DBNAME

    The database user of the WebSphere Commerce Server

    DBUSER

    The database user of the WebSphere Commerce Server

    DBPWD

    The database password of the WebSphere Commerce Server

    RESGENFILE

    The output resolved file

    INPUTFILE

    The input file, tax.xml

    processType

    The target type:

    • toolkit

    • server

    TOOLKITDIR

    The target toolkit installation directory for WebSphere Commerce.

    WCSHOME

    The path to the WebSphere Commerce Server.

    PATH

    Update the PATH to add the WCSHOME parameter

  4. Open the tax.xml file and replace all references to @storeent_id_1 with the STOREENT_ID value from the database to update.

  5. 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 the Commerce Server wcs.dtd file:
    <!DOCTYPE import SYSTEM
    "C:\WebSphere\CommerceServer60\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_ country="Canada"
    storeent_ 
            code="20004" subclass="2" state="Ontario" stateabbr="ON"
    countryabbr="CA" markfordelete="0"/> 
    <jurstgroup jurstgroup_
    description="PST jurisdiction group ON" 
            subclass="2" storeent_ code="PST Group
    ON" markfordelete="0"/> 
    <jurstgprel jurst_
    jurstgroup_ subclass="2"/> 
    <jurstgprel jurst_
    jurstgroup_ 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. The JursMapping.txt file provides examples to catch customer data alternative entries for the following variations.

    • Canada

    • CANADA

    • CA

    • Can

    • Ontario

    • ONTARIO

    • ontario

    • ON

    • ONT

    • Ont

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

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

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


+

Search Tips   |   Advanced Search