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

    Fields
    Modifier and Type
    Field
    Description
     
    protected static final org.apache.commons.logging.Log
     
     
    protected PayPalUtils
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    authorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
     
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    authorizeAndCapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
     
    authorizeOrder(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
    Executes an PaymentTransactionType.AUTHORIZE transaction based on the provided PaymentRequestDTO
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    capture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
     
    captureAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
    Executes a PaymentTransactionType.CAPTURE for the provided Authorization
    captureOrder(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
    Executes an PaymentTransactionType.AUTHORIZE_AND_CAPTURE transaction based on the provided PaymentRequestDTO.
    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.
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    refund(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
     
    refundPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
    Executes a PaymentTransactionType.REFUND for the captured payment.
    retrieveAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
     
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    reverseAuthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
     
    voidAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
    Executes a PaymentTransactionType.REVERSE_AUTH for the provided Authorization object.
    protected org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    voidAuthorization(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest, org.broadleafcommerce.common.payment.PaymentTransactionType transactionType)
     
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    voidPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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:
      authorize in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      authorize in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
    • capture

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO capture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
      Specified by:
      capture in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      capture in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
    • authorizeAndCapture

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO authorizeAndCapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
      Specified by:
      authorizeAndCapture in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      authorizeAndCapture in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
    • reverseAuthorize

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO reverseAuthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
      Specified by:
      reverseAuthorize in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      reverseAuthorize in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
    • voidPayment

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO voidPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
      Specified by:
      voidPayment in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      voidPayment in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
    • refund

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO refund(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequest)
      Specified by:
      refund in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      refund in class org.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 a PaymentTransactionType.CAPTURE for the provided Authorization
      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 an PaymentTransactionType.AUTHORIZE transaction based on the provided PaymentRequestDTO
      Parameters:
      paymentRequest - The request payload that should be used to form the transaction
      Returns:
      an PayPalAuthorizeResponse representing 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 an PaymentTransactionType.AUTHORIZE_AND_CAPTURE transaction based on the provided PaymentRequestDTO. For PayPal, this captures the Order immediately 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 a PaymentTransactionType.REVERSE_AUTH for the provided Authorization object. 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 a PaymentTransactionType.REFUND for 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 transaction
      paymentResponse - the object that will hold the transaction results
      paymentRequest - the request that was used to execute the transaction