From d364e86b29b6b582d23cf62668b72d48604519d9 Mon Sep 17 00:00:00 2001 From: andrei-ghenov Date: Sat, 2 Mar 2024 18:46:31 -0500 Subject: [PATCH] T-005: Adjust time generation in ApiClient to reflect local time zone --- src/Api/ApiClient.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Api/ApiClient.php b/src/Api/ApiClient.php index 10ca7f7..3efef73 100644 --- a/src/Api/ApiClient.php +++ b/src/Api/ApiClient.php @@ -2,6 +2,8 @@ namespace QuickTopUpAPI\Api; +use DateTime; +use DateTimeZone; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; @@ -67,13 +69,15 @@ public function __construct() { * * @return mixed * The response from the API. + * @throws \Exception */ public function sendRequest( string $method, string $endpoint, array $data = [] ): mixed { - $timestamp = gmdate('c'); + $dateTime = new DateTime('now', new DateTimeZone('America/New_York')); + $timestamp = $dateTime->format('c'); $authKey = $this->generateAuthHmac($timestamp, $this->apiSecurityKey); $hashedPassword = $this->generateAuthHmac($this->apiPassword, $authKey);