Enabling Value Added Tax (VAT) at store level

How to register the VAT set of commands to enable VAT at store level.

About this task

You need to register the new set of tax commands in order to enable VAT. VAT can be enabled at both store level and site level, although usually it is enabled at store level.

Procedure

  1. Add the new calculation method for VAT calculation by running SQL statements similar to:
    insert into calmethod(CALMETHOD_ID,STOREENT_ID,CALUSAGE_ID,TASKNAME,DESCRIPTION,SUBCLASS,NAME) 
    values(@any unique id 1, @customer's store ID,-3,'com.ibm.commerce.order.calculation.VATCalculationRuleCombineCmd',
    'default method to identify sales tax rules (referenced by STENCALUSG.ACTRC_CALMETHOD_ID) when Value-Added-Tax is
    enabled',5,'VATCalculationRuleCombine (sales tax)')
    insert into calmethod(CALMETHOD_ID,STOREENT_ID,CALUSAGE_ID,TASKNAME,DESCRIPTION,SUBCLASS,NAME) 
    values(@any unique id 2, @customer's store ID,-4,'com.ibm.commerce.order.calculation.VATCalculationRuleCombineCmd',
    'default method to identify shipping tax rules (referenced by STENCALUSG.ACTRC_CALMETHOD_ID) when Value-Added-Tax is
    enabled',5,'VATCalculationRuleCombine (shipping tax)')
  2. Register the new calculation methods for sales tax and shipping tax's calculation.
    Note: If you have a promotion applied for the product and specify the sequence as 0, the tax is calculated based on the gross amount. That is, the price before the promotion. However, if you specify the sequence, for example, as 3 and 4 for the two records, the tax is calculated based on the discounted price. That is, the price after the promotion.
    • If defaults are defined at the site level, run SQL statements similar to:
      insert into stencalusg (storeent_id, calusage_id, actcc_calmethod_id, actrc_calmethod_id,calmethod_id_app,calmethod_id_sum,usageflags,calmethod_id_ini,sequence) values(store_id,-3,-41,@any unique id 1,-222,-223,1,-221,sequence); 
      insert into stencalusg (storeent_id, calusage_id, actcc_calmethod_id, actrc_calmethod_id,calmethod_id_app,calmethod_id_sum,usageflags,calmethod_id_ini,sequence) values(store_id,-4,-61,@any unique id 2,-232,-233,1,-231,sequence); 
    • If defaults are defined at the store level, run SQL statements similar to:
      update stencalusg set ACTRC_CALMETHOD_ID=
      @any unique id 1 where storeent_id=@customer's store ID and calusage_id=-3
      update stencalusg set ACTRC_CALMETHOD_ID=
      @any unique id 2 where storeent_id=@customer's store ID and calusage_id=-4
  3. Register the command to calculate tax for a single catalog entry before adding it to an order by running SQL statements similar to:
    insert into cmdreg(STOREENT_ID,INTERFACENAME,CLASSNAME,TARGET)
    values(@customer's store ID, 'com.ibm.commerce.taxation.commands.GetDisplayTaxesCmd',
    'com.ibm.commerce.taxation.commands.GetDisplayVATTaxesCmdImpl','Local')
  4. Register the proper implementation for OrderCalculateCmd.
    • If defaults are defined at the site level:

      If you are using com.ibm.commerce.order.commands.PromotionEngineOrderCalculateCmdImpl as the implementation of OrderCalculateCmd, then you will need to use:

      insert into cmdreg(STOREENT_ID,INTERFACENAME,CLASSNAME,TARGET) values(store_id, 'com.ibm.commerce.order.commands.OrderCalculateCmd','com.ibm.commerce.order.commands.VATPromotionEngineOrderCalculateCmdImpl', 'Local');

      If you are using com.ibm.commerce.order.commands.OrderCalculateCmdImpl as the implementation of OrderCalculateCmd, then you will need to use:

      insert into cmdreg(STOREENT_ID,INTERFACENAME,CLASSNAME,TARGET) values(store_id, 'com.ibm.commerce.order.commands.OrderCalculateCmd','com.ibm.commerce.order.commands.VATOrderCalculateCmdImpl', 'Local');
    • If defaults are defined at the store level:

      If you are using com.ibm.commerce.order.commands.PromotionEngineOrderCalculateCmdImpl as the implementation of OrderCalculateCmd, then you will need to use:

      update cmdreg set CLASSNAME='com.ibm.commerce.order.commands.VATPromotionEngineOrderCalculateCmdImpl'
      where interfacename = 'com.ibm.commerce.order.commands.OrderCalculateCmd' and storeent_id=@customer's store id

      If you are using com.ibm.commerce.order.commands.OrderCalculateCmdImpl as the implementation of OrderCalculateCmd, then you will need to use:

      update cmdreg set CLASSNAME='com.ibm.commerce.order.commands.VATOrderCalculateCmdImpl'
      where interfacename = 'com.ibm.commerce.order.commands.OrderCalculateCmd' and storeent_id=@customer's store id
  5. Register the command to sum a single order's total amount by running an SQL statement similar to:
    insert into cmdreg(STOREENT_ID,INTERFACENAME,CLASSNAME, TARGET)
    values(@customer's store id,'com.ibm.commerce.order.commands.GetOrderTotalAmountCmd',
    'com.ibm.commerce.order.commands.VATGetOrderTotalAmountCmdImpl','Local')
  6. Register the command to sum a set of order items' total amount by running an SQL statement similar to:
    insert into cmdreg(STOREENT_ID,INTERFACENAME,CLASSNAME,TARGET)
    values(@customer's store id,'com.ibm.commerce.orderitems.commands.GetOrderItemsTotalAmountCmd',
    'com.ibm.commerce.orderitems.commands.VATGetOrderItemsTotalAmountCmdImpl','Local')
  7. Register the command to sum up a history order's total amount by running an SQL statement similar to:
    insert into cmdreg(STOREENT_ID,INTERFACENAME,CLASSNAME,TARGET)
    values(@customer's store id,'com.ibm.commerce.order.commands.GetHistoryOrderTotalAmountCmd',
    'com.ibm.commerce.order.commands.VATGetHistoryOrderTotalAmountCmdImpl','Local')
  8. Register the command to sum up an order release's total amount by running an SQL statement similar to:
    insert into cmdreg(STOREENT_ID,INTERFACENAME,CLASSNAME,TARGET)
    values(@customer's store id,'com.ibm.commerce.order.commands.GetOrderReleaseTotalAmountCmd',
    'com.ibm.commerce.order.commands.VATGetOrderReleaseTotalAmountCmdImpl','Local')
  9. Optional: if you want to use HCL Commerce Accelerator to manage the return, VAT is supported in HCL Commerce return flow:
    1. Register the command to calculate a RMA item's total credit by running a SQL statement similar to:
      insert into cmdreg(STOREENT_ID,INTERFACENAME,CLASSNAME,TARGET) 
      values (@customer's store id,'com.ibm.commerce.returns.commands.CalculateRMAItemTotalCreditCmd', 'com.ibm.commerce.returns.commands.VATCalculateRMAItemTotalCreditCmdImpl','Local') 
    2. To configure the VAT specific return views of HCL Commerce Accelerator, open the following files in a text editor:
      • workspace_dir/CommerceAccelerator/WebContent/WEB-INF/struts-config-ext.xml
      • workspace_dir/CommerceAccelerator/WebContent/WEB-INF/classes/struts-wcs-accelerator-custom.xml
      Find the <global-forwards> element and update it as shown:
         <struts-config>
         <global-forwards>
          <forward className="com.ibm.commerce.struts.ECActionForward"
                  name="ReturnItemsPage" path="/tools/returns/ReturnItemsPageVAT.jsp">
                  <set-property property="resourceClassName" value="com.ibm.commerce.tools.command.ToolsForwardViewCommandImpl"/>
          </forward>
          <forward className="com.ibm.commerce.struts.ECActionForward"
                  name="ReturnConfirmation" path="/tools/returns/ReturnConfirmationVAT.jsp">
                  <set-property property="resourceClassName" value="com.ibm.commerce.tools.command.ToolsForwardViewCommandImpl"/>
          </forward>
      </global-forwards>
      </struts-config>
      Find the <global-results> element and update it as shown:
      <package extends="struts-default" name="wcs-accelerator" namespace="/">
      <global-results>
      <result name="ReturnItemsPage">
      <param name="location">/tools/returns/ReturnItemsPageVAT.jsp</param>
      <param name="resourceClassName">com.ibm.commerce.tools.command.ToolsForwardViewCommandImpl</param>
      </result>
      <result name="ReturnConfirmation">
      <param name="location">/tools/returns/ReturnConfirmationVAT.jsp</param>
      <param name="resourceClassName">com.ibm.commerce.tools.command.ToolsForwardViewCommandImpl</param>
      </result>
      </global-results>
      </package>
  10. After registering the preceding SQL commands, restart the server to make them take effect.