Class ReservePaymentCmdImpl

  • All Implemented Interfaces:, ECCommand, ECTargetableCommand, TaskCommand, AEDPPaymentTaskCmd, AEDPStoreTaskCmd, AEDPTaskCmd, ReservePaymentCmd,,,,,,

    public class ReservePaymentCmdImpl
    extends AEDPStoreTaskCmdImpl
    implements ReservePaymentCmd
    This is the default implementation of the ReservePaymentCmd task command.


    • 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:


    Task commands called:

    See Also:
    Serialized Form
    • Field Detail


        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
        isReadyToCallExecute in class AbstractECTargetableCommand
        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
        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.
        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
        paramReservationAmount - the total amount to be reserved
      • getReservationAmount

        public java.math.BigDecimal getReservationAmount()
        This method gets the total amount to be reserved.
        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
        performExecute in class AbstractECTargetableCommand
        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
        reset in class AEDPPaymentTaskCmdImpl
      • getReleaseIds

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

        public void processFG()
                       throws EDPException,

        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.

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