com.ibm.commerce.couponredemption.commands
Class RedeemCouponCmdImpl
com.ibm.commerce.command.AbstractECTargetableCommand
|
+--com.ibm.commerce.command.ControllerCommandImpl
|
+--com.ibm.commerce.couponredemption.commands.RedeemCouponCmdImpl
- All Implemented Interfaces:
- AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, RedeemCouponCmd
- public class RedeemCouponCmdImpl
- extends ControllerCommandImpl
- implements RedeemCouponCmd
This command is invoked when the user asks to redeem her eCoupons before preparing
order and it display a set of eCoupons that can be applied to this order.
The input to this command is :
The orderID of the order for which applicable eCoupon are to be found.
First the temporary and permanent table are cleaned up, which stores the eCoupon discount. Then
the eCoupons for this shopper are found out from CPWALLET with state as USABLE. The CheckValidityCmd
command is called to find the coupons that are not expired and for not expired coupons
CheckApplicabilityCmd command is called to find out which eCoupons are applicable for this order. For
applicable eCoupons, CalculateDiscountAmtCmd command is called to calculate the discount amount
and the view command is redirected to show the applicable coupons and corresponding discounts.
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl |
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setRequestProperties, setResponseProperties, setRetriable, setViewInputProperties |
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand |
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties |
Methods inherited from interface com.ibm.commerce.command.ControllerCommand |
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties |
Methods inherited from interface com.ibm.commerce.command.ECCommand |
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties |
calculationUsage
protected java.lang.Integer calculationUsage
curCurrency
protected java.lang.String curCurrency
orderId
protected java.lang.Long orderId
processingContext
protected CommandContext processingContext
shopperId
protected java.lang.Long shopperId
storeId
protected java.lang.Integer storeId
RedeemCouponCmdImpl
public RedeemCouponCmdImpl()
- Constructor for RedeemCouponCmdImpl, call super.
getOrderId
public java.lang.Long getOrderId()
- Get the order Id.
- Returns:
- long
getProcessingContext
public CommandContext getProcessingContext()
- Get the processing context.
- Returns:
- com.ibm.commerce.command.CommandContext
getShopperId
public java.lang.Long getShopperId()
- Get the shopper ids.
- Returns:
- long
insertIntoDB
public void insertIntoDB(java.lang.Long orderId,
java.util.Hashtable couponHashtable)
throws ECSystemException
- Insert data into database.
- Parameters:
couponHashTable
- java.util.Hashtable
isReadyToCallExecute
public boolean isReadyToCallExecute()
- It always return true.
- Overrides:
isReadyToCallExecute
in class AbstractECTargetableCommand
- Following copied from class:
com.ibm.commerce.command.AbstractECTargetableCommand
- Returns:
- boolean - true if we can execute the command
false if we canot execute the command
performExecute
public void performExecute()
throws ECException
The business logic for this controller command. This command is invoked when the user asks to redeem
her eCoupons before preparing order and it display set of eCoupons that can be applied to this order.
First the temporary and permanent table are cleaned up, which stores the eCoupon discount. Then
the eCoupons for this shopper are found out from CPWALLET with state as USABLE. The CheckValidityCmd
command is called to find the coupons that are not expired and for not expired coupons
CheckApplicabilityCmd command is called to find out which eCoupons are applicable for this order. For
applicable eCoupons, CalculateDiscountAmtCmd command is called to calculate the discount amount
and the view command is redirected to show the applicable coupons and corresponding discounts.
- Specified by:
performExecute
in interface ECCommand
- Overrides:
performExecute
in class AbstractECTargetableCommand
- Throws:
com.ibm.commerce.exception.ECException.
-
removeExistingAdjustments
public void removeExistingAdjustments(java.lang.Long anOrderId)
throws ECSystemException
- Remove the existing adjustments from the orderitems.
- Parameters:
anOrderId
- java.lang.Long
removeOldEntries
public void removeOldEntries()
throws ECSystemException
- It remove the old entries.
- Throws:
:
- com.ibm.commerce.exception.ECException.
setOrderId
public void setOrderId(java.lang.Long newOrderId)
- Set order id.
- Parameters:
newOrderId
- long
setProcessingContext
public void setProcessingContext(CommandContext newProcessingContext)
- set the processingContext.
- Parameters:
newProcessingContext
- com.ibm.commerce.command.CommandContext
setShopperId
public void setShopperId(java.lang.Long newShopperId)
- Set the shopper id.
- Parameters:
newShopperId
- long
validateParameters
public void validateParameters()
throws ECException
- ControllerCommandImpl calls checkParameter in performExecute.
It is the responsibility of the command writers to implements
this method if they want to perform server side parameter checking.
They should either calls checkParameters inside their performExecute
or calls super.performExecute() as the first statement in the
performExecute method.
- Specified by:
validateParameters
in interface ECCommand
- Overrides:
validateParameters
in class AbstractECTargetableCommand
- Throws:
CommandException.
-