com.ibm.commerce.payment.rules

Class PaymentSorterHelper

  • java.lang.Object
    • com.ibm.commerce.payment.rules.PaymentSorterHelper


  • public class PaymentSorterHelper
    extends java.lang.Object

    This method provides utility function that sorts through a collection of atomic payments (passed in) that belong to a PI (PaymentInstruction). It also allocates a request amount against each atomic payment, and returns a sorted collection of atomic payment container AtomicPaymentToBackendLinkObject objects. The output from the functions of this class is used to provide input into the payment action rules.

    Terms used in defining this function:

    Atomic Payment: The atomic payment under consideration

    Available Amount for allocation: For each phase of operation. The available amount is the difference between the totalAmount of the atomicPayment and the amount already consumed by this phase of the operation. Thus, in the reservation phase, if the reservation amount attribute is 0.00, and total atomic payment amount is 30.00, then the available amount is 30.00

    Request Amount for allocation: This is the final amount that the algorithm seeks to assign to this atomic payment based on available amount and other considerations. Such as the amount that needs to be consumed by this PI.

    • Constructor Summary

      Constructors 
      Constructor and Description
      PaymentSorterHelper(EDPServices localServices)
      This method creates a new PaymentSorterHelper object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.math.BigDecimal determineConsumableAmount(java.util.Collection atomicPayments, java.math.BigDecimal piAmount, int phase)
      The method walks through all the atomic payments associated with a PI.
      java.util.Collection getReleases()
      This method returns release IDs in process.
      java.util.Collection provideAtomicPayments(java.lang.Integer storeId, java.util.Locale locale, java.lang.String paymentGroupId, java.lang.String orderChannel, CommandContext commandContext, java.util.Collection atomicPayments, int phase, java.math.BigDecimal requestedAmountForPI)
      This method provides a list of candidate atomic payments to be used to determine actions.
      void setReleases(java.util.Collection localReleases)
      This method sets release identifiers in process.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PaymentSorterHelper

        public PaymentSorterHelper(EDPServices localServices)
        This method creates a new PaymentSorterHelper object.
        Parameters:
        localServices - The services to be used by this helper class
    • Method Detail

      • determineConsumableAmount

        public java.math.BigDecimal determineConsumableAmount(java.util.Collection atomicPayments,
                                                              java.math.BigDecimal piAmount,
                                                              int phase)
                                                       throws EDPException

        The method walks through all the atomic payments associated with a PI. It adds the phase attribute amounts for all the atomic payments together for the appropriate phase. It then subtracts the total from the total PI amount, and returns the result. This result is the amount available for consumption under this PI for this phase.

        Parameters:
        atomicPayments - The list of atomic payments associated with a PI
        piAmount - The maximum amount to be allocated to a PI (determined by OMS )
        phase - validation, reservation or finalization
        Returns:
        The amount available in this payment instruction for use in this phase of operation
        Throws:
        EDPException - thrown when parameters are null
      • provideAtomicPayments

        public java.util.Collection provideAtomicPayments(java.lang.Integer storeId,
                                                          java.util.Locale locale,
                                                          java.lang.String paymentGroupId,
                                                          java.lang.String orderChannel,
                                                          CommandContext commandContext,
                                                          java.util.Collection atomicPayments,
                                                          int phase,
                                                          java.math.BigDecimal requestedAmountForPI)
                                                   throws EDPException,
                                                          ECException
        This method provides a list of candidate atomic payments to be used to determine actions.
        Parameters:
        storeId - The current store ID
        locale - The current locale
        paymentGroupId - The payment configuration group ID
        orderChannel - The order channel ID
        commandContext - The command context
        atomicPayments - the input list of atomic payments
        phase - The phase (prime, reserve, finalize) of the encompassing Payment Rules operation
        requestedAmountForPI - How much needs to be processed from the related payment instruction
        Returns:
        The list of candidates (atomic payments) to be used to determine actions
        Throws:
        EDPException - In case of Payment Rules failure
        ECException
      • getReleases

        public java.util.Collection getReleases()
        This method returns release IDs in process.
        Returns:
        release IDs in process
      • setReleases

        public void setReleases(java.util.Collection localReleases)
        This method sets release identifiers in process.
        Parameters:
        localReleases - release identifiers in process