Skip to content

Commit

Permalink
Merge pull request #43 from mindbox-moscow/MBM-299
Browse files Browse the repository at this point in the history
Временный домен для старых серверов
  • Loading branch information
IvanShishkin authored Apr 12, 2022
2 parents 108e646 + da028bf commit 465216b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/Clients/MindboxClientV3.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class MindboxClientV3 extends AbstractMindboxClient
*/
const BASE_V3_URL = 'https://api.mindbox.{{domainZone}}/v3/operations/';

const TMP_V3_URL = 'https://api-ru.mindbox.cloud/v3/operations/';
/**
* Секретный ключ.
*/
Expand Down Expand Up @@ -96,7 +97,10 @@ private function getCustomerIP()
*/
protected function prepareUrl($url, array $queryParams, $isSync = true)
{
$domain = str_replace('{{domainZone}}', $this->domainZone, static::BASE_V3_URL);
$domain = $this->getApiUrl();

$domain = str_replace('{{domainZone}}', $this->domainZone, $domain);

return $domain . ($isSync ? 'sync' : 'async') . '?' . http_build_query($queryParams);
}

Expand Down Expand Up @@ -165,4 +169,21 @@ protected function prepareResponseBody($rawBody)
{
return $rawBody ? json_decode($rawBody, true) : [];
}

/**
* Временное решение для старых хостингов
*
* @return string
*/
protected function getApiUrl()
{
$return = self:: BASE_V3_URL;
switch ($this->domainZone) {
case 'api-ru':
$return = self::TMP_V3_URL;
break;
}

return $return;
}
}

0 comments on commit 465216b

Please sign in to comment.