You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When registereing a Webhook, the returned data is passed to a new instance of Webhook class, which uses
function applyV1() to add the json data to the object.
This results in the following error:
Fatal error: Uncaught TypeError: Argument 1 passed to Trunkrs\SDK\Util\JsonDateTime::from() must be of the type string, null given
Looking at the returned data, it has the field
'created_at' => '.....',
While the code has
$webhook->createdAt = JsonDateTime::from($json->createdAt);
How to reproduce
$webhook = new \Trunkrs\SDK\Webhook();
$webhook->callbackUrl = "https://domain.name/";
$webhook->sessionHeaderName = 'XXXX';
$webhook->sessionToken = "yyyy";
Description
When registereing a Webhook, the returned data is passed to a new instance of Webhook class, which uses
function applyV1() to add the json data to the object.
This results in the following error:
Fatal error: Uncaught TypeError: Argument 1 passed to Trunkrs\SDK\Util\JsonDateTime::from() must be of the type string, null given
Looking at the returned data, it has the field
'created_at' => '.....',
While the code has
$webhook->createdAt = JsonDateTime::from($json->createdAt);
How to reproduce
$webhook = new \Trunkrs\SDK\Webhook();
$webhook->callbackUrl = "https://domain.name/";
$webhook->sessionHeaderName = 'XXXX';
$webhook->sessionToken = "yyyy";
$result = \Trunkrs\SDK\Webhook::register($webhook);
Possible Solution
Either have the API return createdAt or change the code to
$webhook->createdAt = JsonDateTime::from($json->created_at);
Additional context
Have only tested on staging, not sure if it also happens on live
The text was updated successfully, but these errors were encountered: