From 944eaeed7afd6a05ca47f086ebf393f287344bf1 Mon Sep 17 00:00:00 2001 From: mkiran Date: Mon, 27 Oct 2025 15:32:41 +0530 Subject: [PATCH 1/3] Support for new payload of Webhooks --- src/WebhooksService/WebhooksCloudEvent.php | 269 +++++++++++++++++++++ src/WebhooksService/WebhooksService.php | 26 ++ 2 files changed, 295 insertions(+) create mode 100644 src/WebhooksService/WebhooksCloudEvent.php diff --git a/src/WebhooksService/WebhooksCloudEvent.php b/src/WebhooksService/WebhooksCloudEvent.php new file mode 100644 index 00000000..d62f745c --- /dev/null +++ b/src/WebhooksService/WebhooksCloudEvent.php @@ -0,0 +1,269 @@ +specversion; + } + + /** + * Set the CloudEvents specification version + * + * @param string $specversion + * @return $this + */ + public function setSpecversion($specversion) + { + $this->specversion = $specversion; + return $this; + } + + /** + * Get the event ID + * + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Set the event ID + * + * @param string $id + * @return $this + */ + public function setId($id) + { + $this->id = $id; + return $this; + } + + /** + * Get the event source + * + * @return string + */ + public function getSource() + { + return $this->source; + } + + /** + * Set the event source + * + * @param string $source + * @return $this + */ + public function setSource($source) + { + $this->source = $source; + return $this; + } + + /** + * Get the event type + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set the event type + * + * @param string $type + * @return $this + */ + public function setType($type) + { + $this->type = $type; + return $this; + } + + /** + * Get the data content type + * + * @return string + */ + public function getDatacontenttype() + { + return $this->datacontenttype; + } + + /** + * Set the data content type + * + * @param string $datacontenttype + * @return $this + */ + public function setDatacontenttype($datacontenttype) + { + $this->datacontenttype = $datacontenttype; + return $this; + } + + /** + * Get the event timestamp + * + * @return string + */ + public function getTime() + { + return $this->time; + } + + /** + * Set the event timestamp + * + * @param string $time + * @return $this + */ + public function setTime($time) + { + $this->time = $time; + return $this; + } + + /** + * Get the Intuit entity ID + * + * @return string + */ + public function getIntuitentityid() + { + return $this->intuitentityid; + } + + /** + * Set the Intuit entity ID + * + * @param string $intuitentityid + * @return $this + */ + public function setIntuitentityid($intuitentityid) + { + $this->intuitentityid = $intuitentityid; + return $this; + } + + /** + * Get the Intuit account ID + * + * @return string + */ + public function getIntuitaccountid() + { + return $this->intuitaccountid; + } + + /** + * Set the Intuit account ID + * + * @param string $intuitaccountid + * @return $this + */ + public function setIntuitaccountid($intuitaccountid) + { + $this->intuitaccountid = $intuitaccountid; + return $this; + } + + /** + * Get the event data payload + * + * @return array + */ + public function getData() + { + return $this->data; + } + + /** + * Set the event data payload + * + * @param array $data + * @return $this + */ + public function setData($data) + { + $this->data = $data; + return $this; + } +} diff --git a/src/WebhooksService/WebhooksService.php b/src/WebhooksService/WebhooksService.php index 225c2a82..cbe1df7e 100644 --- a/src/WebhooksService/WebhooksService.php +++ b/src/WebhooksService/WebhooksService.php @@ -8,6 +8,7 @@ class WebhooksService { const WEBHOOKSWRAPPERNAME = "WebhooksEvent"; + const WEBHOOKSCLOUDEVENTSWRAPPERNAME = "WebhooksCloudEvent"; /** * Convert the payLoad of webhook to object @@ -26,6 +27,31 @@ public static function getWebhooksEvent($payLoad) return $obj; } + /** + * Deserialize new CloudEvents-based webhook payloads which are arrays of events + * PR parity: method name uses getWebhooksCloudEvents (typo preserved) + * + * @param $payLoad + * JSON array payload + * @return array + * Array of WebhooksCloudEvent objects + * + */ + public static function getWebhooksCloudEvents($payLoad) + { + JsonValidator::validate($payLoad); + $string_arry = json_decode($payLoad, true); + + $result = array(); + foreach ($string_arry as $eventData) { + $obj = ReflectionUtil::constructObjectFromWebhooksArray($eventData, WebhooksService::WEBHOOKSCLOUDEVENTSWRAPPERNAME); + if ($obj !== null) { + $result[] = $obj; + } + } + return $result; + } + /** * use Token to verifier the payload is sent from Intuit * From e16595efa9eadf55aaf6fe5372eb2eea06f6b9f4 Mon Sep 17 00:00:00 2001 From: mkiran Date: Mon, 3 Nov 2025 10:18:10 +0530 Subject: [PATCH 2/3] Refactor WebhooksCloudEvent properties and methods for consistency --- src/WebhooksService/WebhooksCloudEvent.php | 48 +++++++++++----------- src/WebhooksService/WebhooksService.php | 5 +-- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/WebhooksService/WebhooksCloudEvent.php b/src/WebhooksService/WebhooksCloudEvent.php index d62f745c..7157019b 100644 --- a/src/WebhooksService/WebhooksCloudEvent.php +++ b/src/WebhooksService/WebhooksCloudEvent.php @@ -11,7 +11,7 @@ class WebhooksCloudEvent * * @var string */ - private $specversion; + private $specVersion; /** * Unique identifier for the event @@ -39,7 +39,7 @@ class WebhooksCloudEvent * * @var string */ - private $datacontenttype; + private $dataContentType; /** * The timestamp of the event @@ -53,14 +53,14 @@ class WebhooksCloudEvent * * @var string */ - private $intuitentityid; + private $intuitEntityId; /** * Intuit account ID * * @var string */ - private $intuitaccountid; + private $intuitAccountId; /** * The event data payload @@ -74,20 +74,20 @@ class WebhooksCloudEvent * * @return string */ - public function getSpecversion() + public function getSpecVersion() { - return $this->specversion; + return $this->specVersion; } /** * Set the CloudEvents specification version * - * @param string $specversion + * @param string $specVersion * @return $this */ - public function setSpecversion($specversion) + public function setSpecVersion($specVersion) { - $this->specversion = $specversion; + $this->specVersion = $specVersion; return $this; } @@ -162,20 +162,20 @@ public function setType($type) * * @return string */ - public function getDatacontenttype() + public function getDataContentType() { - return $this->datacontenttype; + return $this->dataContentType; } /** * Set the data content type * - * @param string $datacontenttype + * @param string $dataContentType * @return $this */ - public function setDatacontenttype($datacontenttype) + public function setDataContentType($dataContentType) { - $this->datacontenttype = $datacontenttype; + $this->dataContentType = $dataContentType; return $this; } @@ -206,20 +206,20 @@ public function setTime($time) * * @return string */ - public function getIntuitentityid() + public function getIntuitEntityId() { - return $this->intuitentityid; + return $this->intuitEntityId; } /** * Set the Intuit entity ID * - * @param string $intuitentityid + * @param string $intuitEntityId * @return $this */ - public function setIntuitentityid($intuitentityid) + public function setIntuitEntityId($intuitEntityId) { - $this->intuitentityid = $intuitentityid; + $this->intuitEntityId = $intuitEntityId; return $this; } @@ -228,20 +228,20 @@ public function setIntuitentityid($intuitentityid) * * @return string */ - public function getIntuitaccountid() + public function getIntuitAccountId() { - return $this->intuitaccountid; + return $this->intuitAccountId; } /** * Set the Intuit account ID * - * @param string $intuitaccountid + * @param string $intuitAccountId * @return $this */ - public function setIntuitaccountid($intuitaccountid) + public function setIntuitAccountId($intuitAccountId) { - $this->intuitaccountid = $intuitaccountid; + $this->intuitAccountId = $intuitAccountId; return $this; } diff --git a/src/WebhooksService/WebhooksService.php b/src/WebhooksService/WebhooksService.php index cbe1df7e..5ad45d4c 100644 --- a/src/WebhooksService/WebhooksService.php +++ b/src/WebhooksService/WebhooksService.php @@ -28,11 +28,10 @@ public static function getWebhooksEvent($payLoad) } /** - * Deserialize new CloudEvents-based webhook payloads which are arrays of events - * PR parity: method name uses getWebhooksCloudEvents (typo preserved) + * Convert the CloudEvents payLoad of webhook to array of objects * * @param $payLoad - * JSON array payload + * The CloudEvents payload to be converted * @return array * Array of WebhooksCloudEvent objects * From b76ce74578f99eda797e79f7064c0241af1f791a Mon Sep 17 00:00:00 2001 From: mkiran Date: Fri, 7 Nov 2025 12:24:47 +0530 Subject: [PATCH 3/3] Update USERAGENT to version 6.2.2 and add PDF upload testing documentation --- src/Core/CoreConstants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/CoreConstants.php b/src/Core/CoreConstants.php index 185817b1..be66e452 100644 --- a/src/Core/CoreConstants.php +++ b/src/Core/CoreConstants.php @@ -297,7 +297,7 @@ class CoreConstants * The Request source header value. * @var string REQUESTSOURCEHEADER */ - const USERAGENT = "V3PHPSDK6.2.1"; + const USERAGENT = "V3PHPSDK6.2.2"; public static function getType($string, $return=1) {