From 0429b4bbf2aaaef1543afc575368ad1dd2019cc8 Mon Sep 17 00:00:00 2001 From: smishra45 Date: Thu, 23 Oct 2025 14:34:22 +0530 Subject: [PATCH] Support for new Webhooks payload --- src/WebhooksService/WebhooksCloudEvents.php | 35 +++++++++++++++++++++ src/WebhooksService/WebhooksService.php | 12 +++++++ 2 files changed, 47 insertions(+) create mode 100644 src/WebhooksService/WebhooksCloudEvents.php diff --git a/src/WebhooksService/WebhooksCloudEvents.php b/src/WebhooksService/WebhooksCloudEvents.php new file mode 100644 index 00000000..a26dfaba --- /dev/null +++ b/src/WebhooksService/WebhooksCloudEvents.php @@ -0,0 +1,35 @@ +SpecVersion = isset($data["SpecVersion"]) ? $data["SpecVersion"] : null; + $this->Id = isset($data["Id"]) ? $data["Id"] : null; + $this->Source = isset($data["Source"]) ? $data["Source"] : null; + $this->Type = isset($data["Type"]) ? $data["Type"] : null; + $this->DataContentType = isset($data["DataContentType"]) ? $data["DataContentType"] : null; + $this->Time = isset($data["Time"]) ? $data["Time"] : null; + $this->IntuitEntityId = isset($data["IntuitEntityId"]) ? $data["IntuitEntityId"] : null; + $this->IntuitAccountId = isset($data["IntuitAccountId"]) ? $data["IntuitAccountId"] : null; + $this->Data = isset($data["Data"]) ? $data["Data"] : null; + + + } + } + + + +} \ No newline at end of file diff --git a/src/WebhooksService/WebhooksService.php b/src/WebhooksService/WebhooksService.php index 225c2a82..9b09e6dd 100644 --- a/src/WebhooksService/WebhooksService.php +++ b/src/WebhooksService/WebhooksService.php @@ -2,6 +2,7 @@ namespace QuickBooksOnline\API\WebhooksService; + use QuickBooksOnline\API\Utility\JsonValidator; use QuickBooksOnline\API\Utility\ReflectionUtil; @@ -43,4 +44,15 @@ public static function verifyPayload($token, $payload, $intuitHeaderSignature) $verifier = new TokenVerifier($token); return $verifier->verifyPayLoad($payload, $intuitHeaderSignature); } + + /// + /// Executes a Deserialization operation for Webhooks Events payload + /// + /// Returns a WebhooksEvent object. + + public static function WebhooksCloudEvents($payload) + { + $WebhooksCloudEvents = json_decode($payload, true); + return $WebhooksCloudEvents; + } }