Class DefaultCheckoutComGatewayWebhookHandler

    • Constructor Detail

      • DefaultCheckoutComGatewayWebhookHandler

        public DefaultCheckoutComGatewayWebhookHandler​(WebhookSignatureUtil signatureUtil,
                                                       com.fasterxml.jackson.databind.ObjectMapper objectMapper,
                                                       com.broadleafcommerce.common.extension.TypeFactory typeFactory)
    • Method Detail

      • validate

        public void validate​(org.springframework.http.HttpHeaders headers,
                             String rawRequestBody)
                      throws com.broadleafcommerce.paymentgateway.service.exception.WebhookValidationException
        Specified by:
        validate in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
        Throws:
        com.broadleafcommerce.paymentgateway.service.exception.WebhookValidationException
      • 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)
        Specified by:
        convertToPaymentResponse in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
      • getGatewayType

        public String getGatewayType()
        Specified by:
        getGatewayType in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
      • 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
      • getObjectMapper

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

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