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 Details

    • buildPaymentDistributionDetails

      List<com.broadleafcommerce.order.client.domain.payment.PaymentDistributionDetail> buildPaymentDistributionDetails(com.broadleafcommerce.order.client.domain.Order order, List<PaymentSummary> orderPayments)
      Builds a list of PaymentDistributionDetails from the given Order and its PaymentSummaries.

      By default, the PaymentDistributionDetail.getRatio() is calculated by dividing each PaymentSummary.getAmount() by OrderPricing.getTotal().

      Parameters:
      order - the Order to build PaymentDistributionDetails for
      orderPayments - the PaymentSummaries for the Order
      Returns:
      a list of PaymentDistributionDetails from the given Order and its PaymentSummaries.
    • distributePaymentAmounts

      PaymentDistributionResult distributePaymentAmounts(PaymentDistributionDto paymentDistributionDto)
      Distributes a payment amount across different payments based on the details specified in PaymentDistributionDto.
      Parameters:
      paymentDistributionDto - the PaymentDistributionDto 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