From aff562f664cae97dc5a57bfdca6ab5d7b046417b Mon Sep 17 00:00:00 2001 From: jps Date: Tue, 16 Dec 2025 16:07:06 +0100 Subject: [PATCH] correctifs webhoook --- app/controllers/Webhook_controller.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/Webhook_controller.php b/app/controllers/Webhook_controller.php index b310e6c..7050735 100644 --- a/app/controllers/Webhook_controller.php +++ b/app/controllers/Webhook_controller.php @@ -205,16 +205,18 @@ class PEPPOL_Webhook_controller { * @param array $payload Données complètes du webhook. * @return bool|WP_Error */ - private static function process_webhook_event(string $event, string $document_id, array $payload): bool|WP_Error { + private static function process_webhook_event(string $event, string $document_id, array $payload) { $document_data = $payload['document'] ?? []; // Déterminer le nouveau statut selon l'événement - $new_status = match ($event) { - 'document.sent' => 'sent', - 'document.error' => 'error', - 'document.completed' => 'completed', - default => null, - }; + $new_status = null; + if ($event === 'document.sent') { + $new_status = 'sent'; + } elseif ($event === 'document.error') { + $new_status = 'error'; + } elseif ($event === 'document.completed') { + $new_status = 'completed'; + } if ($new_status === null) { return new WP_Error(