Class DefaultCheckoutComGatewayWebhookHandler

java.lang.Object
com.broadleafcommerce.payment.service.gateway.webhooks.DefaultCheckoutComGatewayWebhookHandler
All Implemented Interfaces:
CheckoutComGatewayWebhookHandler, com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware, com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler

public class DefaultCheckoutComGatewayWebhookHandler extends Object implements CheckoutComGatewayWebhookHandler
  • Field Details

  • Constructor Details

    • DefaultCheckoutComGatewayWebhookHandler

      public DefaultCheckoutComGatewayWebhookHandler(WebhookSignatureUtil signatureUtil, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • 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 interface com.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 interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
    • getSupportedWebhookNotificationTypes

      public List<String> getSupportedWebhookNotificationTypes()
      Specified by:
      getSupportedWebhookNotificationTypes in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
    • getGatewayType

      public String getGatewayType()
      Specified by:
      getGatewayType in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
    • convertRequestBody

      protected CheckoutComWebhookResponse convertRequestBody(String rawRequestBody)
    • getTransactionIdentifier

      protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier getTransactionIdentifier(CheckoutComWebhookResponse webhookResponse)
      Builds a TransactionIdentifier based on the transactionReferenceId & tenantId values gathered from the provided CheckoutComWebhookResponse.
      Parameters:
      webhookResponse - The webhook transaction result payload
      Returns:
      A TransactionIdentifier based on the transactionReferenceId & tenantId values gathered from the CheckoutComWebhookResponse
    • convertToPaymentResponse

      protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse convertToPaymentResponse(@NonNull @NonNull CheckoutComWebhookResponse webhookResponse, @NonNull @NonNull String requestBody)
    • isSignatureValid

      protected boolean isSignatureValid(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String rawRequestBody)
      Determines whether the CKO-Signature header is valid by building a hash of the request body, leveraging the secret API key as the hash key.
      Parameters:
      headers - The webhook request headers
      rawRequestBody - The raw webhook request body, in the form of a String
      Returns:
      whether the CKO-Signature header is valid
    • getApplicationId

      protected String getApplicationId(@NonNull @NonNull CheckoutComWebhookResponse webhookResponse)
    • getTenantId

      protected String getTenantId(@NonNull @NonNull CheckoutComWebhookResponse webhookResponse)
    • getSignatureUtil

      protected WebhookSignatureUtil getSignatureUtil()
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()