com.ibm.commerce.order.commands

Class OrderCancelCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, OrderCancelCmd, Protectable, 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 OrderCancelCmdImpl
    extends OrderBaseCmdImpl
    implements OrderCancelCmd
    This is implementation of the OrderCancelCmd controller command.

    Behaviour:

    • It checks to see if the order exists and that its status attribute specifies A, B, C, I, L, M, N, or W status. If not, it returns an error.
    • It cancels the specified order by changing its order status to X.
    • It de-allocates existing and expected inventory by calling the AllocateInventory task command and specifying all order items for the order in the reverseOrderItems parameter.
    • It cancels the payment.
    • If there is a pending order approve request for a B2B buyer, this command implementation cancels it.

    Input parameters:

    Name Description
    langId Sets or resets the preferred language for the duration of the session; the supported languages for a store are found in the STORELANG table.
    forUser The logon ID of the user on whose behalf the command runs; only a person with the authority to process orders can specify this parameter.
    URL (Required) The URL that is called when the command completes successfully.
    storeId The store that is associated with the order.
    orderId (Required) The reference number of the order to cancel.
    forcedCancel (Optional) This parameter is used by payment rule to perform a refund. If there are some deposit transactions for the order, the order cannot be canceled except when the parameter is made forcedCancel=true. The default value is false.

    Output parameters:

    None.

    Task commands called:

    See Also:
    Serialized Form
    • Constructor Detail

      • OrderCancelCmdImpl

        public OrderCancelCmdImpl()
        This method is the default constructor.
    • Method Detail

      • getOrderId

        public java.lang.Long getOrderId()
        This method returns the identifier of the Order to cancel.
        Returns:
        A Long that specifies the Order identifier.
      • getUrl

        public java.lang.String getUrl()
        This method returns the redirection URL to be called when the command completes successfully.
        Returns:
        A String that specifies the redirection URL.
      • performExecute

        public void performExecute()
                            throws ECException
        This method executes the business logic of this command implementation.

        Cancels the specified order by changing its order status to X state. This command does not remove the order from the database. It will not cancel an Order unless it is for the current user, and has a status attribute value of A, M, P, E, B, C, W, or X.

        Behaviour:
      • The Order is unlocked.
      • Its status attribute value is set to X.
      • The status attribute values of its OrderItems are set to X.
      • If ATP inventory is enabled, any allocations or backorders are reversed.
      • If the Order is awaiting approval, the outstanding approval flow is canceled.
      • The viewTaskName response property is set to the value "RedirectView".

Specified by:
performExecute in interface ECCommand
Specified by:
performExecute in interface com.ibm.websphere.command.TargetableCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException
  • reset

    public void reset()
    Resets instance variables to their initial values.
    Specified by:
    reset in interface com.ibm.websphere.command.Command
    Overrides:
    reset in class AbstractECTargetableCommand
  • setOrderId

    public void setOrderId(java.lang.Long anOrderId)
    This method sets the identifier of the Order to cancel.
    Specified by:
    setOrderId in interface OrderCancelCmd
    Parameters:
    anOrderId - A Long that specifies the Order identifier.
  • setUrl

    public void setUrl(java.lang.String astrUrl)
    This method sets the redirection URL to be called when the command completes successfully.
    Specified by:
    setUrl in interface OrderCancelCmd
    Parameters:
    astrUrl - A String that specifies the redirection URL string.
  • getForcedCancel

    public java.lang.Boolean getForcedCancel()
    This method returns an indicator to force cancellation. This is typically used to forcing payment actions.
    Returns:
    A Boolean whose value is true if cancel is to be forced.
  • setForcedCancel

    public void setForcedCancel(java.lang.Boolean forceCancel)
    This method sets an indicator to force cancellation. This is typically used to forcing payment actions.
    Parameters:
    forceCancel - A Boolean whose value is true if cancel is to be forced.