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 TypeMethodDescriptiondefault com.stripe.model.Event
constructEvent
(org.springframework.http.HttpHeaders headers, String requestBody, Map<String, String> parameters) Deserializes the request body to theEvent
.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 headersrequestBody
- The webhook raw request body in the form of a Stringparameters
- The request parameters passed into the webhook- Throws:
com.broadleafcommerce.paymentgateway.service.exception.InvalidWebhookRequestException
- if the request is invalidcom.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 theEvent
.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 headersrequestBody
- The webhook raw request body in the form of a Stringparameters
- The request parameters passed into the webhook- Returns:
- the deserialized
Event
-