Class DefaultPayPalClientProvider

    • Constructor Detail

    • Method Detail

      • getClient

        @Cacheable("payPalHttpClient")
        public com.paypal.core.PayPalHttpClient getClient​(@Nullable
                                                          String applicationId,
                                                          @Nullable
                                                          String tenantId)
        Description copied from interface: PayPalClientProvider
        Returns the PayPalHttpClient for the specified tenant and application ids.
        Specified by:
        getClient in interface PayPalClientProvider
        Parameters:
        applicationId - the application ID
        tenantId - the tenant ID
        Returns:
        the configured PayPalHttpClient.
      • configureRequest

        public void configureRequest​(@NonNull
                                     @NonNull com.paypal.http.HttpRequest<?> request,
                                     @NonNull
                                     @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
        Description copied from interface: PayPalClientProvider
        Configures the PayPal request based on the PaymentRequest. This will add the request ID and various headers common to all requests.
        Specified by:
        configureRequest in interface PayPalClientProvider
        Parameters:
        request - The HttpRequest to configure
        paymentRequest - The PaymentRequest sent to the gateway
      • buildIdempotencyKey

        protected String buildIdempotencyKey​(@NonNull
                                             @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
        Builds or gathers the idempotencyKey for the request. This value will guarantee that the request cannot be processed twice & that if the request is made twice, that the second response will be the same as the first response.

        Note: this value must be unique for each transaction type. For example, if we want to authorize & later capture a PayPal Order, the capture request's idempotency key must be different than the authorization request's idempotency key.
        Parameters:
        paymentRequest - the request that will be sent to PayPal
        Returns:
        the idempotency key