Class ExternalPayPalApiProvider
java.lang.Object
com.broadleafcommerce.paypal.micro.gateway.service.provider.external.AbstractExternalPayPalApiProvider
com.broadleafcommerce.paypal.micro.gateway.service.provider.external.ExternalPayPalApiProvider
- All Implemented Interfaces:
PayPalApiProvider
public class ExternalPayPalApiProvider
extends AbstractExternalPayPalApiProvider
implements PayPalApiProvider
The default implementation of
PayPalApiProvider.- Author:
- Dima Myroniuk (dmyroniuk)
-
Constructor Summary
ConstructorsConstructorDescriptionExternalPayPalApiProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ExternalPayPalApiProperties properties, PayPalCheckoutApiProperties checkoutApiProperties) -
Method Summary
Modifier and TypeMethodDescriptionauthorizePaymentForOrder(@NonNull String orderId, @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, OrderAuthorizeRequest request, String applicationId, String tenantId) Authorizes payment for an order.captureAuthorizedPayment(@NonNull String authorizationId, @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, @NonNull CaptureRequest request, String applicationId, String tenantId) Captures an authorized payment, by ID.capturePaymentForOrder(@NonNull String orderId, @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, OrderCaptureRequest request, String applicationId, String tenantId) Captures payment for an order.createOrder(@NonNull OrderRequest request, @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, String applicationId, String tenantId) Create the payment order.protected org.springframework.web.util.UriComponentsBuilderprotected PayPalCheckoutApiPropertiesprotected ExternalPayPalApiPropertiesrefundCapturedPayment(@NonNull String captureId, @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, @NonNull RefundRequest request, String applicationId, String tenantId) Refunds a captured payment, by ID.retrieveAuthorizationDetails(@NonNull String authorizationId, String applicationId, String tenantId) Retrieve the details for an authorized payment, by ID.retrieveOrderDetails(@NonNull String orderId, @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, String applicationId, String tenantId) Retrieve the details for an order, by ID.updateOrder(@NonNull String orderId, @NonNull List<Patch> patches, @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, String applicationId, String tenantId) Update the payment order.voidAuthorizedPayment(@NonNull String authorizationId, @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, String applicationId, String tenantId) Voids, or cancels, an authorized payment, by ID.Methods inherited from class com.broadleafcommerce.paypal.micro.gateway.service.provider.external.AbstractExternalPayPalApiProvider
executeRequest, getObjectMapper, getWebClient, uriVars
-
Constructor Details
-
ExternalPayPalApiProvider
public ExternalPayPalApiProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ExternalPayPalApiProperties properties, PayPalCheckoutApiProperties checkoutApiProperties)
-
-
Method Details
-
retrieveOrderDetails
public Order retrieveOrderDetails(@NonNull @NonNull String orderId, @NonNull @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, @Nullable String applicationId, @Nullable String tenantId) Description copied from interface:PayPalApiProviderRetrieve the details for an order, by ID.- Specified by:
retrieveOrderDetailsin interfacePayPalApiProvider- Parameters:
orderId- the order idheadersConsumer- the headers consumerapplicationId- the application idtenantId- the tenant id- Returns:
- the details for an order, by ID.
-
createOrder
public Order createOrder(@NonNull @NonNull OrderRequest request, @NonNull @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, @Nullable String applicationId, @Nullable String tenantId) Description copied from interface:PayPalApiProviderCreate the payment order.- Specified by:
createOrderin interfacePayPalApiProvider- Parameters:
request- the request to create the orderheadersConsumer- the headers consumerapplicationId- the application idtenantId- the tenant id- Returns:
- the created order
-
updateOrder
public Void updateOrder(@NonNull @NonNull String orderId, @NonNull @NonNull List<Patch> patches, @NonNull @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, String applicationId, String tenantId) Description copied from interface:PayPalApiProviderUpdate the payment order.- Specified by:
updateOrderin interfacePayPalApiProvider- Parameters:
orderId- the order id to updatepatches- an array of JSON patch objects to apply partial updates to resources.headersConsumer- the headers consumerapplicationId- the application idtenantId- the tenant id
-
authorizePaymentForOrder
public Order authorizePaymentForOrder(@NonNull @NonNull String orderId, @NonNull @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, @Nullable OrderAuthorizeRequest request, @Nullable String applicationId, @Nullable String tenantId) Description copied from interface:PayPalApiProviderAuthorizes payment for an order. To successfully authorize payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response.- Specified by:
authorizePaymentForOrderin interfacePayPalApiProvider- Parameters:
orderId- the order idheadersConsumer- the headers consumerrequest- the request to authorize the paymentapplicationId- the application idtenantId- the tenant id- Returns:
- response body that shows authorized payment details
-
capturePaymentForOrder
public Order capturePaymentForOrder(@NonNull @NonNull String orderId, @NonNull @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, OrderCaptureRequest request, String applicationId, String tenantId) Description copied from interface:PayPalApiProviderCaptures payment for an order. To successfully capture payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response.- Specified by:
capturePaymentForOrderin interfacePayPalApiProvider- Parameters:
orderId- the order idheadersConsumer- the headers consumerrequest- the request to capture the paymentapplicationId- the application idtenantId- the tenant id- Returns:
- response body that shows captured payment details
-
retrieveAuthorizationDetails
public Authorization retrieveAuthorizationDetails(@NonNull @NonNull String authorizationId, String applicationId, String tenantId) Description copied from interface:PayPalApiProviderRetrieve the details for an authorized payment, by ID.- Specified by:
retrieveAuthorizationDetailsin interfacePayPalApiProvider- Parameters:
authorizationId- the ID of the authorized payment for which to show details.applicationId- the application idtenantId- the tenant id- Returns:
- response body that shows authorization details.
-
captureAuthorizedPayment
public Capture captureAuthorizedPayment(@NonNull @NonNull String authorizationId, @NonNull @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, @NonNull @NonNull CaptureRequest request, String applicationId, String tenantId) Description copied from interface:PayPalApiProviderCaptures an authorized payment, by ID.- Specified by:
captureAuthorizedPaymentin interfacePayPalApiProvider- Parameters:
authorizationId- The PayPal-generated ID for the authorized payment to capture.headersConsumer- the headers consumerrequest- the request to capture the authorized paymentapplicationId- the application idtenantId- the tenant id- Returns:
- response body that shows captured payment details
-
voidAuthorizedPayment
public Void voidAuthorizedPayment(@NonNull @NonNull String authorizationId, @NonNull @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, String applicationId, String tenantId) Description copied from interface:PayPalApiProviderVoids, or cancels, an authorized payment, by ID. You cannot void an authorized payment that has been fully captured.- Specified by:
voidAuthorizedPaymentin interfacePayPalApiProvider- Parameters:
authorizationId- The PayPal-generated ID for the authorized payment to void.headersConsumer- the headers consumerapplicationId- the application idtenantId- the tenant id
-
refundCapturedPayment
public Refund refundCapturedPayment(@NonNull @NonNull String captureId, @NonNull @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer, @NonNull @NonNull RefundRequest request, String applicationId, String tenantId) Description copied from interface:PayPalApiProviderRefunds a captured payment, by ID. For a full refund, include an empty payload in the JSON request body. For a partial refund, include an amount object in the JSON request body.- Specified by:
refundCapturedPaymentin interfacePayPalApiProvider- Parameters:
captureId- The PayPal-generated ID for the captured payment to refund.headersConsumer- the headers consumerrequest- the request to refund the captured paymentapplicationId- the application idtenantId- the application id- Returns:
- response body that shows refund details
-
getApiUrlBuilder
protected org.springframework.web.util.UriComponentsBuilder getApiUrlBuilder() -
getProperties
-
getCheckoutApiProperties
-