Class DefaultPayPalOrderService
java.lang.Object
com.broadleafcommerce.paypal.micro.service.DefaultPayPalOrderService
- All Implemented Interfaces:
PayPalOrderService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPayPalOrderService
(PayPalCheckoutProvider checkoutProvider, PayPalApiProvider apiProvider, PayPalGatewayConfiguration gatewayConfiguration, PayPalCheckoutApiProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionprotected AmountWithBreakdown
constructAmountWithBreakdown
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) constructItems
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected Payee
constructPayee
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Constructions aPayee
to place on thePurchaseUnit
when creating an order.protected PaymentSource
constructPaymentSource
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected ShippingDetail
constructShippingDetail
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) convertToMoney
(javax.money.MonetaryAmount amount) protected Order
createOrder
(@NonNull OrderRequest orderRequest, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) createPayPalOrder
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, boolean performCheckoutOnReturn, boolean capture) Creates a PayPalOrder
.protected PayPalCheckoutProvider
protected PayPalGatewayConfiguration
getIntent
(boolean performCheckoutOnReturn, boolean capture) protected String
getPayerEmail
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected PayPalCheckoutApiProperties
protected String
getStateCode
(@NonNull com.broadleafcommerce.paymentgateway.domain.Address<com.broadleafcommerce.paymentgateway.domain.PaymentRequest> address) PayPal supports only the State code with a short form, e.g.protected void
updateOrder
(String orderId, List<Patch> patches, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) void
updateOrderCustomId
(@NonNull String orderId, @NonNull String customId, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Updates the PayPalOrder
to include the provided custom ID value.void
updatePayPalOrder
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Updates the PayPalOrder
to be in sync with the Broadleaf order.
-
Constructor Details
-
DefaultPayPalOrderService
public DefaultPayPalOrderService(PayPalCheckoutProvider checkoutProvider, PayPalApiProvider apiProvider, PayPalGatewayConfiguration gatewayConfiguration, PayPalCheckoutApiProperties properties)
-
-
Method Details
-
createPayPalOrder
public Order createPayPalOrder(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, boolean performCheckoutOnReturn, boolean capture) Description copied from interface:PayPalOrderService
Creates a PayPalOrder
.- Specified by:
createPayPalOrder
in interfacePayPalOrderService
- Parameters:
paymentRequest
- The gatewayPaymentRequest
containing the information necessary to construct the orderperformCheckoutOnReturn
- Indicates if we should start checkout after the user has authorized the order- Returns:
- The new
Order
-
updatePayPalOrder
public void updatePayPalOrder(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Description copied from interface:PayPalOrderService
Updates the PayPalOrder
to be in sync with the Broadleaf order.Our default implementation of this method updates the pricing information in the PayPal order after
Order
creation to keep both order representations in sync. For creating an order usePayPalOrderService.createPayPalOrder(PaymentRequest, boolean, boolean)
.- Specified by:
updatePayPalOrder
in interfacePayPalOrderService
- Parameters:
paymentRequest
- The gatewayPaymentRequest
-
updateOrderCustomId
public void updateOrderCustomId(@NonNull @NonNull String orderId, @NonNull @NonNull String customId, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Description copied from interface:PayPalOrderService
Updates the PayPalOrder
to include the provided custom ID value.- Specified by:
updateOrderCustomId
in interfacePayPalOrderService
- Parameters:
orderId
- the primary identifier of the PayPalOrder
customId
- the value that is to be stored on the PayPalOrder
objectpaymentRequest
- The originatingPaymentRequest
-
getIntent
-
constructPaymentSource
protected PaymentSource constructPaymentSource(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
getPayerEmail
@Nullable protected String getPayerEmail(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
constructPayee
@Nullable protected Payee constructPayee(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Constructions aPayee
to place on thePurchaseUnit
when creating an order. This is used only for PayPal's marketplace offering.- Parameters:
paymentRequest
- The gatewayPaymentRequest
with the payment info.- Returns:
- a
Payee
to place on thePurchaseUnit
or null if noMessageConstants.PAYEE_MERCHANT_ID
onPaymentRequest.getAdditionalFields()
-
constructItems
-
constructShippingDetail
@Nullable protected ShippingDetail constructShippingDetail(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
convertToMoney
-
getStateCode
@Nullable protected String getStateCode(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.Address<com.broadleafcommerce.paymentgateway.domain.PaymentRequest> address) PayPal supports only the State code with a short form, e.g. "AL" instead of "US-AL". -
createOrder
protected Order createOrder(@NonNull @NonNull OrderRequest orderRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
updateOrder
-
constructAmountWithBreakdown
protected AmountWithBreakdown constructAmountWithBreakdown(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
getCheckoutProvider
-
getGatewayConfiguration
-
getProperties
-