diff --git a/README.md b/README.md index bf48867..ab77767 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ protected $except = [ ## Usage -With the installation out of the way, let's take a look at how this package handles webhooks. First, it will verify if the signature of the request is valid. If it is not, we'll throw an exception and fire off the `InvalidSignatureEvent` event. Requests with invalid signatures will not be stored in the database. +With the installation out of the way, let's take a look at how this package handles webhooks. First, it will verify if the signature of the request is valid. If it is not, we'll throw an exception and fire off the `InvalidWebhookSignatureEvent` event. Requests with invalid signatures will not be stored in the database. Next, the request will be passed to a webhook profile. A webhook profile is a class that determines if a request should be stored and processed by your app. It allows you to filter out webhook requests that are of interest to your app. You can easily create [your own webhook profile](#determining-which-webhook-requests-should-be-stored-and-processed). diff --git a/UPGRADING.md b/UPGRADING.md index 6c8304d..20647aa 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -50,3 +50,5 @@ class AddColumnsToWebhookCalls extends Migration - the `Spatie\WebhookClient\Events\InvalidSignature` event has been renamed to `Spatie\WebhookClient\Events\InvalidWebhookSignatureEvent` - the `Spatie\WebhookClient\ProcessWebhookJob` job has been moved to `Spatie\WebhookClient\Jobs\ProcessWebhookJob` + +- the `Spatie\WebhookClient\Events\InvalidWebhookSignatureEvent` event get the `Spatie\WebhookClient\WebhookConfig` as parameter diff --git a/src/Events/InvalidWebhookSignatureEvent.php b/src/Events/InvalidWebhookSignatureEvent.php index b117de4..4fadb3c 100644 --- a/src/Events/InvalidWebhookSignatureEvent.php +++ b/src/Events/InvalidWebhookSignatureEvent.php @@ -3,11 +3,13 @@ namespace Spatie\WebhookClient\Events; use Illuminate\Http\Request; +use Spatie\WebhookClient\WebhookConfig; class InvalidWebhookSignatureEvent { public function __construct( - public Request $request + public Request $request, + public WebhookConfig $config ) { } } diff --git a/src/WebhookProcessor.php b/src/WebhookProcessor.php index 80e3905..ed69abc 100644 --- a/src/WebhookProcessor.php +++ b/src/WebhookProcessor.php @@ -35,7 +35,7 @@ public function process(): Response protected function ensureValidSignature(): self { if (! $this->config->signatureValidator->isValid($this->request, $this->config)) { - event(new InvalidWebhookSignatureEvent($this->request)); + event(new InvalidWebhookSignatureEvent($this->request, $this->config)); throw InvalidWebhookSignature::make(); }