com.ibm.commerce.returns.commands
Class CalculateReturnTaxCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.returns.commands.CalculateReturnTaxCmdImpl
All Implemented Interfaces:
CalculateReturnTaxCmd, ECCommand, ECTargetableCommand, TaskCommand

public class CalculateReturnTaxCmdImpl
extends TaskCommandImpl
implements CalculateReturnTaxCmd

Default implementation of the CalculateReturnTaxCmd interface. Calculate the tax for a return mechandise authorization (RMA) item. Calls GetReturnTaxesCmd for RMA items associated with an order item. Tax credit for RMA items not associated with an order item defaults to zero.

Utilizes these access beans

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.returns.commands. CalculateReturnTaxCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand
COPYRIGHT
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
CalculateReturnTaxCmdImpl()
          ReturnItemCreditCalculateCmdImpl constructor.
 
Method Summary
protected  void applyRMATaxes(java.lang.Long aRMAId, java.lang.Long aOrderId, java.util.Hashtable aOrderRMATaxes)
          Set taxes in RMA specific tax database tables, but not in the RMA items.
protected  MonetaryAmount calculateRMAItemsTaxCredit( RMAItemAccessBean aRMAItemAB, OrderItemAccessBean aItemAB)
          Calculate tax credit for a RMA item
 java.util.Vector getTaxCredits()
          Get the calculated tax credits for the returned/refunded item.
 void initRMATaxes(java.lang.Long aRMAId)
          Clean out RMA item tax credit that may already be in database
 void performExecute()
          Execute the command.
 void setRMAItemABs(java.util.Vector aRMAItemABVec)
          Set the vector of RMAItems for which the tax credits are to be calculated.
 void setTaxCredits(java.lang.Long RMAItemId, MonetaryAmount aItemTaxCredit)
          Insert tax credits in vector in the same order as command was called
 void validateParameters()
          Check mandatory parameters.
 
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, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalculateReturnTaxCmdImpl

public CalculateReturnTaxCmdImpl()
ReturnItemCreditCalculateCmdImpl constructor.
Method Detail

applyRMATaxes

protected void applyRMATaxes(java.lang.Long aRMAId,
                             java.lang.Long aOrderId,
                             java.util.Hashtable aOrderRMATaxes)
                      throws ECException
Set taxes in RMA specific tax database tables, but not in the RMA items. The tax amount is set in the RMA items by ReturnPrepare.
Parameters:
aRMAId - RMA id
aOrderId - Order Id
aOrderRMATaxes - RMA tax credits based on amount on order
ECException

calculateRMAItemsTaxCredit

protected MonetaryAmount calculateRMAItemsTaxCredit(RMAItemAccessBean aRMAItemAB,
OrderItemAccessBean aItemAB)
                                             throws ECException
Calculate tax credit for a RMA item
Parameters:
aRMAItemAB - RMA item access bean
aItemAB - order item access bean
Returns:
tax credit for RMA item
ECException

getTaxCredits

public java.util.Vector getTaxCredits()
Get the calculated tax credits for the returned/refunded item. The result of this is used by ReturnPrepare to set the tax amount in each RMA item.
Specified by:
getTaxCredits in interface CalculateReturnTaxCmd
Returns:
the amount of the tax credits (in the same currency of the orderItem).

initRMATaxes

public void initRMATaxes(java.lang.Long aRMAId)
                  throws ECException
Clean out RMA item tax credit that may already be in database
Parameters:
aRMAId - RMA id
ECException

performExecute

public void performExecute()
                    throws ECException
Execute the command.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
ECException

setRMAItemABs

public void setRMAItemABs(java.util.Vector aRMAItemABVec)
Set the vector of RMAItems for which the tax credits are to be calculated.
Specified by:
setRMAItemABs in interface CalculateReturnTaxCmd
Parameters:
aRMAItemABVec - the RMAItem acccess bean vector.

setTaxCredits

public void setTaxCredits(java.lang.Long RMAItemId,
                          MonetaryAmount aItemTaxCredit)
                   throws ECException
Insert tax credits in vector in the same order as command was called
Parameters:
RMAItemId - RMA item id
aItemTaxCredit - RMA item tax credit
ECException

validateParameters

public void validateParameters()
                        throws ECException
Check mandatory parameters. Checks the following parameters:

Parameters

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECApplicationException - If there is no StoreAccessBean, throws com.ibm.commerce.exception.ECApplicationException with ECMessage._ERR_BAD_MISSING_CMD_PARAMETER
ECException