Interface PayPalApiProvider

  • All Known Implementing Classes:
    ExternalPayPalApiProvider

    public interface PayPalApiProvider
    Provider for interfacing with operations utilizing a WebClient to make requests to an external REST API.
    Author:
    Dima Myroniuk (dmyroniuk)
    • Method Detail

      • retrieveOrderDetails

        Order retrieveOrderDetails​(@NonNull
                                   @NonNull String orderId,
                                   @NonNull
                                   @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer,
                                   @Nullable
                                   String applicationId,
                                   @Nullable
                                   String tenantId)
        Retrieve the details for an order, by ID.
        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

        Order createOrder​(@NonNull
                          @NonNull OrderRequest request,
                          @NonNull
                          @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer,
                          @Nullable
                          String applicationId,
                          @Nullable
                          String tenantId)
        Create the payment order.
        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

        Void updateOrder​(@NonNull
                         @NonNull String orderId,
                         @NonNull
                         @NonNull List<Patch> patches,
                         @NonNull
                         @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer,
                         @Nullable
                         String applicationId,
                         @Nullable
                         String tenantId)
        Update the payment order.
        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

        Order authorizePaymentForOrder​(@NonNull
                                       @NonNull String orderId,
                                       @NonNull
                                       @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer,
                                       @Nullable
                                       OrderAuthorizeRequest request,
                                       @Nullable
                                       String applicationId,
                                       @Nullable
                                       String tenantId)
        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.
        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

        Order capturePaymentForOrder​(@NonNull
                                     @NonNull String orderId,
                                     @NonNull
                                     @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer,
                                     @Nullable
                                     OrderCaptureRequest request,
                                     @Nullable
                                     String applicationId,
                                     @Nullable
                                     String tenantId)
        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.
        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

        Authorization retrieveAuthorizationDetails​(@NonNull
                                                   @NonNull String authorizationId,
                                                   @Nullable
                                                   String applicationId,
                                                   @Nullable
                                                   String tenantId)
        Retrieve the details for an authorized payment, by ID.
        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

        Capture captureAuthorizedPayment​(@NonNull
                                         @NonNull String authorizationId,
                                         @NonNull
                                         @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer,
                                         @NonNull
                                         @NonNull CaptureRequest request,
                                         @Nullable
                                         String applicationId,
                                         @Nullable
                                         String tenantId)
        Captures an authorized payment, by ID.
        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

        Void voidAuthorizedPayment​(@NonNull
                                   @NonNull String authorizationId,
                                   @NonNull
                                   @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer,
                                   @Nullable
                                   String applicationId,
                                   @Nullable
                                   String tenantId)
        Voids, or cancels, an authorized payment, by ID. You cannot void an authorized payment that has been fully captured.
        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

        Refund refundCapturedPayment​(@NonNull
                                     @NonNull String captureId,
                                     @NonNull
                                     @NonNull Consumer<org.springframework.http.HttpHeaders> headersConsumer,
                                     @NonNull
                                     @NonNull RefundRequest request,
                                     @Nullable
                                     String applicationId,
                                     @Nullable
                                     String tenantId)
        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.
        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