Skip to content

Commit 465216b

Browse files
authored
Merge pull request #43 from mindbox-moscow/MBM-299
Временный домен для старых серверов
2 parents 108e646 + da028bf commit 465216b

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/Clients/MindboxClientV3.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class MindboxClientV3 extends AbstractMindboxClient
2424
*/
2525
const BASE_V3_URL = 'https://api.mindbox.{{domainZone}}/v3/operations/';
2626

27+
const TMP_V3_URL = 'https://api-ru.mindbox.cloud/v3/operations/';
2728
/**
2829
* Секретный ключ.
2930
*/
@@ -96,7 +97,10 @@ private function getCustomerIP()
9697
*/
9798
protected function prepareUrl($url, array $queryParams, $isSync = true)
9899
{
99-
$domain = str_replace('{{domainZone}}', $this->domainZone, static::BASE_V3_URL);
100+
$domain = $this->getApiUrl();
101+
102+
$domain = str_replace('{{domainZone}}', $this->domainZone, $domain);
103+
100104
return $domain . ($isSync ? 'sync' : 'async') . '?' . http_build_query($queryParams);
101105
}
102106

@@ -165,4 +169,21 @@ protected function prepareResponseBody($rawBody)
165169
{
166170
return $rawBody ? json_decode($rawBody, true) : [];
167171
}
172+
173+
/**
174+
* Временное решение для старых хостингов
175+
*
176+
* @return string
177+
*/
178+
protected function getApiUrl()
179+
{
180+
$return = self:: BASE_V3_URL;
181+
switch ($this->domainZone) {
182+
case 'api-ru':
183+
$return = self::TMP_V3_URL;
184+
break;
185+
}
186+
187+
return $return;
188+
}
168189
}

0 commit comments

Comments
 (0)