From 5afd124b5ff079051d6e79216610175a8ce4f466 Mon Sep 17 00:00:00 2001 From: joHNkHaNsrc Date: Tue, 1 Mar 2022 12:03:16 +0100 Subject: [PATCH] fix: Iaphub test payload --- src/Controller/IaphubWebhookEntrypointController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Controller/IaphubWebhookEntrypointController.php b/src/Controller/IaphubWebhookEntrypointController.php index a5a637c..5f38eed 100755 --- a/src/Controller/IaphubWebhookEntrypointController.php +++ b/src/Controller/IaphubWebhookEntrypointController.php @@ -56,12 +56,13 @@ public function index(Request $request): JsonResponse return $this->json([], Response::HTTP_UNAUTHORIZED); } - if (!$request->getContent()) { + $payload = json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR); + + if ('test' === $payload['type']) { // When add webhook url on Iaphub configuration, Iaphub should verify URL. return $this->json([]); } - $payload = json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR); $webhook = $this->webhookFactory::build($payload); switch ($webhook->getType()) {