Interface StripeWebhookEventService

All Known Implementing Classes:
DefaultStripeWebhookEventService

public interface StripeWebhookEventService
This service is responsible to validate and deserialize the Stripe webhook events.
Author:
Dima Myroniuk (dmyroniuk)
  • Method Summary

    Modifier and Type
    Method
    Description
    default com.stripe.model.Event
    constructEvent(org.springframework.http.HttpHeaders headers, String requestBody, Map<String,String> parameters)
    Deserializes the request body to the Event.
    void
    validateEvent(org.springframework.http.HttpHeaders headers, String requestBody, Map<String,String> parameters)
    Validates the webhook event and signature.
  • Method Details

    • validateEvent

      void validateEvent(org.springframework.http.HttpHeaders headers, String requestBody, Map<String,String> parameters)
      Validates the webhook event and signature.
      Parameters:
      headers - The webhook request headers
      requestBody - The webhook raw request body in the form of a String
      parameters - The request parameters passed into the webhook
      Throws:
      com.broadleafcommerce.paymentgateway.service.exception.InvalidWebhookRequestException - if the request is invalid
      com.broadleafcommerce.paymentgateway.service.exception.WebhookValidationException - if the validation of the webhook request failed due to any internal errors, e.g. the webhook endpoint secret is missing
    • constructEvent

      default com.stripe.model.Event constructEvent(org.springframework.http.HttpHeaders headers, String requestBody, Map<String,String> parameters)
      Deserializes the request body to the Event.

      NOTE: this method doesn't validate the request body. Make sure the request body was validated by validateEvent(HttpHeaders, String, Map) before this method.

      Parameters:
      headers - The webhook request headers
      requestBody - The webhook raw request body in the form of a String
      parameters - The request parameters passed into the webhook
      Returns:
      the deserialized Event