Class DefaultAPSExternalCallService
java.lang.Object
com.broadleafcommerce.paymentgateway.service.AbstractExternalPaymentGatewayCall<APSPaymentRequest,com.broadleafcommerce.paymentgateway.domain.PaymentResponse>
com.broadleafcommerce.payment.service.gateway.DefaultAPSExternalCallService
- All Implemented Interfaces:
APSExternalCallService
,com.broadleafcommerce.paymentgateway.service.FailureCountExposable
,com.broadleafcommerce.paymentgateway.vendor.service.monitor.ServiceStatusDetectable<APSPaymentRequest>
public class DefaultAPSExternalCallService
extends com.broadleafcommerce.paymentgateway.service.AbstractExternalPaymentGatewayCall<APSPaymentRequest,com.broadleafcommerce.paymentgateway.domain.PaymentResponse>
implements APSExternalCallService
This class communicates with APS Payfort APIs to perform transactions.
- Author:
- Muhammad Salman Farooq
-
Field Summary
Fields inherited from class com.broadleafcommerce.paymentgateway.service.AbstractExternalPaymentGatewayCall
failureCount, isUp
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultAPSExternalCallService
(APSGatewayConfiguration configuration, APSProvider apsProvider, List<APSRequestResponseTransformer> requestResponseTransformers, com.broadleafcommerce.paymentgateway.util.PaymentResponseUtil paymentResponseUtil) -
Method Summary
Modifier and TypeMethodDescriptioncom.broadleafcommerce.paymentgateway.domain.PaymentResponse
call
(@NonNull APSPaymentRequest paymentRequest) Method to process and call the external gateway service.protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse
communicateWithAPI
(APSPaymentRequest apsPaymentRequest) Method responsible for coordinating APS API calls (based on the providedAPSPaymentRequest
), and building aPaymentResponse
, based on the API's response.com.broadleafcommerce.paymentgateway.domain.PaymentResponse
communicateWithVendor
(APSPaymentRequest apsPaymentRequest) protected APSProvider
protected APSGatewayConfiguration
protected com.broadleafcommerce.paymentgateway.util.PaymentResponseUtil
protected List<APSRequestResponseTransformer>
protected APSRequestResponseTransformer
identifyAPSRequestResponseTransformer
(APSTransactionType transactionType) Provider method that identifies which RequestResponse transformer to return based on the transaction type.Methods inherited from class com.broadleafcommerce.paymentgateway.service.AbstractExternalPaymentGatewayCall
clearStatus, getServiceStatus, incrementFailure, process
-
Constructor Details
-
DefaultAPSExternalCallService
public DefaultAPSExternalCallService(APSGatewayConfiguration configuration, APSProvider apsProvider, List<APSRequestResponseTransformer> requestResponseTransformers, com.broadleafcommerce.paymentgateway.util.PaymentResponseUtil paymentResponseUtil)
-
-
Method Details
-
call
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse call(@NonNull @NonNull APSPaymentRequest paymentRequest) Description copied from interface:APSExternalCallService
Method to process and call the external gateway service. It delegates the request to communicateWithVendor method through abstraction.- Specified by:
call
in interfaceAPSExternalCallService
- Parameters:
paymentRequest
- The request payload that should be used to form the transaction- Returns:
- PaymentResponse object that carries the response from the external gateway service
-
getServiceName
- Specified by:
getServiceName
in interfacecom.broadleafcommerce.paymentgateway.vendor.service.monitor.ServiceStatusDetectable<APSPaymentRequest>
-
communicateWithVendor
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse communicateWithVendor(APSPaymentRequest apsPaymentRequest) - Specified by:
communicateWithVendor
in classcom.broadleafcommerce.paymentgateway.service.AbstractExternalPaymentGatewayCall<APSPaymentRequest,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse>
-
getFailureReportingThreshold
- Specified by:
getFailureReportingThreshold
in interfacecom.broadleafcommerce.paymentgateway.service.FailureCountExposable
- Specified by:
getFailureReportingThreshold
in classcom.broadleafcommerce.paymentgateway.service.AbstractExternalPaymentGatewayCall<APSPaymentRequest,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse>
-
communicateWithAPI
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse communicateWithAPI(APSPaymentRequest apsPaymentRequest) Method responsible for coordinating APS API calls (based on the providedAPSPaymentRequest
), and building aPaymentResponse
, based on the API's response.- Parameters:
apsPaymentRequest
- object which wraps the PaymentRequest object and holds the information about which transaction method among AUTHORIZE, CAPTURE, PURCHASE, REFUND AND VOID_AUTHORIZATION to be called- Returns:
- PaymentResponse object that carries the response from the external gateway service
-
identifyAPSRequestResponseTransformer
protected APSRequestResponseTransformer identifyAPSRequestResponseTransformer(APSTransactionType transactionType) Provider method that identifies which RequestResponse transformer to return based on the transaction type. Possible transaction types are :
1. AUTHORIZE
2. CAPTURE
3. PURCHASE
4. REFUND
5. VOID_AUTHORIZATION- Parameters:
transactionType
- The type of transaction used to identify a transformer- Returns:
- The transformer object that corresponds to provided transaction type.
-
getConfiguration
-
getApsProvider
-
getRequestResponseTransformers
-
getPaymentResponseUtil
protected com.broadleafcommerce.paymentgateway.util.PaymentResponseUtil getPaymentResponseUtil()
-