Class DefaultMyFatoorahTransactionLookupService
java.lang.Object
com.broadleafcommerce.myfatoorah.service.DefaultMyFatoorahTransactionLookupService
- All Implemented Interfaces:
MyFatoorahTransactionLookupService
,com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionLookupService
,com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
public class DefaultMyFatoorahTransactionLookupService
extends Object
implements MyFatoorahTransactionLookupService
- Author:
- Divyank Chavan.
-
Constructor Summary
ConstructorDescriptionDefaultMyFatoorahTransactionLookupService
(MyFatoorahProvider myFatoorahProvider, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, MyFatoorahConfigurationProperties configProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addRawResponse
(com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, MyFatoorahResponse myFatoorahResponse) protected String
Build the gateway transaction id using the payment id & track id, instead of usingMyFatoorahResponse.InvoiceTransaction.getTransactionId()
due to this field not being present in the webhook payload.protected void
buildPaymentResponse
(com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, MyFatoorahResponse myFatoorahResponse, MyFatoorahResponse.InvoiceTransaction transaction, String transactionCurrency, boolean isSuccessful, String paymentId) protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier
buildTransactionIdentifier
(String tenantId, String gatewayTransactionId) protected MyFatoorahConfigurationProperties
protected String
getCurrencyCode
(String currencyDisplayValue) protected String
getGatewayResponseCode
(MyFatoorahResponse.InvoiceTransaction invoiceTransactions) protected String
getInvoiceStatus
(@NonNull MyFatoorahResponse myFatoorahResponse) protected MyFatoorahProvider
protected com.fasterxml.jackson.databind.ObjectMapper
protected String
getPaymentId
(@NonNull MyFatoorahResponse myFatoorahResponse) protected javax.money.MonetaryAmount
getTransactionAmount
(MyFatoorahResponse.InvoiceTransaction invoiceTransactions, @NonNull String transactionCurrency) org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> protected com.broadleafcommerce.common.extension.TypeFactory
protected String
identifyFailureType
(String reasonCode, String transactionReferenceId) protected MyFatoorahResponse.InvoiceTransaction
identifyLatestTransaction
(@NonNull MyFatoorahResponse myFatoorahResponse) protected boolean
isAuthorize
(MyFatoorahResponse.InvoiceTransaction transaction) protected boolean
isKnetTransaction
(MyFatoorahResponse.InvoiceTransaction myFatoorahResponse) protected boolean
isSuccessful
(MyFatoorahResponse.InvoiceTransaction transaction) com.broadleafcommerce.paymentgateway.domain.PaymentResponse
lookupTransactionDetails
(@NonNull com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest transactionLookupRequest, String tenantId, String applicationId) protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse
populatePaymentResponse
(@NonNull MyFatoorahResponse myFatoorahResponse, @NonNull String invoiceId, String applicationId, String tenantId) protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse
populatePaymentResponse
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull MyFatoorahResponse myFatoorahResponse, MyFatoorahResponse.InvoiceTransaction transaction, String paymentId, String applicationId, String tenantId, boolean isAuthorizedTransaction) protected void
populateResponseMap
(MyFatoorahResponse.InvoiceTransaction latestTransaction, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) protected void
protected void
validateCurrency
(@NonNull com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest transactionLookupRequest, String applicationId, String tenantId) void
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.service.PaymentGatewayTransactionLookupService
validateRequestParams
-
Constructor Details
-
DefaultMyFatoorahTransactionLookupService
public DefaultMyFatoorahTransactionLookupService(MyFatoorahProvider myFatoorahProvider, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, MyFatoorahConfigurationProperties configProperties)
-
-
Method Details
-
validateRequestParams
public void validateRequestParams(Map<String, String> requestParams, @Nullable String tenantId, @Nullable String applicationId) - Specified by:
validateRequestParams
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionLookupService
-
getTransactionDetails
public org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> getTransactionDetails(Map<String, String> requestParams, @Nullable String tenantId, @Nullable String applicationId) - Specified by:
getTransactionDetails
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionLookupService
-
lookupTransactionDetails
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse lookupTransactionDetails(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest transactionLookupRequest, @Nullable String tenantId, @Nullable String applicationId) - Specified by:
lookupTransactionDetails
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionLookupService
-
getGatewayType
- Specified by:
getGatewayType
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
-
populatePaymentResponse
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse populatePaymentResponse(@NonNull @NonNull MyFatoorahResponse myFatoorahResponse, @NonNull @NonNull String invoiceId, @Nullable String applicationId, @Nullable String tenantId) -
getInvoiceStatus
@Nullable protected String getInvoiceStatus(@NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
identifyLatestTransaction
protected MyFatoorahResponse.InvoiceTransaction identifyLatestTransaction(@NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
getTransactionAmount
@Nullable protected javax.money.MonetaryAmount getTransactionAmount(@NonNull MyFatoorahResponse.InvoiceTransaction invoiceTransactions, @NonNull @NonNull String transactionCurrency) -
getCurrencyCode
-
getGatewayResponseCode
protected String getGatewayResponseCode(@NonNull MyFatoorahResponse.InvoiceTransaction invoiceTransactions) -
identifyFailureType
-
buildTransactionIdentifier
-
populatePaymentResponse
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse populatePaymentResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull MyFatoorahResponse myFatoorahResponse, @NonNull MyFatoorahResponse.InvoiceTransaction transaction, @Nullable String paymentId, @Nullable String applicationId, @Nullable String tenantId, boolean isAuthorizedTransaction) -
buildPaymentResponse
protected void buildPaymentResponse(com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, MyFatoorahResponse myFatoorahResponse, MyFatoorahResponse.InvoiceTransaction transaction, String transactionCurrency, boolean isSuccessful, String paymentId) -
isAuthorize
-
addRawResponse
protected void addRawResponse(com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, MyFatoorahResponse myFatoorahResponse) -
buildGatewayTransactionId
protected String buildGatewayTransactionId(@NonNull MyFatoorahResponse.InvoiceTransaction transaction) Build the gateway transaction id using the payment id & track id, instead of usingMyFatoorahResponse.InvoiceTransaction.getTransactionId()
due to this field not being present in the webhook payload.- Parameters:
transaction
- The transaction results- Returns:
- The gateway transaction id based on the payment id & track id
-
populateResponseMap
protected void populateResponseMap(@NonNull MyFatoorahResponse.InvoiceTransaction latestTransaction, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) -
putIfNotBlank
-
getPaymentId
-
isKnetTransaction
protected boolean isKnetTransaction(@NonNull MyFatoorahResponse.InvoiceTransaction myFatoorahResponse) -
isSuccessful
-
validateCurrency
-
getMyFatoorahProvider
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getConfigProperties
-