From c1c0f5af8c6acaadae0724bf25f5a63c73a0a48a Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Tue, 26 Jul 2016 15:59:07 +0400 Subject: [PATCH 1/3] improve retry (#22) --- lib/RetailCrm/Http/Client.php | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/lib/RetailCrm/Http/Client.php b/lib/RetailCrm/Http/Client.php index 6a446c8..58b628a 100644 --- a/lib/RetailCrm/Http/Client.php +++ b/lib/RetailCrm/Http/Client.php @@ -55,14 +55,6 @@ class Client $this->url = $url; $this->defaultParameters = $defaultParameters; - $this->retry = 0; - $this->curlErrors = array( - CURLE_COULDNT_RESOLVE_PROXY, - CURLE_COULDNT_RESOLVE_HOST, - CURLE_COULDNT_CONNECT, - CURLE_OPERATION_TIMEOUTED, - CURLE_SSL_CONNECT_ERROR - ); } /** @@ -86,7 +78,6 @@ class Client array $parameters = array() ) { $allowedMethods = array(self::METHOD_GET, self::METHOD_POST); - $retry = 0; if (!in_array($method, $allowedMethods, false)) { throw new \InvalidArgumentException( @@ -128,18 +119,7 @@ class Client curl_close($curlHandler); - if ($errno - && in_array($errno, $this->curlErrors, false) - && $retry < 3 - ) { - $errno = null; - $error = null; - $retry++; - $this->makeRequest($path, $method, $parameters); - } - if ($errno) { - $retry = 0; throw new CurlException($error, $errno); } From b1e7dbc52c9eb6594807d4581bef6d9560ccce36 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Thu, 28 Jul 2016 10:48:15 +0300 Subject: [PATCH 2/3] store settings url fix (#23) * improve retry * store settings api url fix --- lib/RetailCrm/ApiClient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/RetailCrm/ApiClient.php b/lib/RetailCrm/ApiClient.php index 2c1defe..e8795a0 100644 --- a/lib/RetailCrm/ApiClient.php +++ b/lib/RetailCrm/ApiClient.php @@ -777,7 +777,7 @@ class ApiClient } return $this->client->makeRequest( - "/store/settings/$code", + "/store/setting/$code", Client::METHOD_GET ); } @@ -802,7 +802,7 @@ class ApiClient } return $this->client->makeRequest( - sprintf('/store/settings/%s/edit', $configuration['code']), + sprintf('/store/setting/%s/edit', $configuration['code']), Client::METHOD_POST, $configuration ); From 51b53cfcc1b4c0f4d4c041b16bfc3bb726ccd399 Mon Sep 17 00:00:00 2001 From: Dmitry Mamontov Date: Tue, 2 Aug 2016 16:54:50 +0300 Subject: [PATCH 3/3] fix settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Проверьте внимательно методы , это не единственные ошибки --- lib/RetailCrm/ApiClient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/RetailCrm/ApiClient.php b/lib/RetailCrm/ApiClient.php index e8795a0..1b51ee3 100644 --- a/lib/RetailCrm/ApiClient.php +++ b/lib/RetailCrm/ApiClient.php @@ -912,9 +912,9 @@ class ApiClient } return $this->client->makeRequest( - sprintf('/delivery/generic/settings/%s/edit', $configuration['code']), + sprintf('/delivery/generic/setting/%s/edit', $configuration['code']), Client::METHOD_POST, - $configuration + array('configuration' => json_encode($configuration)) ); }