com.ibm.commerce.isv.kit.tax
Class ApplyCalculationUsageTIKCmdImpl
java.lang.Object
|
+--CacheableCommandImpl
|
+--com.ibm.commerce.command.AbstractECTargetableCommand
|
+--com.ibm.commerce.command.TaskCommandImpl
|
+--com.ibm.commerce.command.BusinessPolicyCommandImpl
|
+--com.ibm.commerce.order.calculation.CalculationCmdImpl
|
+--com.ibm.commerce.order.calculation.ApplyCalculationUsageCmdImpl
|
+--com.ibm.commerce.isv.kit.tax.ApplyCalculationUsageTIKCmdImpl
- All Implemented Interfaces:
-
ApplyCalculationUsageCmd,
ApplyCalculationUsageTIKCmd,
BusinessPolicyCommand,
CalculationCmd,
ECCommand,
ECTargetableCommand,
TaskCommand
- public class ApplyCalculationUsageTIKCmdImpl
- extends
ApplyCalculationUsageCmdImpl
- implements
ApplyCalculationUsageTIKCmd
The ApplyCalculationUsageTIKCmd
Task Command Implementation is
called by the OrderPrepareCmd
Controller Command to set the
different tax amounts (e.g. GST, PST etc.) for each OrderItem supplied by
OrderPrepare.
Given a set of
OrderItems
in a particular Order this command invokes the CalculationCodeCombineCmd task
command to determine which CalculationCodes should be applied to which
OrderItems. CalculationCodeCombineCmd returns a list of
elements
where each element is a CalculationCode and a list of
OrderItems to which the CalculationCode is applicable.
- See Also:
-
Item
,
With the list of OrderItems and the CalculationCodes,
ApplyCalculationUsageTIKCmd uses the TaxOrderCmd and TaxOrderItemCmd interfaces
provided in the Tax Integration Interface to invoke a tax calculation module to
calculate the tax amounts for each of the OrderItems.
If the command is successful, it will set the tax amounts in ORDERITEMS.,
Serialized
Form
Field Summary |
static java.math.BigDecimal |
BIG_DECIMAL_ZERO
The big decimal zero field |
static java.lang.Double |
DOUBLE_ZERO
The double zero field |
Method Summary |
protected
void |
addTaxTotal(
Item aItem,
TaxOrderItemCmd aTaxOrderItem)
Adds to the tax total of a particular item. |
protected
void |
callCodeApply(
Group aGroup,
TaxOrderCmd aTaxOrder,
java.lang.Integer aStoreId)
This method is given merely as an example to illustrate how to put
together the tax amount for each tax category returned for the specified
items
and to apply the final results to the items by calling
CalculationCodeApply |
protected
void |
callTaxApply(
Item[] aItems,
TaxOrderCmd aTaxOrder)
Loop through the orderitems and update each item with the tax amounts
returned from the tax calculation module. |
protected
void |
callTaxTIFLoop()
Loop through the orderItems and add each item to a TaxOrderItem
object. |
protected
StoreAddressAccessBean |
getFulfillmentCenterAddress(
CommandContext aCommandContext,
java.lang.Integer aFulfillmentCenterId)
Retrieve the fulfillment center address. |
protected
StoreAddressAccessBean |
getStoreAddress(
CommandContext aCommandContext)
Retrieve the store physical location address. |
void |
performExecute()
Executes main business logic of the command. |
protected
java.lang.Integer[] |
resolveTaxCategories(
TaxOrderItemCmd aTaxOrderItem, java.lang.Integer aStoreId)
This method is given merely as an example to illustrate how to
resolve the WCS tax cateories ids based on the jurisdiction codes returned from
the tax calculation module. |
Methods inherited from class
com.ibm.commerce.order.calculation.
ApplyCalculationUsageCmdImpl |
callCodeApply,
callCodeCalculate,
callCodeCombine,
checkAppliedItems,
getAppliedItems,
getItems,
getTaxCategoryIds,
reset,
setItems,
setTaxCategoryIds,
updateAppliedItems |
Methods inherited from class
com.ibm.commerce.order.calculation.
CalculationCmdImpl |
createCommand,
getCurrency,
getCustomProperties,
getCustomProperty,
getTimestamp,
getUsageId,
setCurrency,
setCustomProperties,
setCustomProperty,
setTimestamp,
setUsageId |
Methods inherited from class
com.ibm.commerce.command.
AbstractECTargetableCommand |
accessControlCheck,
checkIsAllowed,
checkParameters,
checkResourcePermission,
createCommandExecutionEvent,
execute,
finalize,
getAccCheck,
getCommandContext,
getCommandIfName,
getCommandName,
getCommandStoreId,
getDefaultProperties,
getResources,
getStoreId,
getUser,
getUserId,
isReadyToCallExecute,
setAccCheck,
setCommandContext,
setCommandIfName,
setCommandStoreId,
setDefaultProperties,
validateParameters |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait,
wait, wait |
BIG_DECIMAL_ZERO
public static final java.math.BigDecimal BIG_DECIMAL_ZERO
- The big decimal zero field
DOUBLE_ZERO
public static final java.lang.Double DOUBLE_ZERO
- The double zero field
ApplyCalculationUsageTIKCmdImpl
public ApplyCalculationUsageTIKCmdImpl()
- Constructor for ApplyCalculationUsageTIKCmdImpl
addTaxTotal
protected void addTaxTotal(Item aItem,
TaxOrderItemCmd aTaxOrderItem)
throws ECException
- Adds to the tax total of a particular item.
-
- Parameters:
aItem
- the item for which the taxes are to be added.
aTaxOrderItem
- the orderitem provides the tax amount.
- Throws:
-
ECException
callCodeApply
protected void callCodeApply(Group aGroup,
TaxOrderCmd aTaxOrder,
java.lang.Integer aStoreId)
throws ECException
- This method is given merely as an example to illustrate how to put together
the tax amount for each tax category returned for the specified
items
and to apply the final results to the items by calling
CalculationCodeApply
-
- Parameters:
aGroup
-
aTaxOrder
-
aStoreId
-
- Throws:
-
ECException
- See Also:
CalculationCodeApplyCmd
,
Item
callTaxApply
protected void callTaxApply(Item[] aItems,
TaxOrderCmd aTaxOrder)
throws ECException
- Loop through the orderitems and update each item with the tax amounts
returned from the tax calculation module. This method is not handling the tax
categories.
-
- Parameters:
aItems
- the items for which the taxes are to be applied.
aTaxOrder
- the order provides the item information and tax
amount.
- Throws:
-
ECException
callTaxTIFLoop
protected void callTaxTIFLoop()
throws ECException
- Loop through the orderItems and add each item to a TaxOrderItem object.
Call the applicable tax calculation module to calculate the taxes - and post
the results back.
-
- Throws:
-
ECException
- Raised with message _ERR_ADM_REMOTEEXCEPTION whenever a communication related
problems occured Raised with message _ERR_ADM_FINDEREXCEPTION whenever a
request object is not found Raised with message _ERR_ADM_NAMINGEXCEPTION
whenever a failure to look up the JNDI name occured Raised with message
_ERR_ADM_CREATEEXCEPTION whenever a failure to create the EJB
occured
getFulfillmentCenterAddress
protected StoreAddressAccessBean getFulfillmentCenterAddress(CommandContext aCommandContext,
java.lang.Integer aFulfillmentCenterId)
throws ECException
- Retrieve the fulfillment center address.
-
- Parameters:
aFulfillmentCenterId
- the id of the fulfillment center.
aCommandContext
- The command context
- Returns:
- The access bean of the fulfillment center.
- Throws:
-
ECException
- Raised with message _ERR_ADM_REMOTEEXCEPTION whenever a communication related
problems occured Raised with message _ERR_ADM_FINDEREXCEPTION whenever a
request object is not found Raised with message _ERR_ADM_NAMINGEXCEPTION
whenever a failure to look up the JNDI name occured Raised with message
_ERR_ADM_CREATEEXCEPTION whenever a failure to create the EJB
occured
getStoreAddress
protected StoreAddressAccessBean getStoreAddress(CommandContext aCommandContext)
throws ECException
- Retrieve the store physical location address.
-
- Parameters:
aCommandContext
- the command context to provide the store
info.
- Returns:
- The access bean of the store physical location.
- Throws:
-
ECException
- Raised with message _ERR_ADM_REMOTEEXCEPTION whenever a communication related
problems occured Raised with message _ERR_ADM_FINDEREXCEPTION whenever a
request object is not found Raised with message _ERR_ADM_NAMINGEXCEPTION
whenever a failure to look up the JNDI name occured Raised with message
_ERR_ADM_CREATEEXCEPTION whenever a failure to create the EJB
occured
public void performExecute()
throws ECException
- Executes main business logic of the command.
-
- Specified by:
-
performExecute
in interface
ECCommand
- Overrides:
-
performExecute
in class
ApplyCalculationUsageCmdImpl
-
- Throws:
-
ECException
- See Also:
ECCommand#performExecute()
resolveTaxCategories
protected java.lang.Integer[] resolveTaxCategories(TaxOrderItemCmd aTaxOrderItem,
java.lang.Integer aStoreId)
throws ECException
- This method is given merely as an example to illustrate how to resolve the
WCS tax cateories ids based on the jurisdiction codes returned from the tax
calculation module.
-
- Parameters:
aTaxOrderItem
- The tax order item object
aStoreId
- The store identifier
- Returns:
- taxCategoryIds The array of tax categories
- Throws:
-
ECException