Class ExternalMyFatoorahProvider

java.lang.Object
com.broadleafcommerce.myfatoorah.provider.external.AbstractExternalProvider
com.broadleafcommerce.myfatoorah.provider.external.ExternalMyFatoorahProvider
All Implemented Interfaces:
MyFatoorahProvider

public class ExternalMyFatoorahProvider extends AbstractExternalProvider implements MyFatoorahProvider
The default implementation of MyFatoorahProvider.
Author:
Dima Myroniuk (dmyroniuk)
  • Constructor Details

    • ExternalMyFatoorahProvider

      public ExternalMyFatoorahProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ExternalMyFatoorahProviderProperties providerProperties, MyFatoorahConfigurationProperties configProperties, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • initiateSession

      public InitSessionResponse initiateSession(@Nullable String customerId, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: MyFatoorahProvider
      This method is responsible for making call to init-session end-point of MyFatoorah.
      Specified by:
      initiateSession in interface MyFatoorahProvider
      Parameters:
      customerId - the customer ID
      currencyCode - The currency code for this request
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from MyFatoorah API.
    • executePayment

      public MyFatoorahResponse executePayment(@NonNull @NonNull Map<String,Object> bodyParams, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: MyFatoorahProvider
      Executes the DefaultTransactionTypes.AUTHORIZE transactions.
      Specified by:
      executePayment in interface MyFatoorahProvider
      Parameters:
      bodyParams - the request body
      currencyCode - the currency code for the transaction
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the MyFatoorah ExecutePayment API response
    • getPaymentStatus

      public MyFatoorahResponse getPaymentStatus(@NonNull @NonNull String id, @NonNull @NonNull String keyType, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: MyFatoorahProvider
      Gathers the status of a MyFatoorah payment based upon the invoiceId or paymentId
      Specified by:
      getPaymentStatus in interface MyFatoorahProvider
      Parameters:
      id - paymentId or invoiceId to get payment status.
      keyType - paymentId or invoiceId
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the status of a MyFatoorah payment
    • reverseAuthorize

      public MyFatoorahResponse reverseAuthorize(@NonNull @NonNull Map<String,Object> bodyParams, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: MyFatoorahProvider
      Executes the DefaultTransactionTypes.REVERSE_AUTH transactions.
      Specified by:
      reverseAuthorize in interface MyFatoorahProvider
      Parameters:
      bodyParams - the request body
      currencyCode - The currency code for this transaction
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from MyFatoorah API
    • capture

      public MyFatoorahResponse capture(@NonNull @NonNull Map<String,Object> bodyParams, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: MyFatoorahProvider
      Executes the DefaultTransactionTypes.CAPTURE transactions.
      Specified by:
      capture in interface MyFatoorahProvider
      Parameters:
      bodyParams - the request body
      currencyCode - The currency code for this transaction
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from MyFatoorah API
    • refund

      public MyFatoorahResponse refund(@NonNull @NonNull Map<String,Object> bodyParams, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: MyFatoorahProvider
      Executes the DefaultTransactionTypes.REFUND transactions.
      Specified by:
      refund in interface MyFatoorahProvider
      Parameters:
      bodyParams - the request body
      currencyCode - The currency code for this transaction
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from MyFatoorah API
    • getRefundStatus

      public MyFatoorahResponse getRefundStatus(@NonNull @NonNull String refundId, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: MyFatoorahProvider
      Gathers the status of a MyFatoorah refund by id
      Specified by:
      getRefundStatus in interface MyFatoorahProvider
      Parameters:
      refundId - the id of the MyFatoorah refund
      currencyCode - The currency code for this request
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the status of a MyFatoorah refund
    • initiatePayment

      public MyFatoorahInitiatePaymentResponse initiatePayment(@NonNull @NonNull MyFatoorahInitiatePaymentRequest initPaymentRequest, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: MyFatoorahProvider
      This method is responsible for making call to init-payment end-point of MyFatoorah.
      Specified by:
      initiatePayment in interface MyFatoorahProvider
      Parameters:
      initPaymentRequest - init payment request
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from MyFatoorah API.
    • buildInitSessionRequest

      protected InitSessionRequest buildInitSessionRequest(@Nullable String customerId)
    • buildGetPaymentStatusRequest

      protected Map<String,Object> buildGetPaymentStatusRequest(@NonNull @NonNull String id, @NonNull @NonNull String keyType)
    • buildGetRefundStatusRequest

      protected Map<String,Object> buildGetRefundStatusRequest(@NonNull @NonNull String refundId)
    • executeTransactionRequest

      protected MyFatoorahResponse executeTransactionRequest(@NonNull @NonNull String url, @NonNull @NonNull Map<String,Object> bodyParams, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
    • executeInitiatePaymentRequest

      protected MyFatoorahInitiatePaymentResponse executeInitiatePaymentRequest(@NonNull @NonNull String url, @NonNull @NonNull Map<String,Object> bodyParams, @Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
    • getApiUrlBuilder

      protected org.springframework.web.util.UriComponentsBuilder getApiUrlBuilder()
    • getInitSessionUri

      protected String getInitSessionUri()
    • getExecutePaymentUri

      protected String getExecutePaymentUri()
    • getPaymentStatusUri

      protected String getPaymentStatusUri()
    • getUpdatePaymentStatusUri

      protected String getUpdatePaymentStatusUri()
    • getMakeRefundUri

      protected String getMakeRefundUri()
    • getRefundStatusUri

      protected String getRefundStatusUri()
    • getInitiatePaymentUri

      protected String getInitiatePaymentUri()
    • getApiToken

      protected String getApiToken(@Nullable String currencyCode, @Nullable String applicationId, @Nullable String tenantId)
    • getProviderProperties

      protected ExternalMyFatoorahProviderProperties getProviderProperties()
    • getConfigProperties

      protected MyFatoorahConfigurationProperties getConfigProperties()
    • getTypeFactory

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