Class AbstractRequestResponseTransformer
java.lang.Object
com.broadleafcommerce.myfatoorah.service.requestresponse.AbstractRequestResponseTransformer
- All Implemented Interfaces:
RequestResponseTransformer
- Direct Known Subclasses:
MyFatoorahAuthorizeAndCaptureRequestResponseTransformer
,MyFatoorahAuthorizeRequestResponseTransformer
,MyFatoorahCaptureRequestResponseTransformer
,MyFatoorahRefundRequestResponseTransformer
,MyFatoorahReverseAuthorizeRequestResponseTransformer
public abstract class AbstractRequestResponseTransformer
extends Object
implements RequestResponseTransformer
An abstract class that creates the MyFatoorah request and populates the response with the common
parameters.
- Author:
- Dima Myroniuk (dmyroniuk)
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractRequestResponseTransformer
(MyFatoorahConfigurationProperties configProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptioncreateMyFatoorahRequest
(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest) Creates the MyFatoorah request body based onMyFatoorahPaymentRequest
.protected MyFatoorahConfigurationProperties
protected String
getCurrencyCode
(String currencyDisplayValue) protected String
getGatewayResponseCode
(MyFatoorahResponse.InvoiceTransaction invoiceTransaction) protected javax.money.MonetaryAmount
getInvoiceAmount
(MyFatoorahResponse.Data data, @NonNull String currencyCode) protected com.fasterxml.jackson.databind.ObjectMapper
protected javax.money.MonetaryAmount
getTransactionAmount
(MyFatoorahResponse.InvoiceTransaction transaction, @NonNull String currencyCode) protected String
identifyFailureType
(String reasonCode, String transactionReferenceId) protected MyFatoorahResponse.InvoiceTransaction
identifyLatestTransaction
(@NonNull MyFatoorahResponse myFatoorahResponse) com.broadleafcommerce.paymentgateway.domain.PaymentResponse
populatePaymentResponse
(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull MyFatoorahResponse myFatoorahResponse) Populates the payment response based on the response from the MyFatoorah API.protected 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.myfatoorah.service.requestresponse.RequestResponseTransformer
canHandle
-
Constructor Details
-
AbstractRequestResponseTransformer
protected AbstractRequestResponseTransformer(MyFatoorahConfigurationProperties configProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
createMyFatoorahRequest
public Map<String,Object> createMyFatoorahRequest(@NonNull @NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest) Description copied from interface:RequestResponseTransformer
Creates the MyFatoorah request body based onMyFatoorahPaymentRequest
.- Specified by:
createMyFatoorahRequest
in interfaceRequestResponseTransformer
- Parameters:
myFatoorahPaymentRequest
- the myFatoorah payment request- Returns:
- the MyFatoorah request body
-
populatePaymentResponse
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse populatePaymentResponse(@NonNull @NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull MyFatoorahResponse myFatoorahResponse) Description copied from interface:RequestResponseTransformer
Populates the payment response based on the response from the MyFatoorah API.- Specified by:
populatePaymentResponse
in interfaceRequestResponseTransformer
- Parameters:
myFatoorahPaymentRequest
- the myFatoorah payment requestpaymentResponse
- the payment response to populatemyFatoorahResponse
- the response from MyFatoorah API- Returns:
- the populated payment response
-
identifyLatestTransaction
protected MyFatoorahResponse.InvoiceTransaction identifyLatestTransaction(@NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
getGatewayResponseCode
-
identifyFailureType
-
getCurrencyCode
-
getTransactionAmount
@Nullable protected javax.money.MonetaryAmount getTransactionAmount(@NonNull MyFatoorahResponse.InvoiceTransaction transaction, @NonNull @NonNull String currencyCode) -
getInvoiceAmount
protected javax.money.MonetaryAmount getInvoiceAmount(@NonNull MyFatoorahResponse.Data data, @NonNull @NonNull String currencyCode) -
putIfNotBlank
-
getConfigProperties
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-