Interface OrderToPaymentRequestDTOService

All Known Implementing Classes:
OrderToPaymentRequestDTOServiceImpl

public interface OrderToPaymentRequestDTOService
Author:
Elbert Bautista (elbertbautista)
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    populateBillTo(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
    Uses billing information on the Order to populate the PaymentRequestDTO.billTo() object
    void
    populateCustomerInfo(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
    Uses customer information on the Order to populate the PaymentRequestDTO.customer() object
    void
    populateDefaultLineItemsAndSubtotal(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
    Uses order information to populate various line item and subtotal information on the order
    void
    populateShipTo(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
    Uses the first shippable fulfillment group to populate the PaymentRequestDTO.shipTo() object
    void
    populateTotals(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
    Uses total information on the Order to populate the PaymentRequestDTO.transactionTotal(String)()} PaymentRequestDTO.taxTotal(String)()} PaymentRequestDTO.shippingTotal(String)()} PaymentRequestDTO.orderCurrencyCode(String)()}
    org.broadleafcommerce.common.payment.dto.PaymentRequestDTO
    This translates an Order into a PaymentRequestDTO.
    org.broadleafcommerce.common.payment.dto.PaymentRequestDTO
    translatePaymentTransaction(org.broadleafcommerce.common.money.Money transactionAmount, PaymentTransaction paymentTransaction)
    Utilizes the PaymentTransaction.getAdditionalFields() map to populate necessary request parameters on the resulting PaymentRequestDTO.
    org.broadleafcommerce.common.payment.dto.PaymentRequestDTO
    translatePaymentTransaction(org.broadleafcommerce.common.money.Money transactionAmount, PaymentTransaction paymentTransaction, boolean autoCalculateFinalPaymentTotals)
    Important: As of 4.0.1-GA+, there is a requirement to automatically populate the transaction amount on the DTO only if coming from a "checkout payment flow".
  • Method Details

    • translateOrder

      org.broadleafcommerce.common.payment.dto.PaymentRequestDTO translateOrder(Order order)

      This translates an Order into a PaymentRequestDTO. This method assumes that the total transaction amount being sent to the gateway will be calculated from the "final payment" on the order. This means that the transaction amount for the returned PaymentRequestDTO will be Order.getTotalAfterAppliedPayments() It assumes that all other payments (e.g. gift cards/account credit) have already been applied to the Order.

      Parameters:
      order - the Order to be translated
      Returns:
      a PaymentRequestDTO based on the properties of an order.
    • translatePaymentTransaction

      org.broadleafcommerce.common.payment.dto.PaymentRequestDTO translatePaymentTransaction(org.broadleafcommerce.common.money.Money transactionAmount, PaymentTransaction paymentTransaction)
      Utilizes the PaymentTransaction.getAdditionalFields() map to populate necessary request parameters on the resulting PaymentRequestDTO. These additional fields are then used by the payment gateway to construct additional requests. For example, an existing PaymentTransaction of type PaymentTransactionType.AUTHORIZE might be passed into this method in order for the gateway issue a "reverse auth" against this original transaction.
      Parameters:
      transactionAmount - the amount that should be placed on PaymentRequestDTO.getTransactionTotal()
      paymentTransaction - the transaction whose additional fields should be placed on PaymentRequestDTO.getAdditionalFields() for the gateway to use
      Returns:
      a new PaymentRequestDTO populated with the additional fields from paymentTransaction and the amount from transactionAmount OR override with final payment details on the order if coming in from a payment flow.
    • translatePaymentTransaction

      org.broadleafcommerce.common.payment.dto.PaymentRequestDTO translatePaymentTransaction(org.broadleafcommerce.common.money.Money transactionAmount, PaymentTransaction paymentTransaction, boolean autoCalculateFinalPaymentTotals)
      Important: As of 4.0.1-GA+, there is a requirement to automatically populate the transaction amount on the DTO only if coming from a "checkout payment flow". That is, if you are invoking this method via the ValidateAndConfirmPaymentActivity and the payment transaction passed in is of type PaymentTransactionType.UNCONFIRMED. If the totals need to be auto-calculated, the transaction total will be set from the "final payment" details that are coming off the order itself (along with other details like shipping/billing info etc...)
      Parameters:
      transactionAmount -
      paymentTransaction -
      autoCalculateFinalPaymentTotals -
      Returns:
    • populateTotals

      void populateTotals(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
      Uses total information on the Order to populate the PaymentRequestDTO.transactionTotal(String)()} PaymentRequestDTO.taxTotal(String)()} PaymentRequestDTO.shippingTotal(String)()} PaymentRequestDTO.orderCurrencyCode(String)()}
      Parameters:
      order - the Order to get data from
      requestDTO - the PaymentRequestDTO that should be populated
    • populateCustomerInfo

      void populateCustomerInfo(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
      Uses customer information on the Order to populate the PaymentRequestDTO.customer() object
      Parameters:
      order - the Order to get data from
      requestDTO - the PaymentRequestDTO that should be populated
    • populateShipTo

      void populateShipTo(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
      Uses the first shippable fulfillment group to populate the PaymentRequestDTO.shipTo() object
      Parameters:
      order - the Order to get data from
      requestDTO - the PaymentRequestDTO that should be populated
    • populateBillTo

      void populateBillTo(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
      Uses billing information on the Order to populate the PaymentRequestDTO.billTo() object
      Parameters:
      order - the Order to get data from
      requestDTO - the PaymentRequestDTO that should be populated
    • populateDefaultLineItemsAndSubtotal

      void populateDefaultLineItemsAndSubtotal(Order order, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)

      Uses order information to populate various line item and subtotal information on the order

      IMPORTANT: Each gateway that accepts line item information may require you to construct this differently. Please consult the module documentation on how it should be properly constructed.

      In this default implementation, just the subtotal is set, without any line item details.

      Parameters:
      order - the Order to get data from
      requestDTO - the PaymentRequestDTO that should be populated