com.ibm.commerce.taxation.commands
Class TaxCalculationRuleCalculateCmdImpl
com.ibm.commerce.taxation.commands.TaxCalculationRuleCalculateCmdImpl
- All Implemented Interfaces:
- TaxCalculationRuleCalculateCmd
- public class TaxCalculationRuleCalculateCmdImpl
- implements TaxCalculationRuleCalculateCmd
The default implementation adds the results from each applicable CalculationScale.
A CalculationScale is applicable if it can calculate a MonetaryAmount
in the Order currency, except a CalculationScale whose currStr indicates
a currency other than the Order currency is not applicable if either:
- another applicable CalculationScale has a currStr that does indicate the
Order currency, or
- a set of applicable CalculationScales with a common yet different different
currStr attribute exists and can produce a lower total result.
Effectively, if any scales have a currency, only one such currency will
be used, and it will be the Order currency if such a scale exists.
Otherwise it will be the currency of the set of scales that gives the lowest
result.
The default implementation's algorithm is:
- If a CalculationScale throws a conversion exception, continue processing
as if we did not call that CalculationScale.
- Start with a zero total result for each OrderItem.
- For each CalculationScale associated with this CalculationRule whose currStr
attribute is empty:
- Obtain a MonetaryAmount result for each OrderItem in the Order currency
from the CalculationScale. Add this result to the total result for
each OrderItem.
- Determine the set of currencies indicated by the currStr attributes of
the CalculationScales whose currStr attributes indicate currencies that
can be converted to the Order currency.
- If the set of currencies includes the Order currency:
- Start with a zero candidate result for each OrderItem.
- For each CalculationScale associated with this CalculationRule whose currStr
attribute indicates the CalculationScale is in that currency:
- Obtain a MonetaryAmount result for each OrderItem in that currency from
the CalculationScale. Add these results to the candidate results.
- However, If the set of currencies does not include the Order currency:
- For each currency in the set, calculate a candidate result for each OrderItem
using steps 5a, 5b, and 5b1.
- Choose the set of candidate results (i.e. One per OrderItem) whose sum
is the lowest, and add those results to the total result for each OrderItem.
- Return the total results, one for each OrderItem.
Field Summary |
static java.lang.String |
COPYRIGHT
|
COPYRIGHT
public static final java.lang.String COPYRIGHT
TaxCalculationRuleCalculateCmdImpl
public TaxCalculationRuleCalculateCmdImpl()
performExecute
public void performExecute()
throws ECException
- Executes main business logic of the command.
setCalculationRuleAB
public void setCalculationRuleAB(CalculationRuleAccessBean calculationRuleAB)
- Sets the CalculationRuleAccessBean.
- Parameters:
calculationRuleAB
- The CalculationRuleAccessBean.
setOrderItemABHash
public void setOrderItemABHash(java.util.Hashtable orderItemABHash)
- Sets the list of OrderItemAccessBean.
- Parameters:
orderItemABHash
- The list of OrderItemAccessBean.