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
ConstructorsModifierConstructorDescriptionprotectedAbstractRequestResponseTransformer(MyFatoorahConfigurationProperties configProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptioncreateMyFatoorahRequest(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest) Creates the MyFatoorah request body based onMyFatoorahPaymentRequest.protected MyFatoorahConfigurationPropertiesprotected StringgetCurrencyCode(String currencyDisplayValue) protected StringgetGatewayResponseCode(MyFatoorahResponse.InvoiceTransaction invoiceTransaction) protected javax.money.MonetaryAmountgetInvoiceAmount(MyFatoorahResponse.Data data, @NonNull String currencyCode) protected com.fasterxml.jackson.databind.ObjectMapperprotected StringgetPhoneNumber(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest) Gets the phone number from the customer or from the billing address and removes the phone number format.protected javax.money.MonetaryAmountgetTransactionAmount(MyFatoorahResponse.InvoiceTransaction transaction, @NonNull String currencyCode) protected StringidentifyFailureType(String reasonCode, String transactionReferenceId) protected MyFatoorahResponse.InvoiceTransactionidentifyLatestTransaction(@NonNull MyFatoorahResponse myFatoorahResponse) com.broadleafcommerce.paymentgateway.domain.PaymentResponsepopulatePaymentResponse(@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 voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:RequestResponseTransformerCreates the MyFatoorah request body based onMyFatoorahPaymentRequest.- Specified by:
createMyFatoorahRequestin 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:RequestResponseTransformerPopulates the payment response based on the response from the MyFatoorah API.- Specified by:
populatePaymentResponsein 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
-
getPhoneNumber
@Nullable protected String getPhoneNumber(@NonNull @NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest) Gets the phone number from the customer or from the billing address and removes the phone number format. For example, if the phone number is "+(965)900-000-01" this method will return "96590000001". -
getConfigProperties
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-