com.ibm.commerce.order.commands

Class PreProcessOrderCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, PreProcessOrderCmd, ProcessOrderCmd, 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 PreProcessOrderCmdImpl
    extends TaskCommandImpl
    implements PreProcessOrderCmd
    Default implementation for PreProcessOrderCmd.

    Behavior

    • An ECApplicationException exception is thrown in the following conditions: The order is not locked (indicating that the order has not changed since it was prepared by the OrderPrepare command). The order status is not P, I, E, W, N, or B.

      The command checks the last update timestamp of the order if:

      • The value of the QUOTEGOODFOR column in the table STORE table is not NULL.
      • The parameters quoteExpiryPolicy and quoteExpiredURL are specified.
      • And the order has a status of P, I, W, or N.
      If the current time is greater than or equal to the last update timestamp plus the number of seconds specified in the QUOTEGOODFOR column. PrepareOrderCmd is called to refresh the order amounts and then does one of the following, based on the value of the quoteExpiryPolicy:

      1. If the re-calculated order total is unchanged, and the quoteExpiryPolicy parameter allows it, proceed as normal.
      2. If the re-calculated order total is less, and the quoteExpiryPolicy parameter allows it, proceed as normal.
      3. If the re-calculated order total is more, and the quoteExpiryPolicy parameter allows it, proceed as normal.
      4. Otherwise, do not process the order, but instead re-direct to the URL specified by the quoteExpiredURL parameter.
    • If ATP inventory allocation is enabled for orders, then:
      • Any order items that are not yet allocated or backordered (or that have changed since they were last allocated or backordered) are allocated by calling DoInventoryActionCmd.
      • If any order items cannot be allocated or backordered:
        • If the noInventoryURL parameter is specified, the command returns a redirection to that URL.
        • Otherwise, the order status is changed to L and the command returns.
      • The command returns a redirection to that URL if: The availabilityChangeURL parameter is specified. The estimated availability times for any of the order items has moved further into the future than specified by the maxAvailabilityChange parameter,
      • If the AllocateInventory task command unlocked the Order, indicating that the fulfillment center for an order item changed, then:
        • Shipping charges and tax amounts are re-calculated, and the order is locked, by calling the ReprepareOrderCmd task command. If this changes the total amount for the order, and the quoteExpiryPolicy and quoteExpiredUrl parameters are specified, then:
          1. If the re-calculated order total is unchanged, and the quoteExpiryPolicy parameter allows it, proceed as normal.
          2. If the re-calculated order total is less, and the quoteExpiryPolicy parameter allows it, proceed as normal.
          3. If the re-calculated order total is more, and the quoteExpiryPolicy parameter allows it, proceed as normal.
          4. Otherwise, do not process the order, but instead re-direct to the URL specified by the quoteExpiredURL parameter.
      • The order item promised availability times are set to their current estimated availability times.
    • If the order status is I, the CheckOrder task command is called to verify that this order has not already been submitted for processing.
    Please reference OrderProcess
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PreProcessOrderCmdImpl

        public PreProcessOrderCmdImpl()
        Default constructor
    • Method Detail

      • getAvailabilityChangeURL

        public java.lang.String getAvailabilityChangeURL()
        This method gets the URL to redirect to. The estimated availability time plus the shipping offset for any order item moves into the future (as a result of allocating or backordering inventory). If the result is more than the time interval specified by the setMaxAvailabilityChange method, this method should be called.
        Returns:
        URL
      • getBillToRn

        public java.lang.Long getBillToRn()
        This method gets the reference number of the address to bill.
        Returns:
        address id
      • getField1

        public java.lang.Integer getField1()
        This method gets merchant-customizable field one.
        Returns:
        field1
      • getField2

        public java.math.BigDecimal getField2()
        This method gets merchant-customizable field two.
        Returns:
        field2
      • getField3

        public java.lang.String getField3()
        This method gets merchant-customizable field three.
        Returns:
        field3
      • getMaxAvailabilityChange

        public java.lang.Long getMaxAvailabilityChange()
        This method gets the time interval, in seconds, used with the url set by the setAvailabilityChangeURL method.
        Returns:
        time interval
      • getNoInventoryURL

        public java.lang.String getNoInventoryURL()
        This method gets the URL to redirect to if any of the order items in the order cannot be allocated or backordered.
        Returns:
        URL
      • getNotifyMerchant

        public java.lang.Short getNotifyMerchant()
        This method determines whether the store should be notified when the order processing is complete.
        Returns:
        notify merchant parameter.
      • getNotifyOrderSubmitted

        public java.lang.Short getNotifyOrderSubmitted()
        This method determines whether the customer should be notified when the order is successfully submitted for processing.
        Returns:
        notify order submitted parameter.
      • getNotifyShopper

        public java.lang.Short getNotifyShopper()
        This method determines whether the customer should be notified when the order processing is complete.
        Returns:
        notify shopper parameter.
      • getQuotationSubmission

        public java.lang.String getQuotationSubmission()
        This method gets the quotationSubmission parameter.
        Returns:
        quote submission parameter.
      • getOrderRn

        public java.lang.Long getOrderRn()
        This method gets the order reference number.
        Returns:
        order id
      • getQuoteExpiredURL

        public java.lang.String getQuoteExpiredURL()
        This method gets the URL to redirect to if the order total expired in agreement with the expiry policy set by the setQuoteExpiryPolicy method.
        Returns:
        URL
      • getQuoteExpiryPolicy

        public java.lang.String getQuoteExpiryPolicy()
        This method gets the quote expiry policy. It determines the command behaviour if the order total expires or an order item's fulfillment center changes during inventory allocation.
        Returns:
        quote expiry policy
      • getReduceParentQuantities

        public java.lang.String getReduceParentQuantities()
        This method gets the reduceParentQuantities parameter.
        Returns:
        reduce parent quantities parameter.
      • getExternalUserId

        public java.lang.String getExternalUserId()
        This method gets the external user id
        Returns:
        Returns a String
      • setExternalUserId

        public void setExternalUserId(java.lang.String astrExternalUserId)
        This method sets the external user id
        Specified by:
        setExternalUserId in interface ProcessOrderCmd
        Parameters:
        astrExternalUserId - The external user id to set
      • getExternalPassword

        public java.lang.String getExternalPassword()
        This method gets the external password
        Returns:
        external password
      • setExternalPassword

        public void setExternalPassword(java.lang.String astrExternalPassword)
        This method sets the external password
        Specified by:
        setExternalPassword in interface ProcessOrderCmd
        Parameters:
        astrExternalPassword - The external password to set
      • getResponseProperties

        public TypedProperty getResponseProperties()
        This method gets the response properties object for the calling controller command to use.
        Specified by:
        getResponseProperties in interface ProcessOrderCmd
        Returns:
        response properties
      • isReadyToCallExecute

        public boolean isReadyToCallExecute()
        This method checks the validity of the parameters
        Specified by:
        isReadyToCallExecute in interface com.ibm.websphere.command.Command
        Overrides:
        isReadyToCallExecute in class AbstractECTargetableCommand
        Returns:
        boolean
      • reset

        public void reset()
        This method should be called after a command has been executed to reset its states variables.
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AbstractECTargetableCommand
      • setAvailabilityChangeURL

        public void setAvailabilityChangeURL(java.lang.String newAvailabilityChangeURL)
        This method sets the URL to redirect to. The estimated availability time plus the shipping offset for any order item moves into the future (as a result of allocating or backordering inventory). If the result is more than the time interval specified by the setMaxAvailabilityChange method, this method should be called. This parameter is ignored if ATP inventory allocation is not enabled.
        Specified by:
        setAvailabilityChangeURL in interface ProcessOrderCmd
        Parameters:
        newAvailabilityChangeURL - URL
      • setBillToRn

        public void setBillToRn(java.lang.Long anBillToRn)
        This method sets the reference number of the address to bill.
        Specified by:
        setBillToRn in interface ProcessOrderCmd
        Parameters:
        anBillToRn - address id
      • setField1

        public void setField1(java.lang.Integer anField1)
        This method sets merchant-customizable field one.
        Specified by:
        setField1 in interface ProcessOrderCmd
        Parameters:
        anField1 - field1
      • setField2

        public void setField2(java.math.BigDecimal adField2)
        This method sets merchant-customizable field two.
        Specified by:
        setField2 in interface ProcessOrderCmd
        Parameters:
        adField2 - field2
      • setField3

        public void setField3(java.lang.String astrField3)
        This method sets merchant-customizable field three.
        Specified by:
        setField3 in interface ProcessOrderCmd
        Parameters:
        astrField3 - field3
      • setMaxAvailabilityChange

        public void setMaxAvailabilityChange(java.lang.Long newMaxAvailabilityChange)
        This method sets the time interval, in seconds, used with the url set by the setAvailabilityChangeURL method. The default value is 3600 (one hour). This parameter is ignored if the availabilityChangeURL is not specified, or if ATP inventory allocation is not enabled.
        Specified by:
        setMaxAvailabilityChange in interface ProcessOrderCmd
        Parameters:
        newMaxAvailabilityChange -
      • setNoInventoryURL

        public void setNoInventoryURL(java.lang.String newNoInventoryURL)
        This method sets the URL to redirect to if any of the order items in the order cannot be allocated or backordered. This parameter is ignored if ATP inventory allocation is not enabled.
        Specified by:
        setNoInventoryURL in interface ProcessOrderCmd
        Parameters:
        newNoInventoryURL - URL
      • setNotifyMerchant

        public void setNotifyMerchant(java.lang.Short newNotifyMerchant)
        This method specifies whether to notify the merchant when the order has been processed. If the value set to 1, the merchant will be notified. If the value is set to 0, the merchant will not be notified.
        Specified by:
        setNotifyMerchant in interface ProcessOrderCmd
        Parameters:
        newNotifyMerchant -
      • setNotifyOrderSubmitted

        public void setNotifyOrderSubmitted(java.lang.Short newNotifyOrderSubmitted)
        This method specifies whether the customer should be notified when the order is successfully submitted for processing. Valid values include :

        1=Yes

        0=No (default)

        Specified by:
        setNotifyOrderSubmitted in interface ProcessOrderCmd
        Parameters:
        newNotifyOrderSubmitted -
      • setNotifyShopper

        public void setNotifyShopper(java.lang.Short newNotifyShopper)
        This method specifies whether to notify the shopper when the order has been processed. If the value set to 1, the shopper will be notified. If the value is set to 0, the shopper will not be notified.
        Specified by:
        setNotifyShopper in interface ProcessOrderCmd
        Parameters:
        newNotifyShopper -
      • setQuotationSubmission

        public void setQuotationSubmission(java.lang.String astrQuotationSubmission)
        This method sets the quotationSubmission parameter.
        Specified by:
        setQuotationSubmission in interface ProcessOrderCmd
        Parameters:
        astrQuotationSubmission -
      • setOrderRn

        public void setOrderRn(java.lang.Long anOrderRn)
        This method sets the order reference number.
        Specified by:
        setOrderRn in interface ProcessOrderCmd
        Parameters:
        anOrderRn - order id
      • setQuoteExpiredURL

        public void setQuoteExpiredURL(java.lang.String newQuoteExpiredURL)
        This method sets the URL to redirect to if the order total expired in agreement with the expiry policy set by the setQuoteExpiryPolicy method.
        Specified by:
        setQuoteExpiredURL in interface ProcessOrderCmd
        Parameters:
        newQuoteExpiredURL - URL
      • setQuoteExpiryPolicy

        public void setQuoteExpiryPolicy(java.lang.String newQuoteExpiryPolicy)
        This method sets the behavior of the command if the order total expires or an order item's fulfillment center changes during inventory allocation. Order total expires if the current time is greater than or equal to result: the order last update timestamp plus the number of seconds specified in the QUOTEGOODFOR column of the STORE table. This parameter may have three values:

        1. alwaysProceed - always proceed with processing the order after recalculating order total.
        2. stopOnBiggerTotal - proceed with processing the order if the recalculated order total is unchanged or less than the previous order total. Otherwise, redirect to a URL set by the setQuoteExpiredUrl method.
        3. neverProceed - always redirect to the URL specified by the set by the setQuoteExpiredUrl method.
        Specified by:
        setQuoteExpiryPolicy in interface ProcessOrderCmd
        Parameters:
        newQuoteExpiryPolicy - quote expiry policy
      • setReduceParentQuantities

        public void setReduceParentQuantities(java.lang.String astrReduceParentQuantities)
        This method sets the reduceParentQuantities parameter.
        Specified by:
        setReduceParentQuantities in interface ProcessOrderCmd
        Parameters:
        astrReduceParentQuantities -
      • setTransferMode

        public void setTransferMode(java.lang.String transferMode)
        This method sets the transferMode property of the command.
        Specified by:
        setTransferMode in interface ProcessOrderCmd
        Parameters:
        transferMode - - 0 - order has been transferred without the payment information (shopping cart transfer). 1 - order has been transferred with the payment information (purchase order transfer).
      • setNotificationAttributes

        public void setNotificationAttributes(java.util.Hashtable aNotificationAttributes)
        This method sets the notification attributes
        Specified by:
        setNotificationAttributes in interface ProcessOrderCmd
        Parameters:
        aNotificationAttributes -
      • setRetainQuoteFlag

        public void setRetainQuoteFlag(java.lang.String retainQuoteFlag)
        This method sets the flag indicating whether to retain the source Quote after successful submission of Order ("Y"/"N")
        Parameters:
        retainQuoteFlag -
      • getPoNumber

        public java.lang.String getPoNumber()
        This method gets the parameter PO number
        Specified by:
        getPoNumber in interface ProcessOrderCmd
        Returns:
        The poNumber.
      • setPoNumber

        public void setPoNumber(java.lang.String argPoNumber)
        This method sets the parameter PO number
        Specified by:
        setPoNumber in interface ProcessOrderCmd
        Parameters:
        argPoNumber - The poNumber to set.