From da028bf45a37394426d56b57659bfb642b2c650d Mon Sep 17 00:00:00 2001 From: prodmindbox Date: Wed, 23 Mar 2022 16:59:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=B4=D0=BE=D0=BC=D0=B5=D0=BD=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=81=D1=82=D0=B0=D1=80=D1=8B=D1=85=20=D1=81=D0=B5?= =?UTF-8?q?=D1=80=D0=B2=D0=B5=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Clients/MindboxClientV3.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Clients/MindboxClientV3.php b/src/Clients/MindboxClientV3.php index 7154316..80ab50d 100644 --- a/src/Clients/MindboxClientV3.php +++ b/src/Clients/MindboxClientV3.php @@ -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/'; /** * Секретный ключ. */ @@ -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); } @@ -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; + } }