Class MyFatoorahAuthorizeAndCaptureRequestResponseTransformer
java.lang.Object
com.broadleafcommerce.myfatoorah.service.requestresponse.AbstractRequestResponseTransformer
com.broadleafcommerce.myfatoorah.service.requestresponse.MyFatoorahAuthorizeAndCaptureRequestResponseTransformer
- All Implemented Interfaces:
RequestResponseTransformer
public class MyFatoorahAuthorizeAndCaptureRequestResponseTransformer
extends AbstractRequestResponseTransformer
The transformer for
DefaultTransactionTypes.AUTHORIZE
transaction type.- Author:
- Dima Myroniuk (dmyroniuk)
-
Constructor Summary
ConstructorDescriptionMyFatoorahAuthorizeAndCaptureRequestResponseTransformer
(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.protected String
buildUserDefinedField
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) boolean
Checks if this transformer can handle the specified transaction type.createMyFatoorahRequest
(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest) Creates the MyFatoorah request body based onMyFatoorahPaymentRequest
.protected String
get3DSVerificationUrl
(@NonNull MyFatoorahResponse myFatoorahResponse) protected String
getCallBackUrl
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected String
getCurrency
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected String
Get the invoice currency by splitting invoiceDisplayValue property.protected String
getErrorUrl
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected String
getLanguage
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected String
getPaymentMethodId
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected com.broadleafcommerce.paymentgateway.domain.NextAction
getPaymentUrl
(@NonNull MyFatoorahResponse myFatoorahResponse) protected String
getSessionId
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) protected com.broadleafcommerce.common.extension.TypeFactory
protected boolean
isSuccessful
(MyFatoorahResponse.InvoiceTransaction transaction) protected boolean
protected void
populateCustomerDetails
(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, Map<String, Object> request) 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 com.broadleafcommerce.paymentgateway.domain.PaymentResponse
populatePaymentResponseForKNET
(@NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull MyFatoorahResponse myFatoorahResponse) protected void
populateResponseMap
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull MyFatoorahResponse myFatoorahResponse, MyFatoorahResponse.InvoiceTransaction latestTransaction) protected void
populateResponseMapForKNET
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull MyFatoorahResponse myFatoorahResponse) protected boolean
Methods inherited from class com.broadleafcommerce.myfatoorah.service.requestresponse.AbstractRequestResponseTransformer
getConfigProperties, getCurrencyCode, getGatewayResponseCode, getInvoiceAmount, getObjectMapper, getTransactionAmount, identifyFailureType, identifyLatestTransaction, putIfNotBlank
-
Constructor Details
-
MyFatoorahAuthorizeAndCaptureRequestResponseTransformer
public MyFatoorahAuthorizeAndCaptureRequestResponseTransformer(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
-
getSessionId
@Nullable protected String getSessionId(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
getPaymentMethodId
@Nullable protected String getPaymentMethodId(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
getCallBackUrl
@Nullable protected String getCallBackUrl(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
getErrorUrl
@Nullable protected String getErrorUrl(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
getCurrency
protected String getCurrency(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
getLanguage
protected String getLanguage(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
populateCustomerDetails
protected void populateCustomerDetails(@NonNull @NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, Map<String, Object> request) -
buildUserDefinedField
@Nullable protected String buildUserDefinedField(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest) -
populatePaymentResponseForKNET
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse populatePaymentResponseForKNET(@NonNull @NonNull MyFatoorahPaymentRequest myFatoorahPaymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
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) -
isSuccessful
-
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
-
requires3DSVerification
-
isTransactionStatusInProgress
-
getPaymentUrl
@Nullable protected com.broadleafcommerce.paymentgateway.domain.NextAction getPaymentUrl(@NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
getCurrencyFromInvoice
Get the invoice currency by splitting invoiceDisplayValue property.- Parameters:
data
-- Returns:
- the currency from invoiceDisplayValue property.
-
get3DSVerificationUrl
@Nullable protected String get3DSVerificationUrl(@NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
populateResponseMap
protected void populateResponseMap(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull MyFatoorahResponse myFatoorahResponse, @NonNull MyFatoorahResponse.InvoiceTransaction latestTransaction) -
populateResponseMapForKNET
protected void populateResponseMapForKNET(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-