Добавлена передача дополнительных параметров в GET запросах (#267)

This commit is contained in:
ellynoize 2024-10-14 20:26:34 +06:00 committed by GitHub
parent c893cf24fb
commit 2c6cccc3b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,6 @@
## v4.1.17
* Added additional parameters to GET requests.
## v4.1.16
* Support for services in ICML

View File

@ -1 +1 @@
4.1.16
4.1.17

View File

@ -2,7 +2,7 @@
class ControllerExtensionModuleRetailcrm extends Controller
{
const VERSION_MODULE = '4.1.16';
const VERSION_MODULE = '4.1.17';
private $_error = [];
protected $log, $statuses, $payments, $deliveryTypes, $retailcrmApiClient, $moduleTitle, $tokenTitle;

View File

@ -46,9 +46,9 @@ class RetailcrmHttpClient
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(
@ -60,7 +60,16 @@ class RetailcrmHttpClient
);
}
$parameters = array_merge($this->defaultParameters, $parameters);
$parameters = self::METHOD_GET === $method
? array_merge($this->defaultParameters, $parameters, [
'cms_source' => 'OpenCart',
'cms_version' => VERSION,
'php_version' => function_exists('phpversion') ? phpversion() : '',
'module_version' => ControllerExtensionModuleRetailcrm::VERSION_MODULE,
])
: $parameters = array_merge($this->defaultParameters, $parameters);
$url = $this->url . $path;