Class AbstractPayPalRequest<RES>
java.lang.Object
com.broadleafcommerce.paypal.micro.domain.api.AbstractPayPalRequest<RES>
- Type Parameters:
RES
- The response content type such asOrder
- All Implemented Interfaces:
PayPalRequest
- Direct Known Subclasses:
PayPalAuthorizationRetrievalRequest
,PayPalAuthorizeRequest
,PayPalCaptureAuthRequest
,PayPalCaptureOrderRequest
,PayPalCreateOrderRequest
,PayPalOrderRetrievalRequest
,PayPalRefundRequest
,PayPalUpdateOrderRequest
,PayPalVoidAuthRequest
Represents a request to make against the PayPal REST APIs. It should encapsulate everything
necessary to make the request and return a response.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractPayPalRequest
(@NonNull PayPalApiProvider payPalApiProvider, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildIdempotencyKey
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected void
configureRequestHeaders
(@NonNull org.springframework.http.HttpHeaders httpHeaders) execute()
Executes this request if valid.protected abstract AbstractPayPalResponse<RES>
executeInternal
(String applicationId, String tenantId) Executes the configured request using thePayPalApiProvider
.protected com.broadleafcommerce.paymentgateway.domain.PaymentRequest
protected PayPalApiProvider
protected boolean
Whether the request has been executed.protected boolean
isValid()
Whetherthis
is configured correctly and can execute the request.protected abstract boolean
Implementation specific determination of whether the request can be executed.protected org.springframework.http.HttpHeaders
preferMinimalHeader
(org.springframework.http.HttpHeaders httpHeaders) protected void
preferRepresentationHeader
(org.springframework.http.HttpHeaders httpHeaders)
-
Constructor Details
-
AbstractPayPalRequest
protected AbstractPayPalRequest(@NonNull @NonNull PayPalApiProvider payPalApiProvider, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
-
-
Method Details
-
execute
Description copied from interface:PayPalRequest
Executes this request if valid.- Specified by:
execute
in interfacePayPalRequest
- Returns:
- The
AbstractPayPalResponse
wrapper around the response from PayPal.
-
isValid
protected boolean isValid()Whetherthis
is configured correctly and can execute the request. Relies uponisValidInternal()
and whether the request has already beenexecuted
.- Returns:
- Whether
this
is configured correctly and can execute the request.
-
preferMinimalHeader
protected org.springframework.http.HttpHeaders preferMinimalHeader(org.springframework.http.HttpHeaders httpHeaders) -
preferRepresentationHeader
protected void preferRepresentationHeader(org.springframework.http.HttpHeaders httpHeaders) -
configureRequestHeaders
protected void configureRequestHeaders(@NonNull @NonNull org.springframework.http.HttpHeaders httpHeaders) -
buildIdempotencyKey
protected String buildIdempotencyKey(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
executeInternal
protected abstract AbstractPayPalResponse<RES> executeInternal(@Nullable String applicationId, @Nullable String tenantId) throws PayPalProviderApiException Executes the configured request using thePayPalApiProvider
.- Parameters:
applicationId
- the application IDtenantId
- the tenant ID- Returns:
- The response from PayPal
- Throws:
PayPalProviderApiException
- Thrown if the request execution fails.
-
isValidInternal
protected abstract boolean isValidInternal()Implementation specific determination of whether the request can be executed.- Returns:
- Whether the request can be executed or is in an erroneous state.
-
getPayPalApiProvider
-
getPaymentRequest
protected com.broadleafcommerce.paymentgateway.domain.PaymentRequest getPaymentRequest() -
isExecuted
protected boolean isExecuted()Whether the request has been executed.
-