java.lang.Object | +--CacheableCommandImpl | +--com.ibm.commerce.command.AbstractECTargetableCommand | +--com.ibm.commerce.command.ControllerCommandImpl | +--com.ibm.commerce.couponredemption.commands.RedeemCouponCmdImpl
This command is invoked when the user asks to redeem her eCoupons before preparing order and it displays a 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
CouponWalletAccessBean
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.
Field Summary | |
---|---|
protected
java.lang.Integer |
calculationUsage The calculation usage code. |
protected
java.lang.String |
curCurrency Currency to be used in calculations. |
protected
java.lang.Long |
orderId The order for which the coupons are to be found out |
protected
CommandContext |
processingContext The command context holder |
protected
java.lang.Long |
shopperId ID of the shopper invoking the command. |
protected
java.lang.Integer |
storeId The store ID. |
Fields inherited from class com.ibm.commerce.command. ControllerCommandImpl |
requestProperties,
responseProperties,
retriable,
viewReqProperties |
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand |
commandContext |
Fields inherited from interface com.ibm.commerce.couponredemption.commands. RedeemCouponCmd |
COPYRIGHT,
defaultCommandClassName |
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand |
COPYRIGHT |
Constructor Summary | |
---|---|
RedeemCouponCmdImpl() Constructor for RedeemCouponCmdImpl, calls super. |
Method Summary | |
---|---|
java.lang.Long |
getOrderId() Gets the order ID. |
CommandContext |
getProcessingContext() Gets the processing context. |
java.lang.Long |
getShopperId() Gets the shopper ID. |
void |
insertIntoDB(java.lang.Long orderId,
java.util.Hashtable couponHashtable) Inserts the coupon related information in the database. |
boolean |
isReadyToCallExecute() It always returns true. |
void |
performExecute() First the temporary and permanent table are cleaned up, which stores the eCoupon discount. |
void |
removeExistingAdjustments(java.lang.Long anOrderId) Removes the existing adjustments for the orderitems. |
void |
removeOldEntries() Removes the existing entries from TempOrderCouponMapAccessBean and
TempCouponItemMapAccessBean . |
void |
setOrderId(java.lang.Long newOrderId) Sets the order ID. |
void |
setProcessingContext(
CommandContext newProcessingContext) Sets the processingContext. |
void |
setShopperId(java.lang.Long newShopperId) Sets the shopper ID. |
void |
validateParameters() This method extracts and validates the parameters. |
Methods inherited from class com.ibm.commerce.command. ControllerCommandImpl |
checkPermission,
fulfills,
getForUserId,
getGeneric,
getOwner,
getRequestProperties,
getResolvedRequestProperties,
getResourceOwners,
getResponseProperties,
getRetriable,
getViewInputProperties,
isGeneric,
isRetriable,
mergeProperties,
setForUserId,
setGeneric,
setOwner,
setRequestProperties,
setResponseProperties,
setRetriable,
setViewInputProperties |
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,
reset,
setAccCheck,
setCommandContext,
setCommandIfName,
setCommandStoreId,
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. ControllerCommand |
checkPermission,
execute,
getGeneric,
getRequestProperties,
getResolvedRequestProperties,
getResponseProperties,
getRetriable,
getViewInputProperties,
isGeneric,
isRetriable,
mergeProperties,
setGeneric,
setRequestProperties,
setRetriable,
setViewInputProperties |
Methods inherited from interface com.ibm.commerce.command. AccCommand |
accessControlCheck,
getAccCheck,
getForUserId,
getResourceOwners,
setAccCheck,
setForUserId,
setOwner |
Methods inherited from interface com.ibm.commerce.command. ECCommand |
checkIsAllowed,
checkResourcePermission,
createCommandExecutionEvent,
getCommandContext,
getCommandIfName,
getCommandName,
getCommandStoreId,
getDefaultProperties,
getResources,
getStoreId,
getUser,
getUserId,
setCommandContext,
setCommandIfName,
setCommandStoreId,
setDefaultProperties |
Field Detail |
---|
protected java.lang.Long orderId
protected java.lang.Long shopperId
protected CommandContext processingContext
protected java.lang.Integer calculationUsage
protected java.lang.String curCurrency
protected java.lang.Integer storeId
Constructor Detail |
---|
public RedeemCouponCmdImpl()
Method Detail |
---|
public java.lang.Long getOrderId()
public CommandContext getProcessingContext()
public java.lang.Long getShopperId()
public void insertIntoDB(java.lang.Long orderId, java.util.Hashtable couponHashtable) throws ECSystemException
OrderCouponMapAccessBean
for each coupon used for this order.
Then, create the CouponItemMapAccessBean
for each item for coupon,
with the discount amount information.
orderId
- The order for which the coupons are being
applied.com.ibm.commerce.exception.ECException.
ECSystemException
public boolean isReadyToCallExecute()
isReadyToCallExecute
in class
AbstractECTargetableCommand
public void performExecute() throws ECException
First the temporary and permanent table are cleaned up, which stores the
eCoupon discount. Then the eCoupons for this shopper are found out from
CouponWalletAccessBean
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.
performExecute
in interface
ECCommand
performExecute
in class
AbstractECTargetableCommand
com.ibm.commerce.exception.ECException.
ECException
public void removeExistingAdjustments(java.lang.Long anOrderId) throws ECSystemException
anOrderId
- The order for which the adjustments are to be
removed.com.ibm.commerce.exception.ECException.
ECSystemException
public void removeOldEntries() throws ECSystemException
TempOrderCouponMapAccessBean
and TempCouponItemMapAccessBean
.
com.ibm.commerce.exception.ECException.
ECSystemException
public void setOrderId(java.lang.Long newOrderId)
newOrderId
- the order ID.public void setProcessingContext(CommandContext newProcessingContext)
newProcessingContext
- the command
context.public void setShopperId(java.lang.Long newShopperId)
newShopperId
- the shopper ID.public void validateParameters() throws ECException
validateParameters
in interface
ECCommand
validateParameters
in class
AbstractECTargetableCommand
com.ibm.commerce.exception.ECException.
ECException