Class PayPalClientProviderImpl

java.lang.Object
org.broadleafcommerce.vendor.paypal.service.PayPalClientProviderImpl
All Implemented Interfaces:
PayPalClientProvider

@Service("blPayPalClientProvider") public class PayPalClientProviderImpl extends Object implements PayPalClientProvider
Author:
Nathan Moore (nathandmoore)
  • Field Details

  • Constructor Details

    • PayPalClientProviderImpl

      public PayPalClientProviderImpl()
  • Method Details

    • init

      @PostConstruct public void init()
    • configureRequest

      public void configureRequest(com.paypal.http.HttpRequest<?> request, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
      Description copied from interface: PayPalClientProvider
      Configures the PayPal request based on the PaymentRequestDTO. 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 PaymentRequestDTO sent to the gateway
    • buildIdempotencyKey

      protected String buildIdempotencyKey(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO 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
    • getClient

      public com.paypal.core.PayPalHttpClient getClient()
      Description copied from interface: PayPalClientProvider
      Returns the configured PayPalHttpClient.
      Specified by:
      getClient in interface PayPalClientProvider
      Returns:
      the configured PayPalHttpClient.