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
ConstructorsModifierConstructorDescriptionprotectedAbstractPayPalRequest(@NonNull PayPalApiProvider payPalApiProvider, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildIdempotencyKey(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected voidconfigureRequestHeaders(@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.PaymentRequestprotected PayPalApiProviderprotected booleanWhether the request has been executed.protected booleanisValid()Whetherthisis configured correctly and can execute the request.protected abstract booleanImplementation specific determination of whether the request can be executed.protected org.springframework.http.HttpHeaderspreferMinimalHeader(org.springframework.http.HttpHeaders httpHeaders) protected voidpreferRepresentationHeader(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:PayPalRequestExecutes this request if valid.- Specified by:
executein interfacePayPalRequest- Returns:
- The
AbstractPayPalResponsewrapper around the response from PayPal.
-
isValid
protected boolean isValid()Whetherthisis configured correctly and can execute the request. Relies uponisValidInternal()and whether the request has already beenexecuted.- Returns:
- Whether
thisis 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.
-