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 Summary
ConstructorDescriptionExternalMyFatoorahProvider
(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 Summary
Modifier and TypeMethodDescriptionbuildGetPaymentStatusRequest
(@NonNull String id, @NonNull String keyType) buildGetRefundStatusRequest
(@NonNull String refundId) protected InitSessionRequest
buildInitSessionRequest
(String customerId) capture
(@NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) Executes theDefaultTransactionTypes.CAPTURE
transactions.protected MyFatoorahInitiatePaymentResponse
executeInitiatePaymentRequest
(@NonNull String url, @NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) executePayment
(@NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) Executes theDefaultTransactionTypes.AUTHORIZE
transactions.protected MyFatoorahResponse
executeTransactionRequest
(@NonNull String url, @NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) protected String
getApiToken
(String currencyCode, String applicationId, String tenantId) protected org.springframework.web.util.UriComponentsBuilder
protected MyFatoorahConfigurationProperties
protected String
protected String
protected String
protected String
getPaymentStatus
(@NonNull String id, @NonNull String keyType, String currencyCode, String applicationId, String tenantId) Gathers the status of a MyFatoorah payment based upon the invoiceId or paymentIdprotected String
protected ExternalMyFatoorahProviderProperties
getRefundStatus
(@NonNull String refundId, String currencyCode, String applicationId, String tenantId) Gathers the status of a MyFatoorah refund by idprotected String
protected com.broadleafcommerce.common.extension.TypeFactory
protected String
initiatePayment
(@NonNull MyFatoorahInitiatePaymentRequest initPaymentRequest, String applicationId, String tenantId) This method is responsible for making call to init-payment end-point of MyFatoorah.initiateSession
(String customerId, String currencyCode, String applicationId, String tenantId) This method is responsible for making call to init-session end-point of MyFatoorah.refund
(@NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) Executes theDefaultTransactionTypes.REFUND
transactions.reverseAuthorize
(@NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) Executes theDefaultTransactionTypes.REVERSE_AUTH
transactions.Methods inherited from class com.broadleafcommerce.myfatoorah.provider.external.AbstractExternalProvider
executeRequest, getObjectMapper, getWebClient, uriVars
-
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 interfaceMyFatoorahProvider
- Parameters:
customerId
- the customer IDcurrencyCode
- The currency code for this requestapplicationId
- the application idtenantId
- 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 theDefaultTransactionTypes.AUTHORIZE
transactions.- Specified by:
executePayment
in interfaceMyFatoorahProvider
- Parameters:
bodyParams
- the request bodycurrencyCode
- the currency code for the transactionapplicationId
- the application idtenantId
- 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 interfaceMyFatoorahProvider
- Parameters:
id
- paymentId or invoiceId to get payment status.keyType
- paymentId or invoiceIdapplicationId
- the application idtenantId
- 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 theDefaultTransactionTypes.REVERSE_AUTH
transactions.- Specified by:
reverseAuthorize
in interfaceMyFatoorahProvider
- Parameters:
bodyParams
- the request bodycurrencyCode
- The currency code for this transactionapplicationId
- the application idtenantId
- 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 theDefaultTransactionTypes.CAPTURE
transactions.- Specified by:
capture
in interfaceMyFatoorahProvider
- Parameters:
bodyParams
- the request bodycurrencyCode
- The currency code for this transactionapplicationId
- the application idtenantId
- 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 theDefaultTransactionTypes.REFUND
transactions.- Specified by:
refund
in interfaceMyFatoorahProvider
- Parameters:
bodyParams
- the request bodycurrencyCode
- The currency code for this transactionapplicationId
- the application idtenantId
- 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 interfaceMyFatoorahProvider
- Parameters:
refundId
- the id of the MyFatoorah refundcurrencyCode
- The currency code for this requestapplicationId
- the application idtenantId
- 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 interfaceMyFatoorahProvider
- Parameters:
initPaymentRequest
- init payment requestapplicationId
- the application idtenantId
- the tenant id- Returns:
- the response from MyFatoorah API.
-
buildInitSessionRequest
-
buildGetPaymentStatusRequest
-
buildGetRefundStatusRequest
-
executeTransactionRequest
-
executeInitiatePaymentRequest
-
getApiUrlBuilder
protected org.springframework.web.util.UriComponentsBuilder getApiUrlBuilder() -
getInitSessionUri
-
getExecutePaymentUri
-
getPaymentStatusUri
-
getUpdatePaymentStatusUri
-
getMakeRefundUri
-
getRefundStatusUri
-
getInitiatePaymentUri
-
getApiToken
-
getProviderProperties
-
getConfigProperties
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-