diff --git a/CHANGELOG.md b/CHANGELOG.md index 440f9e0b..f2335577 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2024-10-14 v6.5.33 +- Добавлена передача дополнительных параметров в GET запросах + ## 2024-10-03 v6.5.32 - Исправлена подписка на событие создания заказа при обновлении diff --git a/intaro.retailcrm/classes/general/Http/Client.php b/intaro.retailcrm/classes/general/Http/Client.php index cf1ccba5..66f5b5bc 100644 --- a/intaro.retailcrm/classes/general/Http/Client.php +++ b/intaro.retailcrm/classes/general/Http/Client.php @@ -11,6 +11,7 @@ namespace RetailCrm\Http; +use Intaro\RetailCrm\Component\Constants; use RetailCrm\Exception\CurlException; use RetailCrm\Exception\InvalidJsonException; use RetailCrm\Response\ApiResponse; @@ -38,7 +39,7 @@ class Client * * @throws \InvalidArgumentException */ - public function __construct($url, array $defaultParameters = array()) + public function __construct($url, array $defaultParameters = []) { if (false === stripos($url, 'https://')) { throw new \InvalidArgumentException( @@ -49,7 +50,7 @@ class Client $this->url = $url; $this->defaultParameters = $defaultParameters; $this->retry = 0; - $this->curlErrors = array( + $this->curlErrors = [ CURLE_COULDNT_RESOLVE_PROXY, CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT, @@ -57,8 +58,8 @@ class Client CURLE_HTTP_POST_ERROR, CURLE_SSL_CONNECT_ERROR, CURLE_SEND_ERROR, - CURLE_RECV_ERROR - ); + CURLE_RECV_ERROR, + ]; } /** @@ -79,9 +80,9 @@ class Client public function makeRequest( $path, $method, - array $parameters = array() + array $parameters = [] ) { - $allowedMethods = array(self::METHOD_GET, self::METHOD_POST); + $allowedMethods = [self::METHOD_GET, self::METHOD_POST]; if (!in_array($method, $allowedMethods, false)) { throw new \InvalidArgumentException( @@ -93,7 +94,14 @@ class Client ); } - $parameters = array_merge($this->defaultParameters, $parameters); + $parameters = self::METHOD_GET === $method + ? array_merge($this->defaultParameters, $parameters, [ + 'cms_source' => 'Bitrix', + 'cms_version' => SM_VERSION, + 'php_version' => function_exists('phpversion') ? phpversion() : '', + 'module_version' => Constants::MODULE_VERSION, + ]) + : $parameters = array_merge($this->defaultParameters, $parameters); $url = $this->url . $path; @@ -122,7 +130,8 @@ class Client curl_close($curlHandler); - if ($errno + if ( + $errno && in_array($errno, $this->curlErrors, false) && $this->retry < 3 ) { diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 293bec97..c5b7ed75 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1 +1 @@ -- Исправлена подписка на событие сохранения заказа при обновлении +- Добавлена передача дополнительных параметров в GET запросах diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index f96b8ae8..bb690a8c 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.5.32', - 'VERSION_DATE' => '2024-10-03 17:00:00' + 'VERSION' => '6.5.33', + 'VERSION_DATE' => '2024-10-14 17:00:00' ]; diff --git a/intaro.retailcrm/lib/component/constants.php b/intaro.retailcrm/lib/component/constants.php index 4e703674..34ec5925 100644 --- a/intaro.retailcrm/lib/component/constants.php +++ b/intaro.retailcrm/lib/component/constants.php @@ -18,6 +18,7 @@ namespace Intaro\RetailCrm\Component; */ class Constants { + public const MODULE_VERSION = '6.5.33'; public const CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null'; public const BITRIX_USER_ID_PREFIX = 'bitrixUserId-'; public const CRM_USERS_MAP = 'crm_users_map';