Interface PaymentDistributionService
- All Known Implementing Classes:
DefaultPaymentDistributionService
public interface PaymentDistributionService
A service responsible for distributing payment amounts based on the payments' ratios from an
Order.- Author:
- Sunny Yu
-
Method Summary
Modifier and TypeMethodDescriptionList<com.broadleafcommerce.order.client.domain.payment.PaymentDistributionDetail>buildPaymentDistributionDetails(com.broadleafcommerce.order.client.domain.Order order, List<PaymentSummary> orderPayments) distributePaymentAmounts(PaymentDistributionDto paymentDistributionDto) Distributes a payment amount across different payments based on the details specified inPaymentDistributionDto.
-
Method Details
-
buildPaymentDistributionDetails
List<com.broadleafcommerce.order.client.domain.payment.PaymentDistributionDetail> buildPaymentDistributionDetails(com.broadleafcommerce.order.client.domain.Order order, List<PaymentSummary> orderPayments) Builds a list ofPaymentDistributionDetailsfrom the givenOrderand itsPaymentSummaries.By default, the
PaymentDistributionDetail.getRatio()is calculated by dividing eachPaymentSummary.getAmount()byOrderPricing.getTotal().- Parameters:
order- theOrderto buildPaymentDistributionDetailsfororderPayments- thePaymentSummariesfor theOrder- Returns:
- a list of
PaymentDistributionDetailsfrom the givenOrderand itsPaymentSummaries.
-
distributePaymentAmounts
Distributes a payment amount across different payments based on the details specified inPaymentDistributionDto.- Parameters:
paymentDistributionDto- thePaymentDistributionDtocontaining the details for the payment distributions- Returns:
- the
PaymentDistributionResultdescribing the result of the distributions - Throws:
PaymentDistributionException- if there was an error processing the distributions
-