Skip to content

Commit

Permalink
getHttpHeadersIsV2 method added
Browse files Browse the repository at this point in the history
  • Loading branch information
tarikkamat committed Sep 16, 2024
1 parent 6c5850b commit 7277431
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Iyzipay/IyzipayResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ protected static function getHttpHeadersV2($uri, Request $request = null, Option
return $header;
}

protected static function getHttpHeadersIsV2($uri, Request $request = null, Options $options, bool $addRandom = false)
{
$header = array(
"Accept: application/json",
"Content-type: application/json",
);

$rnd = uniqid();
array_push($header, "Authorization: " . self::prepareAuthorizationStringV2($uri, $request, $options, $rnd));
$addRandom && array_push($header, "x-iyzi-rnd: " . $rnd);
array_push($header, "x-iyzi-client-version: " . "iyzipay-php-2.0.43");

return $header;
}

protected static function prepareAuthorizationString(Request $request, Options $options, $rnd)
{
$authContent = HashGenerator::generateHash($options->getApiKey(), $options->getSecretKey(), $rnd, $request);
Expand All @@ -53,7 +68,7 @@ protected static function prepareAuthorizationStringV2($uri, Request $request =
{
$hash = IyziAuthV2Generator::generateAuthContent($uri, $options->getApiKey(), $options->getSecretKey(), $rnd, $request);

return 'IYZWSv2'.' '.$hash;
return 'IYZWSv2' . ' ' . $hash;
}

public function getStatus()
Expand Down

0 comments on commit 7277431

Please sign in to comment.