Class SamplePaymentGatewayTransactionServiceImpl

java.lang.Object
org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
org.broadleafcommerce.payment.service.gateway.SamplePaymentGatewayTransactionServiceImpl
All Implemented Interfaces:
org.broadleafcommerce.common.payment.service.FailureCountExposable, org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService

@Service("blSamplePaymentGatewayTransactionService") public class SamplePaymentGatewayTransactionServiceImpl extends org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService implements org.broadleafcommerce.common.payment.service.FailureCountExposable
This is an example implementation of a PaymentGatewayTransactionService. This handles the scenario where the implementation is PCI-Compliant and the server directly handles the Credit Card PAN. If so, this service should make a server to server call to charge the card against the configured gateway. In order to use load this demo service, you will need to component scan the package "com.broadleafcommerce". This should NOT be used in production, and is meant solely for demonstration purposes only.
Author:
Elbert Bautista (elbertbautista)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Integer
     
    protected Boolean
     
  • 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 paymentRequestDTO)
     
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    authorizeAndCapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO)
     
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    capture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO)
     
    void
     
    protected org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    commonCreditCardProcessing(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO, org.broadleafcommerce.common.payment.PaymentTransactionType paymentTransactionType)
    Does minimal Credit Card Validation (luhn check and expiration date is after today).
     
    org.broadleafcommerce.common.vendor.service.type.ServiceStatusType
     
    void
    arbitrarily set a failure threshold value of "3"
    protected void
    populateResponseDTO(org.broadleafcommerce.common.payment.dto.PaymentResponseDTO responseDTO, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
     
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    refund(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO)
     
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    reverseAuthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO)
     
    protected void
    setupNoncePaymentRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
     
    org.broadleafcommerce.common.payment.dto.PaymentResponseDTO
    voidPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO)
     

    Methods inherited from class java.lang.Object

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

    • failureCount

      protected Integer failureCount
    • isUp

      protected Boolean isUp
  • Constructor Details

    • SamplePaymentGatewayTransactionServiceImpl

      public SamplePaymentGatewayTransactionServiceImpl()
  • Method Details

    • authorize

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO authorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      authorize in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      authorize in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • capture

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO capture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      capture in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      capture in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • authorizeAndCapture

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO authorizeAndCapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      authorizeAndCapture in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      authorizeAndCapture in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • reverseAuthorize

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO reverseAuthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      reverseAuthorize in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      reverseAuthorize in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • refund

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO refund(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      refund in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      refund in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • voidPayment

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO voidPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      voidPayment in interface org.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService
      Overrides:
      voidPayment in class org.broadleafcommerce.common.payment.service.AbstractPaymentGatewayTransactionService
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • commonCreditCardProcessing

      protected org.broadleafcommerce.common.payment.dto.PaymentResponseDTO commonCreditCardProcessing(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO, org.broadleafcommerce.common.payment.PaymentTransactionType paymentTransactionType)
      Does minimal Credit Card Validation (luhn check and expiration date is after today). Mimics the Response of a real Payment Gateway.
      Parameters:
      requestDTO -
      paymentTransactionType -
      Returns:
    • setupNoncePaymentRequest

      protected void setupNoncePaymentRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
    • populateResponseDTO

      protected void populateResponseDTO(org.broadleafcommerce.common.payment.dto.PaymentResponseDTO responseDTO, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO)
    • getServiceStatus

      public org.broadleafcommerce.common.vendor.service.type.ServiceStatusType getServiceStatus()
      Specified by:
      getServiceStatus in interface org.broadleafcommerce.common.payment.service.FailureCountExposable
    • clearStatus

      public void clearStatus()
      Specified by:
      clearStatus in interface org.broadleafcommerce.common.payment.service.FailureCountExposable
    • incrementFailure

      public void incrementFailure()
      arbitrarily set a failure threshold value of "3"
      Specified by:
      incrementFailure in interface org.broadleafcommerce.common.payment.service.FailureCountExposable
    • getFailureReportingThreshold

      public Integer getFailureReportingThreshold()
      Specified by:
      getFailureReportingThreshold in interface org.broadleafcommerce.common.payment.service.FailureCountExposable