From 596784a8d9eb35bf378f5d5163fef609672946d5 Mon Sep 17 00:00:00 2001 From: Hugo Heneault Date: Mon, 24 Jan 2022 08:02:05 +0100 Subject: [PATCH] Add webhookId to Webhooks --- .gitignore | 1 + src/Contracts/Objects/Values/WebhookId.php | 12 +++++++++++ src/Contracts/WebhookJob.php | 22 +++++++++++++++++++++ src/Messaging/Jobs/AppUninstalledJob.php | 23 +++++++++++++++------- src/Traits/WebhookController.php | 1 + 5 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 src/Contracts/Objects/Values/WebhookId.php create mode 100644 src/Contracts/WebhookJob.php diff --git a/.gitignore b/.gitignore index bf29a8e0..da34317b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ composer.lock .php-cs-fixer.cache .phpunit.result.cache +.idea diff --git a/src/Contracts/Objects/Values/WebhookId.php b/src/Contracts/Objects/Values/WebhookId.php new file mode 100644 index 00000000..89c3f350 --- /dev/null +++ b/src/Contracts/Objects/Values/WebhookId.php @@ -0,0 +1,12 @@ +domain = $domain; $this->data = $data; + $this->webhookId = $webhookId; } /** @@ -62,8 +71,8 @@ public function __construct(string $domain, stdClass $data) * @return bool */ public function handle( - IShopCommand $shopCommand, - IShopQuery $shopQuery, + IShopCommand $shopCommand, + IShopQuery $shopQuery, CancelCurrentPlan $cancelCurrentPlanAction ): bool { // Convert the domain diff --git a/src/Traits/WebhookController.php b/src/Traits/WebhookController.php index 171307f5..28e04b82 100644 --- a/src/Traits/WebhookController.php +++ b/src/Traits/WebhookController.php @@ -28,6 +28,7 @@ public function handle(string $type, Request $request): ResponseResponse $jobClass::dispatch( $request->header('x-shopify-shop-domain'), + $request->header('x-shopify-webhook-id'), $jobData )->onQueue(Util::getShopifyConfig('job_queues')['webhooks']);