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; + } }