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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildIdempotencyKey(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) Builds or gathers the idempotencyKey for the request.voidconfigureRequest(com.paypal.http.HttpRequest<?> request, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) Configures thePayPal requestbased on thePaymentRequestDTO.com.paypal.core.PayPalHttpClientReturns the configuredPayPalHttpClient.voidinit()
-
Field Details
-
configuration
-
-
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:PayPalClientProviderConfigures thePayPal requestbased on thePaymentRequestDTO. This will add the request ID and various headers common to all requests.- Specified by:
configureRequestin interfacePayPalClientProvider- Parameters:
request- TheHttpRequestto configurepaymentRequest- ThePaymentRequestDTOsent 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:PayPalClientProviderReturns the configuredPayPalHttpClient.- Specified by:
getClientin interfacePayPalClientProvider- Returns:
- the configured
PayPalHttpClient.
-