RES - The response content type such as OrderREQ - The request type such as OrdersCreateRequestpublic abstract class AbstractPayPalRequest<RES,REQ extends com.paypal.http.HttpRequest<RES>> extends Object implements PayPalRequest
| Constructor and Description |
|---|
AbstractPayPalRequest(PayPalClientProvider clientProvider,
org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract REQ |
buildRequest()
Method to build out
request and provide it the implementation-specific configuration
such as headers and request body. |
protected void |
configureRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
Configures
request with content and headers. |
PayPalResponse |
execute()
Executes this request if valid.
|
protected abstract AbstractPayPalResponse<RES> |
executeInternal()
Executes the configured
request using the PayPalHttpClient. |
protected com.paypal.core.PayPalHttpClient |
getClient()
Convenience method for getting the
PayPalClientProvider.getClient() from
clientProvider. |
protected PayPalClientProvider |
getClientProvider() |
protected org.broadleafcommerce.common.payment.dto.PaymentRequestDTO |
getPaymentRequest() |
protected REQ |
getRequest() |
protected boolean |
isExecuted() |
protected boolean |
isValid()
Whether
this is configured correctly and can execute the request. |
protected abstract boolean |
isValidInternal()
Implementation specific determination of whether the request can be executed.
|
public AbstractPayPalRequest(PayPalClientProvider clientProvider, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
public PayPalResponse execute()
PayPalRequestexecute in interface PayPalRequestAbstractPayPalResponse wrapper around the response from PayPal.protected boolean isValid()
this is configured correctly and can execute the request. Relies upon
isValidInternal() and whether the request has already been executed.this is configured correctly and can execute the request.protected void configureRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
request with content and headers. Defers to buildRequest() for
most of the work.protected com.paypal.core.PayPalHttpClient getClient()
PayPalClientProvider.getClient() from
clientProvider.clientProvider.clientprotected abstract REQ buildRequest()
request and provide it the implementation-specific configuration
such as headers and request body.protected abstract AbstractPayPalResponse<RES> executeInternal() throws IOException
request using the PayPalHttpClient.IOException - Thrown if the request execution fails.protected abstract boolean isValidInternal()
protected PayPalClientProvider getClientProvider()
protected org.broadleafcommerce.common.payment.dto.PaymentRequestDTO getPaymentRequest()
protected REQ getRequest()
protected boolean isExecuted()
Copyright © 2021. All rights reserved.