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 and Description |
---|
PaymentSorterHelper(EDPServices localServices)
This method creates a new PaymentSorterHelper object.
|
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.
|
public PaymentSorterHelper(EDPServices localServices)
localServices
- The services to be used by this helper classpublic 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.
atomicPayments
- The list of atomic payments associated with a PIpiAmount
- The maximum amount to be allocated to a PI (determined by OMS )phase
- validation, reservation or finalizationEDPException
- thrown when parameters are nullpublic 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
storeId
- The current store IDlocale
- The current localepaymentGroupId
- The payment configuration group IDorderChannel
- The order channel IDcommandContext
- The command contextatomicPayments
- the input list of atomic paymentsphase
- The phase (prime, reserve, finalize) of the encompassing Payment Rules operationrequestedAmountForPI
- How much needs to be processed from the related payment
instructionEDPException
- In case of Payment Rules failureECException
public java.util.Collection getReleases()
public void setReleases(java.util.Collection localReleases)
localReleases
- release identifiers in process