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 ofPaymentDistributionDetails
from the givenOrder
and itsPaymentSummaries
.By default, the
PaymentDistributionDetail.getRatio()
is calculated by dividing eachPaymentSummary.getAmount()
byOrderPricing.getTotal()
.- Parameters:
order
- theOrder
to buildPaymentDistributionDetails
fororderPayments
- thePaymentSummaries
for theOrder
- Returns:
- a list of
PaymentDistributionDetails
from the givenOrder
and itsPaymentSummaries
.
-
distributePaymentAmounts
Distributes a payment amount across different payments based on the details specified inPaymentDistributionDto
.- Parameters:
paymentDistributionDto
- thePaymentDistributionDto
containing the details for the payment distributions- Returns:
- the
PaymentDistributionResult
describing the result of the distributions - Throws:
PaymentDistributionException
- if there was an error processing the distributions
-