Class DefaultMyFatoorahGatewayWebhookHandler
java.lang.Object
com.broadleafcommerce.myfatoorah.service.webhook.DefaultMyFatoorahGatewayWebhookHandler
- All Implemented Interfaces:
MyFatoorahGatewayWebhookHandler
,com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
,com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
public class DefaultMyFatoorahGatewayWebhookHandler
extends Object
implements MyFatoorahGatewayWebhookHandler
- Author:
- Divyank Chavan.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultMyFatoorahGatewayWebhookHandler
(MyFatoorahConfigurationProperties configurationProperties, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper, MyFatoorahProvider myFatoorahProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildRefundStatusChangedResponse
(@NonNull MyFatoorahWebhookRequest webhookRequest, @NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected void
buildResponseMapForRefundStatusChangedEvent
(MyFatoorahWebhookRequest.Data data, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) protected void
buildResponseMapForTransactionStatusChangedEvent
(MyFatoorahWebhookRequest.Data data, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier
buildTransactionIdentifier
(@NonNull String gatewayTransactionId, String tenantId) protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildTransactionStatusChangedResponse
(@NonNull MyFatoorahWebhookRequest webhookRequest, @NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected String
calculateSignature
(@NonNull String webhookEndpointSecret, @NonNull String params) protected MyFatoorahWebhookRequest
constructEvent
(@NonNull String requestBody) org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> convertToPaymentResponse
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected String
getApplicationId
(@NonNull Map<String, String> parameters) protected MyFatoorahConfigurationProperties
getEventId
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected MyFatoorahProvider
protected com.fasterxml.jackson.databind.ObjectMapper
protected String
getPaymentId
(@NonNull MyFatoorahWebhookRequest.Data data) protected String
getTenantId
(@NonNull Map<String, String> parameters) protected javax.money.MonetaryAmount
getTransactionAmount
(@NonNull String amount, @NonNull String currencyCode) protected com.broadleafcommerce.common.extension.TypeFactory
protected String
identifyFailureType
(String reasonCode, String gatewayTransactionId) protected MyFatoorahResponse.InvoiceTransaction
identifyLatestTransaction
(@NonNull MyFatoorahResponse myFatoorahResponse) protected boolean
isNull
(com.fasterxml.jackson.databind.JsonNode jsonNode) protected boolean
protected boolean
protected void
boolean
shouldHandleRequest
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) sortDataPropertiesFromEvent
(@NonNull String requestBody) void
validate
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected MyFatoorahWebhookRequest
validateAndConstructEvent
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected boolean
validateSignature
(@NonNull String requestBody, @NonNull String sigHeader, String webhookEndpointSecret) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
buildFailedWebhookResponse, buildSuccessfulWebhookResponse, convertToPaymentResponse, shouldHandleRequest, validate
-
Field Details
-
MYFATOORAH_SIGNATURE_HEADER
- See Also:
-
-
Constructor Details
-
DefaultMyFatoorahGatewayWebhookHandler
public DefaultMyFatoorahGatewayWebhookHandler(MyFatoorahConfigurationProperties configurationProperties, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper, MyFatoorahProvider myFatoorahProvider)
-
-
Method Details
-
validate
public void validate(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String, String> parameters) - Specified by:
validate
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
-
shouldHandleRequest
public boolean shouldHandleRequest(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String, String> parameters) - Specified by:
shouldHandleRequest
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
-
convertToPaymentResponse
public org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> convertToPaymentResponse(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String, String> parameters) - Specified by:
convertToPaymentResponse
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
-
getEventId
public String getEventId(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String, String> parameters) - Specified by:
getEventId
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
-
getSupportedWebhookNotificationTypes
- Specified by:
getSupportedWebhookNotificationTypes
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
-
getGatewayType
- Specified by:
getGatewayType
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
-
validateAndConstructEvent
protected MyFatoorahWebhookRequest validateAndConstructEvent(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String, String> parameters) -
validateSignature
-
sortDataPropertiesFromEvent
-
isNull
protected boolean isNull(com.fasterxml.jackson.databind.JsonNode jsonNode) -
calculateSignature
-
constructEvent
-
buildTransactionStatusChangedResponse
protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildTransactionStatusChangedResponse(@NonNull @NonNull MyFatoorahWebhookRequest webhookRequest, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String, String> parameters) -
buildGatewayTransactionId
-
buildRefundStatusChangedResponse
protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildRefundStatusChangedResponse(@NonNull @NonNull MyFatoorahWebhookRequest webhookRequest, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String, String> parameters) -
getTransactionAmount
-
buildResponseMapForRefundStatusChangedEvent
protected void buildResponseMapForRefundStatusChangedEvent(@NonNull MyFatoorahWebhookRequest.Data data, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) -
buildResponseMapForTransactionStatusChangedEvent
protected void buildResponseMapForTransactionStatusChangedEvent(@NonNull MyFatoorahWebhookRequest.Data data, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) -
putIfNotBlank
-
buildTransactionIdentifier
-
identifyLatestTransaction
protected MyFatoorahResponse.InvoiceTransaction identifyLatestTransaction(@NonNull @NonNull MyFatoorahResponse myFatoorahResponse) -
getPaymentId
-
identifyFailureType
-
isSuccessful
-
isRefunded
-
getSupportedEventTypes
-
getApplicationId
-
getTenantId
-
getConfigurationProperties
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getMyFatoorahProvider
-