Class AbstractExternalPaymentGatewayCall<T,R>
- java.lang.Object
-
- com.broadleafcommerce.paymentgateway.service.AbstractExternalPaymentGatewayCall<T,R>
-
- All Implemented Interfaces:
FailureCountExposable
,ServiceStatusDetectable<T>
public abstract class AbstractExternalPaymentGatewayCall<T,R> extends Object implements ServiceStatusDetectable<T>, FailureCountExposable
All payment gateway classes that intend to make an external call, either manually from an HTTP Post or through an SDK which makes its own external call, should extend this class. The implementations should override the abstract methods: communicateWithVendor(), and getFailureReportingThreshold();
The generic Type 'T' represents the payment request object that is going to be sent to the external gateway. The generic Type 'R' represents the payment result object that will be returned
This allows anyone using the framework to configure the ServiceMonitor AOP hooks and detect any outages to provide (email/logging) feedback when necessary.
- Author:
- Elbert Bautista (elbertbautista)
- See Also:
ServiceMonitor
,StatusHandler
,ServiceStatusDetectable
-
-
Field Summary
Fields Modifier and Type Field Description protected Integer
failureCount
protected Boolean
isUp
-
Constructor Summary
Constructors Constructor Description AbstractExternalPaymentGatewayCall()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clearStatus()
abstract R
communicateWithVendor(T paymentRequest)
abstract Integer
getFailureReportingThreshold()
ServiceStatusType
getServiceStatus()
void
incrementFailure()
R
process(T paymentRequest)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.broadleafcommerce.paymentgateway.vendor.service.monitor.ServiceStatusDetectable
getServiceName
-
-
-
-
Method Detail
-
clearStatus
public void clearStatus()
- Specified by:
clearStatus
in interfaceFailureCountExposable
-
incrementFailure
public void incrementFailure()
- Specified by:
incrementFailure
in interfaceFailureCountExposable
-
getServiceStatus
public ServiceStatusType getServiceStatus()
- Specified by:
getServiceStatus
in interfaceFailureCountExposable
- Specified by:
getServiceStatus
in interfaceServiceStatusDetectable<T>
-
process
public R process(T paymentRequest) throws PaymentException
- Specified by:
process
in interfaceServiceStatusDetectable<T>
- Throws:
PaymentException
-
communicateWithVendor
public abstract R communicateWithVendor(T paymentRequest) throws Exception
- Throws:
Exception
-
getFailureReportingThreshold
public abstract Integer getFailureReportingThreshold()
- Specified by:
getFailureReportingThreshold
in interfaceFailureCountExposable
-
-