From 719667a26aa31f52f58a621ce183cad0d27ac4d5 Mon Sep 17 00:00:00 2001 From: JochemKlingeler Date: Mon, 18 Jun 2018 20:39:00 +0200 Subject: [PATCH 1/2] Tikkie API expects ISO-8601 Zulu --- src/PHPTikkie.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PHPTikkie.php b/src/PHPTikkie.php index b75290e..e0f76b8 100644 --- a/src/PHPTikkie.php +++ b/src/PHPTikkie.php @@ -1,6 +1,7 @@ format('c'); + $params['fromDate'] = (new DateTime())->setTimestamp($fromDate->getTimestamp()) + ->setTimezone('UTC') + ->format('Y-m-d\TH:i:s\Z'); } if ($toDate) { - $params['toDate'] = $toDate->format('c'); + $params['toDate'] = (new DateTime())->setTimestamp($toDate->getTimestamp()) + ->setTimezone('UTC') + ->format('Y-m-d\TH:i:s\Z'); } $response = $this->environment->getRequest("/v1/tikkie/platforms/{$platformToken}/users/{$userToken}/paymentrequests", $params); From 2c2a66f08cdb143b0e03ace4c61dd2d944313e41 Mon Sep 17 00:00:00 2001 From: JochemKlingeler Date: Mon, 18 Jun 2018 21:12:08 +0200 Subject: [PATCH 2/2] Use DateTimeZone objects --- src/PHPTikkie.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PHPTikkie.php b/src/PHPTikkie.php index e0f76b8..814fa36 100644 --- a/src/PHPTikkie.php +++ b/src/PHPTikkie.php @@ -3,6 +3,7 @@ use DateTime; use DateTimeInterface; +use DateTimeZone; use PHPTikkie\Entities\PaymentRequest; use PHPTikkie\Entities\Platform; use PHPTikkie\Entities\User; @@ -66,13 +67,13 @@ public function paymentRequests(string $platformToken, string $userToken, int $o if ($fromDate) { $params['fromDate'] = (new DateTime())->setTimestamp($fromDate->getTimestamp()) - ->setTimezone('UTC') + ->setTimezone(new DateTimeZone('UTC')) ->format('Y-m-d\TH:i:s\Z'); } if ($toDate) { $params['toDate'] = (new DateTime())->setTimestamp($toDate->getTimestamp()) - ->setTimezone('UTC') + ->setTimezone(new DateTimeZone('UTC')) ->format('Y-m-d\TH:i:s\Z'); }