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.
ServiceMonitor,
StatusHandler,
ServiceStatusDetectable| Modifier and Type | Field and Description |
|---|---|
protected Integer |
failureCount |
protected Boolean |
isUp |
| Constructor and Description |
|---|
AbstractExternalPaymentGatewayCall() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearStatus() |
abstract R |
communicateWithVendor(T paymentRequest) |
abstract Integer |
getFailureReportingThreshold() |
ServiceStatusType |
getServiceStatus() |
void |
incrementFailure() |
R |
process(T paymentRequest) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetServiceNamepublic void clearStatus()
clearStatus in interface FailureCountExposablepublic void incrementFailure()
incrementFailure in interface FailureCountExposablepublic ServiceStatusType getServiceStatus()
getServiceStatus in interface FailureCountExposablegetServiceStatus in interface ServiceStatusDetectable<T>public R process(T paymentRequest) throws PaymentException
process in interface ServiceStatusDetectable<T>PaymentExceptionpublic abstract R communicateWithVendor(T paymentRequest) throws Exception
Exceptionpublic abstract Integer getFailureReportingThreshold()
getFailureReportingThreshold in interface FailureCountExposableCopyright © 2021. All rights reserved.