@Service(value="blOrderToPaymentRequestDTOService") public class OrderToPaymentRequestDTOServiceImpl extends Object implements OrderToPaymentRequestDTOService
| Modifier and Type | Field and Description |
|---|---|
protected FulfillmentGroupService |
fgService |
static String |
ZERO_TOTAL |
| Constructor and Description |
|---|
OrderToPaymentRequestDTOServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
populateBillTo(Order order,
PaymentRequestDTO requestDTO) |
protected void |
populateCustomerInfo(Order order,
PaymentRequestDTO requestDTO) |
protected void |
populateDefaultLineItemsAndSubtotal(Order order,
PaymentRequestDTO requestDTO)
IMPORTANT:
|
protected void |
populateShipTo(Order order,
PaymentRequestDTO requestDTO)
Uses the first shippable fulfillment group to populate the
PaymentRequestDTO.shipTo() object |
protected void |
populateTotals(Order order,
PaymentRequestDTO requestDTO) |
PaymentRequestDTO |
translateOrder(Order order)
This translates an Order of
PaymentType.CREDIT_CARD into a PaymentRequestDTO. |
PaymentRequestDTO |
translatePaymentTransaction(Money transactionAmount,
PaymentTransaction paymentTransaction)
Utilizes the
PaymentTransaction.getAdditionalFields() map to populate necessary request parameters on the
resulting PaymentRequestDTO. |
public static final String ZERO_TOTAL
protected FulfillmentGroupService fgService
public PaymentRequestDTO translateOrder(Order order)
OrderToPaymentRequestDTOServiceThis translates an Order of PaymentType.CREDIT_CARD into a PaymentRequestDTO.
This method assumes that this translation will apply to a final payment which 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.
translateOrder in interface OrderToPaymentRequestDTOServiceorder - the Order to be translatedPaymentRequestDTO based on the properties of order. This will only utilize the payments
that are of type PaymentType.CREDIT_CARDpublic PaymentRequestDTO translatePaymentTransaction(Money transactionAmount, PaymentTransaction paymentTransaction)
OrderToPaymentRequestDTOServicePaymentTransaction.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 to the payment gateway. For instance, this might be use to refund or void the given paymentTransactiontranslatePaymentTransaction in interface OrderToPaymentRequestDTOServicetransactionAmount - 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 usePaymentRequestDTO populated with the additional fields from paymentTransaction and
the amount from transactionAmountprotected void populateTotals(Order order, PaymentRequestDTO requestDTO)
protected void populateCustomerInfo(Order order, PaymentRequestDTO requestDTO)
protected void populateShipTo(Order order, PaymentRequestDTO requestDTO)
PaymentRequestDTO.shipTo() objectorder - the Order to get data fromrequestDTO - the PaymentRequestDTO that should be populatedFulfillmentGroupService#getFirstShippableFulfillmentGroup(Order)}protected void populateBillTo(Order order, PaymentRequestDTO requestDTO)
protected void populateDefaultLineItemsAndSubtotal(Order order, PaymentRequestDTO requestDTO)
If you would like to pass Line Item information to a payment gateway so that it shows up on the hosted site, you will need to override this method and construct line items to conform to the requirements of that particular gateway:
For Example: The Paypal Express Checkout NVP API validates that the order subtotal that you pass in, add up to the amount of the line items that you pass in. So, In that case you will need to take into account any additional fees, promotions, credits, gift cards, etc... that are applied to the payment and add them as additional line items with a negative amount when necessary.
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.
order - requestDTO - Copyright © 2014. All Rights Reserved.