Class MyFatoorahReverseAuthorizeRequestResponseTransformer
java.lang.Object
com.broadleafcommerce.myfatoorah.service.requestresponse.AbstractRequestResponseTransformer
com.broadleafcommerce.myfatoorah.service.requestresponse.MyFatoorahReverseAuthorizeRequestResponseTransformer
- All Implemented Interfaces:
RequestResponseTransformer
public class MyFatoorahReverseAuthorizeRequestResponseTransformer
extends AbstractRequestResponseTransformer
The transformer for
DefaultTransactionTypes.REVERSE_AUTH
transaction type.- Author:
- Dima Myroniuk (dmyroniuk)
-
Constructor Summary
ConstructorDescriptionMyFatoorahReverseAuthorizeRequestResponseTransformer
(MyFatoorahConfigurationProperties configProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Build the gateway transaction id using the payment id & track id, instead of usingMyFatoorahResponse.InvoiceTransaction.getTransactionId()
due to this field not being present in the webhook payload.boolean
Checks if this transformer can handle the specified transaction type.createMyFatoorahRequest
(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest) Creates the MyFatoorah request body based onMyFatoorahPaymentRequest
.protected String
getReverseAuthTransactionTotal
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected javax.money.MonetaryAmount
getTransactionAmount
(MyFatoorahResponse.InvoiceTransaction invoiceTransactions, @NonNull String currencyCode) protected com.broadleafcommerce.common.extension.TypeFactory
protected MyFatoorahResponse.InvoiceTransaction
identifyLatestTransaction
(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, @NonNull MyFatoorahResponse myFatoorahResponse) protected boolean
isReverseAuthorized
(MyFatoorahResponse.InvoiceTransaction transaction) 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 com.broadleafcommerce.paymentgateway.domain.PaymentResponse
populatePaymentResponse
(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull MyFatoorahResponse myFatoorahResponse, MyFatoorahResponse.InvoiceTransaction transaction) protected void
populateResponseMap
(MyFatoorahResponse.InvoiceTransaction latestTransaction, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) Methods inherited from class com.broadleafcommerce.myfatoorah.service.requestresponse.AbstractRequestResponseTransformer
getConfigProperties, getCurrencyCode, getGatewayResponseCode, getInvoiceAmount, getObjectMapper, identifyFailureType, identifyLatestTransaction, putIfNotBlank
-
Constructor Details
-
MyFatoorahReverseAuthorizeRequestResponseTransformer
public MyFatoorahReverseAuthorizeRequestResponseTransformer(MyFatoorahConfigurationProperties configProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
canHandle
Description copied from interface:RequestResponseTransformer
Checks if this transformer can handle the specified transaction type.- Parameters:
transactionType
- the transaction type of the request- Returns:
- true if this transformer can be used for the specified request
-
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
- Overrides:
createMyFatoorahRequest
in classAbstractRequestResponseTransformer
- 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
- Overrides:
populatePaymentResponse
in classAbstractRequestResponseTransformer
- Parameters:
myFatoorahPaymentRequest
- the myFatoorah payment requestpaymentResponse
- the payment response to populatemyFatoorahResponse
- the response from MyFatoorah API- Returns:
- the populated payment response
-
populatePaymentResponse
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse populatePaymentResponse(@NonNull @NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull MyFatoorahResponse myFatoorahResponse, @NonNull MyFatoorahResponse.InvoiceTransaction transaction) -
getReverseAuthTransactionTotal
protected String getReverseAuthTransactionTotal(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
identifyLatestTransaction
protected MyFatoorahResponse.InvoiceTransaction identifyLatestTransaction(@NonNull @NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, @NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
isReverseAuthorized
-
buildGatewayTransactionId
protected String buildGatewayTransactionId(@NonNull MyFatoorahResponse.InvoiceTransaction transaction) Build the gateway transaction id using the payment id & track id, instead of usingMyFatoorahResponse.InvoiceTransaction.getTransactionId()
due to this field not being present in the webhook payload.- Parameters:
transaction
- The transaction results- Returns:
- The gateway transaction id based on the payment id & track id
-
getTransactionAmount
@Nullable protected javax.money.MonetaryAmount getTransactionAmount(@NonNull MyFatoorahResponse.InvoiceTransaction invoiceTransactions, @NonNull @NonNull String currencyCode) - Overrides:
getTransactionAmount
in classAbstractRequestResponseTransformer
-
populateResponseMap
protected void populateResponseMap(@NonNull MyFatoorahResponse.InvoiceTransaction latestTransaction, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-