com.ibm.commerce.edp.commands

Class ReservePaymentCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, AEDPPaymentTaskCmd, AEDPStoreTaskCmd, AEDPTaskCmd, ReservePaymentCmd, 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 ReservePaymentCmdImpl
    extends AEDPStoreTaskCmdImpl
    implements ReservePaymentCmd
    This is the default implementation of the ReservePaymentCmd task command.

    Behaviour:

    • The ReservePayment business event is associated with release to fulfillment. It reserves funds for order releases which about to be shipped (the order has been released to a warehouse or some other entity for fulfillment).

    Input parameters:

    commandContext The command context.
    orderId A Long that indicates the id of the current order.
    reservationAmount A BigDecimal that indicates the total reservation amount.
    releases A HashMap that represents the list of the current releases and release amounts.

    Output parameters:

    None.

    Task commands called:

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

      • ReservePaymentCmdImpl

        public ReservePaymentCmdImpl()
    • Method Detail

      • isReadyToCallExecute

        public boolean isReadyToCallExecute()
        This method is called by the Command Framework to check if all basic mandatory parameters have been set for this command. This is done before the Framework calls the performExecute method of the command.
        Specified by:
        isReadyToCallExecute in interface com.ibm.websphere.command.Command
        Overrides:
        isReadyToCallExecute in class AbstractECTargetableCommand
        Returns:
        true is the command is ready to execute and false otherwise.
      • setReleases

        public void setReleases(java.util.HashMap paramReleases)
        This method sets the releases to be reserved.
        Specified by:
        setReleases in interface ReservePaymentCmd
        Parameters:
        paramReleases - the list of release IDs(Long) and their amounts(BigDecimal) to be reserved
      • getReleases

        public java.util.HashMap getReleases()
        This method gets the list of releases to be processed in this request.
        Returns:
        the list of releases to be processed in this request. The key is release ID with data type Long, the value is the reserved amount with data type BigDecimal.
      • setReservationAmount

        public void setReservationAmount(java.math.BigDecimal paramReservationAmount)
        This method sets the total order amount.
        Specified by:
        setReservationAmount in interface ReservePaymentCmd
        Parameters:
        paramReservationAmount - the total amount to be reserved
      • getReservationAmount

        public java.math.BigDecimal getReservationAmount()
        This method gets the total amount to be reserved.
        Returns:
        the total amount to be reserved
      • performExecute

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

        It firstly checks the backend job status. If the status is working ,sets the priority of event as HIGH then the ECEvent will process the event immediately. After this, if the BG status is still on working ,throw ECApplicationException.

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

        public void reset()

        Resets the command fields.

        After this method is invoked, and proper attributes are set, the command can be executed again.

        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AEDPPaymentTaskCmdImpl
      • getReleaseIds

        public java.util.Collection getReleaseIds()
        Obtains the list of release ids to be reserved.
        Returns:
        the list of release ids to be reserved
      • processFG

        public void processFG()
                       throws EDPException,
                              ECException

        This method executes the foreground tasks.

        1. It checks if any unresolved failures in background.

        2. It updates atomic payments with freshly acquired data from backend.

        3. It calculates the amount to process in current phase, and decides what payment actions should be executed from the payment rule configurations.

        Throws:
        EDPException - in case of an error
        ECException - in case of an error