- All Implemented Interfaces:
- com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, SubscriptionScheduledActionCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable
public class SubscriptionCreateChildOrderSchedulerCmdImpl
extends AbstractSubscriptionScheduledActionCmdImpl
This class will be called by the scheduler to create the child orders for the
recurring order. This class will create an order,updates the current
subscription and creates one more entry in the subscrschjobs table for the
next scheduled action for creating the child order. The whole process happens
in four steps(state). Initially the state of the action will be updated to
SubscriptionServerConstants.TRANSIENT_STATE_CREATE_CHILD_ORDER
.
As the first step the class will decide whether the current subscription is a
recurring order or a subscription and then call
createChildRecurringOrder
for recurring order or
createChildSubscriptionOrder
for a subscription. When the create
child order action was successful the state will be updated to
SubscriptionServerConstants.TRANSIENT_STATE_UPDATE_SUBSCRIPTION
.
As the second step the current subscription will be updated for new values
for nextffmDate, nextPaymentDate, amountPayed etc in
updateSubscription
method. The method will update the state to
SubscriptionServerConstants.TRANSIENT_STATE_CREATE_SUBSCRIPTION_JOB
on successful updation of the current subscription. As the third step a new
job will be created in the scheduler jobs table with the action
"createChildOrder" to create the next child order with the help of
createSubscriptionJob
method. The method will update the sate to
SubscriptionServerConstants.TRANSIENT_STATE_FINAL_SUBSCRIPTION
denoting the successful execution of all the above three steps. In case of
any known order exception while creating the child order the method
handleCreateChildOrderException
will handle those exception. In
case of any unknown exception we have provided handleException
method for the merchant to override and handle the exception appropriately.
In general all the order exception will notify the merchant by sending a mail
with the reason for the exception and cancels the current subscription by
updating the status reason code for the same. The scheduler frame work will
take care of any exception which can be retried. If we fail to create a child
order then we will not take any action because the sate is not modified. If
we are successful in creating the child order but fail in updating the
current subscription then we will move the status of the created child order
to cancel state. If we are successful in create child order and updating the
current subscription but we fail in creating the new schedule job then we
will re try creating the next scheduled job.
- See Also:
- Serialized Form