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|
This method creates a new PaymentSorterHelper object.
|Modifier and Type||Method and Description|
The method walks through all the atomic payments associated with a PI.
This method returns release IDs in process.
This method provides a list of candidate atomic payments to be used to determine actions.
This method sets release identifiers in process.
public PaymentSorterHelper(EDPServices localServices)
localServices- The services to be used by this helper class
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.
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
EDPException- thrown when parameters are null
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
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
EDPException- In case of Payment Rules failure
public java.util.Collection getReleases()
public void setReleases(java.util.Collection localReleases)
localReleases- release identifiers in process