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
Procedure
-
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)')
-
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
- If defaults are defined at the site level, run SQL statements similar to:
-
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')
-
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
- If defaults are defined at the site level:
-
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')
-
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')
-
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')
-
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')
- Optional:
if you want to use WebSphere Commerce Accelerator to manage the return, VAT is supported in
WebSphere Commerce return flow:
- After registering the preceding SQL commands, restart the server to make them take effect.