pipedrive / client-php

Pipedrive API client for PHP
MIT License
49 stars 57 forks source link

[BUG] getAllWebhooks() last_delivery_time incorrect format #3

Closed maileon-hu closed 4 years ago

maileon-hu commented 4 years ago

Exception: production.ERROR: Incorrect format. {"userId":1,"email":"some@mail.com","exception":"[object] (Exception(code: 0): Incorrect format. at /vendor/pipedrive/pipedrive/src/Utils/DateTimeHelper.php:73) [stacktrace]

0 [internal function]: Pipedrive\Utils\DateTimeHelper::fromSimpleDate('2020-03-30T13:3...')

1 /vendor/apimatic/jsonmapper/src/JsonMapper.php(183): call_user_func('\\Pipedrive\\Util...', '2020-03-30T13:3...')

2 /vendor/apimatic/jsonmapper/src/JsonMapper.php(523): apimatic\jsonmapper\JsonMapper->map(Object(stdClass), Object(Pipedrive\Models\Data29))

3 /vendor/apimatic/jsonmapper/src/JsonMapper.php(247): apimatic\jsonmapper\JsonMapper->mapArray(Array, Array, '\\Pipedrive\\Mode...')

4 /vendor/apimatic/jsonmapper/src/JsonMapper.php(319): apimatic\jsonmapper\JsonMapper->map(Object(stdClass), Object(Pipedrive\Models\WebhooksResponse))

5 /vendor/pipedrive/pipedrive/src/Controllers/WebhooksController.php(97): apimatic\jsonmapper\JsonMapper->mapClass(Object(stdClass), 'Pipedrive\\Model...')

6 /pipedriveplugin/Controllers/PluginController.php(45): Pipedrive\Controllers\WebhooksController->getAllWebhooks()

I think at /pipedrive/pipedrive/src/Models/Data29.php need to change:

$json['last_delivery_time'] = isset($this->lastDeliveryTime) ? DateTimeHelper::toSimpleDate($this->lastDeliveryTime) : null;

to

$json['last_delivery_time'] = isset($this->lastDeliveryTime) ? DateTimeHelper::toRfc3339DateTime($this->lastDeliveryTime) : null;

and

/**

to

/**

ziimk commented 4 years ago

Thank you for the report, we are checking

mykhailo-riabokon commented 4 years ago

Hi @maileon-hu!

Thanks for reporting this issue. It was fixed in 1.0.1