Class PayPalCheckoutTransactionServiceImpl
java.lang.Object
org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
org.broadleafcommerce.payment.service.gateway.PayPalCheckoutTransactionServiceImpl
- All Implemented Interfaces:
org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
@Service("blPayPalCheckoutTransactionService")
public class PayPalCheckoutTransactionServiceImpl
extends org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
implements org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
- Author:
- Elbert Bautista (elbertbautista)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PayPalClientProviderprotected static final org.apache.commons.logging.Logprotected ExternalCallPayPalCheckoutServiceprotected PayPalUtils -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.broadleafcommerce.common.payment.dto.PaymentResponseDTOauthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) org.broadleafcommerce.common.payment.dto.PaymentResponseDTOauthorizeAndCapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) protected PayPalAuthorizeResponseauthorizeOrder(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) Executes anPaymentTransactionType.AUTHORIZEtransaction based on the providedPaymentRequestDTOorg.broadleafcommerce.common.payment.dto.PaymentResponseDTOcapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) protected PayPalCaptureAuthResponsecaptureAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) Executes aPaymentTransactionType.CAPTUREfor the providedAuthorizationprotected PayPalCaptureOrderResponsecaptureOrder(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) Executes anPaymentTransactionType.AUTHORIZE_AND_CAPTUREtransaction based on the providedPaymentRequestDTO.protected voidprocessException(Exception e, org.broadleafcommerce.common.payment.dto.PaymentResponseDTO paymentResponse, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) This method is responsible for levering the exception, paymentRequest, & transactionType to populate the paymentResponse instead of allowing the exception to be thrown.org.broadleafcommerce.common.payment.dto.PaymentResponseDTOrefund(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) protected PayPalRefundResponserefundPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) Executes aPaymentTransactionType.REFUNDfor the captured payment.protected PayPalAuthorizationRetrievalResponseretrieveAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) org.broadleafcommerce.common.payment.dto.PaymentResponseDTOreverseAuthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) protected PayPalVoidAuthResponsevoidAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) Executes aPaymentTransactionType.REVERSE_AUTHfor the providedAuthorizationobject.protected org.broadleafcommerce.common.payment.dto.PaymentResponseDTOvoidAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest, org.broadleafcommerce.common.payment.PaymentTransactionType transactionType) org.broadleafcommerce.common.payment.dto.PaymentResponseDTOvoidPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
-
Field Details
-
LOG
protected static final org.apache.commons.logging.Log LOG -
payPalCheckoutService
-
clientProvider
-
utils
-
-
Constructor Details
-
PayPalCheckoutTransactionServiceImpl
public PayPalCheckoutTransactionServiceImpl()
-
-
Method Details
-
authorize
public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO authorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) - Specified by:
authorizein interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
authorizein classorg.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
-
capture
public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO capture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) - Specified by:
capturein interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
capturein classorg.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
-
authorizeAndCapture
public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO authorizeAndCapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) - Specified by:
authorizeAndCapturein interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
authorizeAndCapturein classorg.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
-
reverseAuthorize
public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO reverseAuthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) - Specified by:
reverseAuthorizein interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
reverseAuthorizein classorg.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
-
voidPayment
public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO voidPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) - Specified by:
voidPaymentin interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
voidPaymentin classorg.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
-
refund
public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO refund(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) - Specified by:
refundin interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
refundin classorg.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
-
voidAuthorization
protected org.broadleafcommerce.common.payment.dto.PaymentResponseDTO voidAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest, org.broadleafcommerce.common.payment.PaymentTransactionType transactionType) -
captureAuthorization
protected PayPalCaptureAuthResponse captureAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException Executes aPaymentTransactionType.CAPTUREfor the providedAuthorization- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- a
PayPalCaptureAuthResponse - Throws:
org.broadleafcommerce.common.vendor.service.exception.PaymentException
-
authorizeOrder
protected PayPalAuthorizeResponse authorizeOrder(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException Executes anPaymentTransactionType.AUTHORIZEtransaction based on the providedPaymentRequestDTO- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- an
PayPalAuthorizeResponserepresenting the final state of the transaction - Throws:
org.broadleafcommerce.common.vendor.service.exception.PaymentException
-
retrieveAuthorization
protected PayPalAuthorizationRetrievalResponse retrieveAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException - Throws:
org.broadleafcommerce.common.vendor.service.exception.PaymentException
-
captureOrder
protected PayPalCaptureOrderResponse captureOrder(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException Executes anPaymentTransactionType.AUTHORIZE_AND_CAPTUREtransaction based on the providedPaymentRequestDTO. For PayPal, this captures theOrderimmediately with no authorization.- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- a
PayPalCaptureOrderResponse - Throws:
org.broadleafcommerce.common.vendor.service.exception.PaymentException
-
voidAuthorization
protected PayPalVoidAuthResponse voidAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException Executes aPaymentTransactionType.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 - Throws:
org.broadleafcommerce.common.vendor.service.exception.PaymentException
-
refundPayment
protected PayPalRefundResponse refundPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException Executes aPaymentTransactionType.REFUNDfor the captured payment.- Parameters:
paymentRequest- The request payload that should be used to form the transaction- Returns:
- a
PayPalRefundResponse - Throws:
org.broadleafcommerce.common.vendor.service.exception.PaymentException
-
processException
protected void processException(Exception e, org.broadleafcommerce.common.payment.dto.PaymentResponseDTO paymentResponse, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest) 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
-