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
ConstructorsConstructorDescriptionExternalMyFatoorahProvider(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 InitSessionRequestbuildInitSessionRequest(String customerId) capture(@NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) Executes theDefaultTransactionTypes.CAPTUREtransactions.protected MyFatoorahInitiatePaymentResponseexecuteInitiatePaymentRequest(@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.AUTHORIZEtransactions.protected MyFatoorahResponseexecuteTransactionRequest(@NonNull String url, @NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) protected StringgetApiToken(String currencyCode, String applicationId, String tenantId) protected org.springframework.web.util.UriComponentsBuilderprotected MyFatoorahConfigurationPropertiesprotected Stringprotected Stringprotected Stringprotected StringgetPaymentStatus(@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 Stringprotected ExternalMyFatoorahProviderPropertiesgetRefundStatus(@NonNull String refundId, String currencyCode, String applicationId, String tenantId) Gathers the status of a MyFatoorah refund by idprotected Stringprotected com.broadleafcommerce.common.extension.TypeFactoryprotected StringinitiatePayment(@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.REFUNDtransactions.reverseAuthorize(@NonNull Map<String, Object> bodyParams, String currencyCode, String applicationId, String tenantId) Executes theDefaultTransactionTypes.REVERSE_AUTHtransactions.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:MyFatoorahProviderThis method is responsible for making call to init-session end-point of MyFatoorah.- Specified by:
initiateSessionin 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:MyFatoorahProviderExecutes theDefaultTransactionTypes.AUTHORIZEtransactions.- Specified by:
executePaymentin 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:MyFatoorahProviderGathers the status of a MyFatoorah payment based upon the invoiceId or paymentId- Specified by:
getPaymentStatusin 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:MyFatoorahProviderExecutes theDefaultTransactionTypes.REVERSE_AUTHtransactions.- Specified by:
reverseAuthorizein 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:MyFatoorahProviderExecutes theDefaultTransactionTypes.CAPTUREtransactions.- Specified by:
capturein 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:MyFatoorahProviderExecutes theDefaultTransactionTypes.REFUNDtransactions.- Specified by:
refundin 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:MyFatoorahProviderGathers the status of a MyFatoorah refund by id- Specified by:
getRefundStatusin 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:MyFatoorahProviderThis method is responsible for making call to init-payment end-point of MyFatoorah.- Specified by:
initiatePaymentin 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()
-