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 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: PayPalApiProvider
      Retrieve the details for an order, by ID.
      Specified by:
      retrieveOrderDetails in interface PayPalApiProvider
      Parameters:
      orderId - the order id
      headersConsumer - the headers consumer
      applicationId - the application id
      tenantId - 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: PayPalApiProvider
      Create the payment order.
      Specified by:
      createOrder in interface PayPalApiProvider
      Parameters:
      request - the request to create the order
      headersConsumer - the headers consumer
      applicationId - the application id
      tenantId - 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: PayPalApiProvider
      Update the payment order.
      Specified by:
      updateOrder in interface PayPalApiProvider
      Parameters:
      orderId - the order id to update
      patches - an array of JSON patch objects to apply partial updates to resources.
      headersConsumer - the headers consumer
      applicationId - the application id
      tenantId - 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: PayPalApiProvider
      Authorizes 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:
      authorizePaymentForOrder in interface PayPalApiProvider
      Parameters:
      orderId - the order id
      headersConsumer - the headers consumer
      request - the request to authorize the payment
      applicationId - the application id
      tenantId - 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: PayPalApiProvider
      Captures 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:
      capturePaymentForOrder in interface PayPalApiProvider
      Parameters:
      orderId - the order id
      headersConsumer - the headers consumer
      request - the request to capture the payment
      applicationId - the application id
      tenantId - 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: PayPalApiProvider
      Retrieve the details for an authorized payment, by ID.
      Specified by:
      retrieveAuthorizationDetails in interface PayPalApiProvider
      Parameters:
      authorizationId - the ID of the authorized payment for which to show details.
      applicationId - the application id
      tenantId - 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: PayPalApiProvider
      Captures an authorized payment, by ID.
      Specified by:
      captureAuthorizedPayment in interface PayPalApiProvider
      Parameters:
      authorizationId - The PayPal-generated ID for the authorized payment to capture.
      headersConsumer - the headers consumer
      request - the request to capture the authorized payment
      applicationId - the application id
      tenantId - 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: PayPalApiProvider
      Voids, or cancels, an authorized payment, by ID. You cannot void an authorized payment that has been fully captured.
      Specified by:
      voidAuthorizedPayment in interface PayPalApiProvider
      Parameters:
      authorizationId - The PayPal-generated ID for the authorized payment to void.
      headersConsumer - the headers consumer
      applicationId - the application id
      tenantId - 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: PayPalApiProvider
      Refunds 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:
      refundCapturedPayment in interface PayPalApiProvider
      Parameters:
      captureId - The PayPal-generated ID for the captured payment to refund.
      headersConsumer - the headers consumer
      request - the request to refund the captured payment
      applicationId - the application id
      tenantId - the application id
      Returns:
      response body that shows refund details
    • getApiUrlBuilder

      protected org.springframework.web.util.UriComponentsBuilder getApiUrlBuilder()
    • getProperties

      protected ExternalPayPalApiProperties getProperties()
    • getCheckoutApiProperties

      protected PayPalCheckoutApiProperties getCheckoutApiProperties()