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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.broadleafcommerce.common.payment.dto.PaymentResponseDTOauthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) org.broadleafcommerce.common.payment.dto.PaymentResponseDTOauthorizeAndCapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) org.broadleafcommerce.common.payment.dto.PaymentResponseDTOcapture(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) voidprotected org.broadleafcommerce.common.payment.dto.PaymentResponseDTOcommonCreditCardProcessing(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.ServiceStatusTypevoidarbitrarily set a failure threshold value of "3"protected voidpopulateResponseDTO(org.broadleafcommerce.common.payment.dto.PaymentResponseDTO responseDTO, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO) org.broadleafcommerce.common.payment.dto.PaymentResponseDTOrefund(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) org.broadleafcommerce.common.payment.dto.PaymentResponseDTOreverseAuthorize(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO) protected voidsetupNoncePaymentRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO) org.broadleafcommerce.common.payment.dto.PaymentResponseDTOvoidPayment(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO paymentRequestDTO)
-
Field Details
-
failureCount
-
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:
authorizein interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
authorizein classorg.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:
capturein interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
capturein classorg.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:
authorizeAndCapturein interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
authorizeAndCapturein classorg.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:
reverseAuthorizein interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
reverseAuthorizein classorg.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:
refundin interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
refundin classorg.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:
voidPaymentin interfaceorg.broadleafcommerce.common.payment.service.PaymentGatewayTransactionService- Overrides:
voidPaymentin classorg.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:
getServiceStatusin interfaceorg.broadleafcommerce.common.payment.service.FailureCountExposable
-
clearStatus
public void clearStatus()- Specified by:
clearStatusin interfaceorg.broadleafcommerce.common.payment.service.FailureCountExposable
-
incrementFailure
public void incrementFailure()arbitrarily set a failure threshold value of "3"- Specified by:
incrementFailurein interfaceorg.broadleafcommerce.common.payment.service.FailureCountExposable
-
getFailureReportingThreshold
- Specified by:
getFailureReportingThresholdin interfaceorg.broadleafcommerce.common.payment.service.FailureCountExposable
-