Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New api authorization scheme name #61

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Clients/MindboxClientV3.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class MindboxClientV3 extends AbstractMindboxClient

const TMP_V3_URL = 'https://api-ru.mindbox.cloud/v3/operations/';
/**
* Секретный ключ.
* Имя схемы авторизации по секретному ключу.
*/
const SECRET_KEY_NAME = 'Mindbox secretKey';
const SECRET_KEY_AUTHORIZATION_SCHEME_NAME = 'SecretKey';

/**
* @var string Доменная зона API.
Expand Down Expand Up @@ -143,7 +143,7 @@ private function getDeviceUUID()
*/
protected function prepareAuthorizationHeader()
{
return static::SECRET_KEY_NAME . '="' . $this->secretKey . '"';
return static::SECRET_KEY_AUTHORIZATION_SCHEME_NAME . ' ' . $this->secretKey;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

жесткая конкатинация тут
https://www.php.net/manual/en/language.operators.string.php

}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Clients/MindboxClientV3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function expectedArgsForSendProvider()
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Mindbox secretKey="' . $this->secret . '"',
'Authorization' => 'SecretKey ' . $this->secret,
'X-Customer-IP' => '',
'Mindbox-Integration' => 'PhpSDK',
'Mindbox-Integration-Version' => '1.0'
Expand All @@ -61,7 +61,7 @@ public function expectedArgsForSendProvider()
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Mindbox secretKey="' . $this->secret . '"',
'Authorization' => 'SecretKey ' . $this->secret,
'X-Customer-IP' => '',
'Mindbox-Integration' => 'PhpSDK',
'Mindbox-Integration-Version' => '1.0'
Expand All @@ -86,7 +86,7 @@ public function expectedArgsForSendProvider()
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Mindbox secretKey="' . $this->secret . '"',
'Authorization' => 'SecretKey ' . $this->secret,
'Mindbox-Integration' => 'PhpSDK',
'Mindbox-Integration-Version' => '1.0'
],
Expand Down
Loading