Class DefaultPayPalCheckoutTransactionService
java.lang.Object
com.broadleafcommerce.paypal.micro.gateway.service.DefaultPayPalCheckoutTransactionService
- All Implemented Interfaces:
com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService,com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware,PayPalCheckoutTransactionService
public class DefaultPayPalCheckoutTransactionService
extends Object
implements PayPalCheckoutTransactionService
- Author:
- Nathan Moore
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPayPalCheckoutTransactionService(PayPalCheckoutProvider paypalCheckoutService, PayPalApiProvider apiProvider, PayPalOrderService payPalOrderService, PayPalCheckoutApiProperties properties, org.springframework.retry.support.RetryTemplate retryTemplate, PayPalUtils utils) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAssertionHeaderForRefundOnBehalfOf(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) This is only needed when using the Marketplaces and Platforms solution from PayPal.com.broadleafcommerce.paymentgateway.domain.PaymentResponseauthorize(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) com.broadleafcommerce.paymentgateway.domain.PaymentResponseauthorizeAndCapture(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected PayPalAuthorizeResponseauthorizeOrder(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes anDefaultTransactionTypes.AUTHORIZEtransaction based on the providedPaymentRequestcom.broadleafcommerce.paymentgateway.domain.PaymentResponsecapture(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected PayPalCaptureAuthResponsecaptureAuthorization(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes aDefaultTransactionTypes.CAPTUREfor the providedAuthorizationprotected PayPalCaptureOrderResponsecaptureOrder(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes anDefaultTransactionTypes.AUTHORIZE_AND_CAPTUREtransaction based on the providedPaymentRequest.protected PayPalApiProviderprotected PayPalCheckoutProviderprotected PayPalOrderServiceprotected PayPalCheckoutApiPropertiesprotected org.springframework.retry.support.RetryTemplateprotected PayPalUtilsgetUtils()protected voidprocessException(@NonNull Exception e, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Deprecated, for removal: This API element is subject to removal in a future version.com.broadleafcommerce.paymentgateway.domain.PaymentResponserefund(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected PayPalRefundResponserefundPayment(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes aDefaultTransactionTypes.REFUNDfor the captured payment.protected PayPalAuthorizationRetrievalResponseretrieveAuthorization(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) com.broadleafcommerce.paymentgateway.domain.PaymentResponsereverseAuthorize(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected PayPalVoidAuthResponsevoidAuthorization(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes aDefaultTransactionTypes.REVERSE_AUTHfor the providedAuthorizationobject.protected com.broadleafcommerce.paymentgateway.domain.PaymentResponsevoidAuthorization(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull com.broadleafcommerce.paymentgateway.domain.enums.TransactionType transactionType) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
detachedCredit, identifyParentTransactionReferenceIfExists, identifyTransactionReferenceIdOverrideForInitialTransaction, identifyTransactionReferenceIdOverrideForSubsequentTransactions, identifyTransactionTypeFromTransactionResults
-
Constructor Details
-
DefaultPayPalCheckoutTransactionService
public DefaultPayPalCheckoutTransactionService(PayPalCheckoutProvider paypalCheckoutService, PayPalApiProvider apiProvider, PayPalOrderService payPalOrderService, PayPalCheckoutApiProperties properties, org.springframework.retry.support.RetryTemplate retryTemplate, PayPalUtils utils)
-
-
Method Details
-
authorize
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse authorize(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) - Specified by:
authorizein interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
-
capture
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse capture(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) - Specified by:
capturein interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
-
authorizeAndCapture
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse authorizeAndCapture(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) - Specified by:
authorizeAndCapturein interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
-
reverseAuthorize
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse reverseAuthorize(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) - Specified by:
reverseAuthorizein interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
-
refund
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse refund(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) - Specified by:
refundin interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
-
addAssertionHeaderForRefundOnBehalfOf
protected void addAssertionHeaderForRefundOnBehalfOf(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) This is only needed when using the Marketplaces and Platforms solution from PayPal. Specifically, see Issuing a Refund.Adds the
PayPal-Auth-Assertionheader to thepaymentRequestto ensure it's included for refund requests, otherwise, the request will be considered unauthorized when attempting to refund on behalf of a seller.- Parameters:
paymentRequest-PaymentRequestDTO.
-
voidAuthorization
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse voidAuthorization(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.enums.TransactionType transactionType) -
captureAuthorization
protected PayPalCaptureAuthResponse captureAuthorization(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes aDefaultTransactionTypes.CAPTUREfor the providedAuthorization- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- a
PayPalCaptureAuthResponse
-
authorizeOrder
protected PayPalAuthorizeResponse authorizeOrder(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes anDefaultTransactionTypes.AUTHORIZEtransaction based on the providedPaymentRequest- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- an
PayPalAuthorizeResponserepresenting the final state of the transaction
-
retrieveAuthorization
protected PayPalAuthorizationRetrievalResponse retrieveAuthorization(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
captureOrder
protected PayPalCaptureOrderResponse captureOrder(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes anDefaultTransactionTypes.AUTHORIZE_AND_CAPTUREtransaction based on the providedPaymentRequest. For PayPal, this captures theOrderimmediately with no authorization.- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- a
PayPalCaptureOrderResponse
-
voidAuthorization
protected PayPalVoidAuthResponse voidAuthorization(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes aDefaultTransactionTypes.REVERSE_AUTHfor the providedAuthorizationobject. For PayPal, this means voiding the original authorization.- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- the
PayPalVoidAuthResponse
-
refundPayment
protected PayPalRefundResponse refundPayment(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Executes aDefaultTransactionTypes.REFUNDfor the captured payment.- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- a
PayPalRefundResponse
-
processException
@Deprecated(since="PayPal 3.0.4", forRemoval=true) protected void processException(@NonNull @NonNull Exception e, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) Deprecated, for removal: This API element is subject to removal in a future version.This method is responsible for levering the exception, paymentRequest, & transactionType to populate the paymentResponse instead of allowing the exception to be thrown.- Parameters:
e- the exception indicating a failed payment gateway transactionpaymentResponse- the object that will hold the transaction resultspaymentRequest- the request that was used to execute the transaction
-
getGatewayType
- Specified by:
getGatewayTypein interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
-
getPaypalCheckoutService
-
getApiProvider
-
getPayPalOrderService
-
getProperties
-
getRetryTemplate
protected org.springframework.retry.support.RetryTemplate getRetryTemplate() -
getUtils
-
PayPalUtils.processException(Exception, PaymentRequest, PaymentResponse)instead