Tax Calculation in ATG
ATG provides a bunch of components / methods for Tax Calculations and other functionalities like Shipping Charges, Payment Methods etc. Let’s take a quick look at how a Tax Processor or Calculator can be used to show up on an ATG Site.
In this example, for ease of implementation let’s calculate Tax at a fixed rate of 8.25%. Create a new Tax class, eg. com.ibiz.commerce.payment.FixedRateTaxProcessor that implements the ATG TaxProcessor, of which the methods take the configured tax percentage, and calculates the tax based on the given TaxRequestInfo, and returns a TaxStatus instance.
Create a properties file, in the config folder, that has the component configuration information, eg. /com/ibiz/commerce/payment/FixedRateTaxProcessor.properties. This creates an ATG nucleus component out of the above class. As discussed above tax rate is configured at 8.25%.
Component configuration, in the config folder, is as follows /atg/commerce/pricing/calculators/TaxProcessorTaxCalculator. In this nucleus component configuration file, we are actually overriding the out-of-the-box /atg/commerce/pricing/calculators/TaxProcessorTaxCalculator configuration.
We are telling out-of-the-box TaxProcessorTaxCalculator to use our com/ibiz/commerce/payment/FixedRateTaxProcessor as the taxProcesor instead of the out-of-the-box dummy class.
Moreover, in this configuration, we are also telling the TaxProcessorTaxCalculator that it does not need to calculate different taxes for different shipping-groups, and also there’s no need to do any address verification as part of tax calculation.
Once all the above are setup or created, include the code snippet in any JSP where the Tax information need to show up. For eg. in the ShoppingCart.jsp you would include the following lines of code
<tr>
<td height=”20″ align=”right”><span>Tax
:</span></td>
<td height=”20″ align=”left”><dsp:valueof
bean=”ShoppingCartModifier.shoppingCart.current.priceInfo.tax”
converter=”currency” /></td>
</tr>
There are no comments yet.