com.ibm.commerce.returns.commands
Class CalculateReturnTaxCmdImpl

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

public class CalculateReturnTaxCmdImpl
extends TaskCommandImpl
implements CalculateReturnTaxCmd

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.


Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.returns.commands.CalculateReturnTaxCmd
COPYRIGHT, defaultCommandClassName, NAME
 
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.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 

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

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

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

performExecute

public void performExecute()
                    throws ECException
Execute the command.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

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:
aRMAItemABs - the orderItem 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

validateParameters

public void validateParameters()
                        throws ECException
Check mandatory parameters.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -