Skip to content

Commit

Permalink
Merge pull request #13 from andrei-ghenov/feature/T-005-api-client-test
Browse files Browse the repository at this point in the history
T-005: Adjust time generation in ApiClient to reflect local time zone
  • Loading branch information
andrei-ghenov authored Mar 2, 2024
2 parents b27a3b3 + d364e86 commit 07ca15a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Api/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace QuickTopUpAPI\Api;

use DateTime;
use DateTimeZone;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 07ca15a

Please sign in to comment.