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 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 interface com.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 interface com.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 interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionLookupService
    • getGatewayType

      public String getGatewayType()
      Specified by:
      getGatewayType in interface com.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

      @Nullable protected String getCurrencyCode(String currencyDisplayValue)
    • getGatewayResponseCode

      protected String getGatewayResponseCode(@NonNull MyFatoorahResponse.InvoiceTransaction invoiceTransactions)
    • identifyFailureType

      protected String identifyFailureType(String reasonCode, @Nullable String transactionReferenceId)
    • buildTransactionIdentifier

      protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier buildTransactionIdentifier(@Nullable String tenantId, String gatewayTransactionId)
    • 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

      protected boolean isAuthorize(@NonNull MyFatoorahResponse.InvoiceTransaction transaction)
    • 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 using MyFatoorahResponse.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

      protected void putIfNotBlank(@NonNull @NonNull Map<String,String> map, @NonNull @NonNull String key, @Nullable String value)
    • getPaymentId

      @Nullable protected String getPaymentId(@NonNull @NonNull MyFatoorahResponse myFatoorahResponse)
    • isKnetTransaction

      protected boolean isKnetTransaction(@NonNull MyFatoorahResponse.InvoiceTransaction myFatoorahResponse)
    • isSuccessful

      protected boolean isSuccessful(MyFatoorahResponse.InvoiceTransaction transaction)
    • validateCurrency

      protected void validateCurrency(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest transactionLookupRequest, @Nullable String applicationId, @Nullable String tenantId)
    • getMyFatoorahProvider

      protected MyFatoorahProvider getMyFatoorahProvider()
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getConfigProperties

      protected MyFatoorahConfigurationProperties getConfigProperties()