@@ -22,13 +22,18 @@ class MindboxClientV3 extends AbstractMindboxClient
2222 /**
2323 * Базовый URL на который будут отправляться запросы.
2424 */
25- const BASE_V3_URL = 'https://api.mindbox.ru /v3/operations/ ' ;
25+ const BASE_V3_URL = 'https://api.mindbox.{{domainZone}} /v3/operations/ ' ;
2626
2727 /**
2828 * Секретный ключ.
2929 */
3030 const SECRET_KEY_NAME = 'Mindbox secretKey ' ;
3131
32+ /**
33+ * @var string Доменная зона API.
34+ */
35+ private $ domainZone ;
36+
3237 /**
3338 * @var string Уникальный идентификатор сайта/мобильного приложения/и т.п.
3439 */
@@ -37,14 +42,16 @@ class MindboxClientV3 extends AbstractMindboxClient
3742 /**
3843 * Конструктор MindboxRequest.
3944 *
40- * @param string $endpointId Уникальный идентификатор сайта/мобильного приложения/и т.п.
41- * @param string $secretKey Секретный ключ.
42- * @param IHttpClient $httpClient Экземпляр HTTP клиента.
43- * @param LoggerInterface $logger Экземпляр логгера.
45+ * @param string $endpointId Уникальный идентификатор сайта/мобильного приложения/и т.п.
46+ * @param string $secretKey Секретный ключ.
47+ * @param IHttpClient $httpClient Экземпляр HTTP клиента.
48+ * @param LoggerInterface $logger Экземпляр логгера.
49+ * @param string $domainZone
4450 */
45- public function __construct ($ endpointId , $ secretKey , IHttpClient $ httpClient , LoggerInterface $ logger )
51+ public function __construct ($ endpointId , $ secretKey , IHttpClient $ httpClient , LoggerInterface $ logger, $ domainZone )
4652 {
4753 parent ::__construct ($ secretKey , $ httpClient , $ logger );
54+ $ this ->domainZone = $ domainZone ;
4855 $ this ->endpointId = $ endpointId ;
4956 }
5057
@@ -89,7 +96,8 @@ private function getCustomerIP()
8996 */
9097 protected function prepareUrl ($ url , array $ queryParams , $ isSync = true )
9198 {
92- return static ::BASE_V3_URL . ($ isSync ? 'sync ' : 'async ' ) . '? ' . http_build_query ($ queryParams );
99+ $ domain = str_replace ('{{domainZone}} ' , $ this ->domainZone , static ::BASE_V3_URL );
100+ return $ domain . ($ isSync ? 'sync ' : 'async ' ) . '? ' . http_build_query ($ queryParams );
93101 }
94102
95103 /**
0 commit comments