diff --git a/lib/IntaroCrm/RestApi.php b/lib/IntaroCrm/RestApi.php index 621c2bd..af7cd41 100644 --- a/lib/IntaroCrm/RestApi.php +++ b/lib/IntaroCrm/RestApi.php @@ -3,31 +3,6 @@ namespace IntaroCrm; class RestApi { - protected static $jsonReplaceSource = array( - '\u0410','\u0430','\u0411','\u0431','\u0412','\u0432','\u0413','\u0433', - '\u0414','\u0434','\u0415','\u0435','\u0401','\u0451','\u0416','\u0436', - '\u0417','\u0437','\u0418','\u0438','\u0419','\u0439','\u041a','\u043a', - '\u041b','\u043b','\u041c','\u043c','\u041d','\u043d','\u041e','\u043e', - '\u041f','\u043f','\u0420','\u0440','\u0421','\u0441','\u0422','\u0442', - '\u0423','\u0443','\u0424','\u0444','\u0425','\u0445','\u0426','\u0446', - '\u0427','\u0447','\u0428','\u0448','\u0429','\u0449','\u042a','\u044a', - '\u042b','\u044b','\u042c','\u044c','\u042d','\u044d','\u042e','\u044e', - '\u042f','\u044f' - ); - - protected static $jsonReplaceTarget = array( - 'А', 'а', 'Б', 'б', 'В', 'в', 'Г', 'г', - 'Д', 'д', 'Е', 'е', 'Ё', 'ё', 'Ж', 'ж', - 'З', 'з', 'И', 'и', 'Й', 'й', 'К', 'к', - 'Л', 'л', 'М', 'м', 'Н', 'н', 'О', 'о', - 'П', 'п', 'Р', 'р', 'С', 'с', 'Т', 'т', - 'У', 'у', 'Ф', 'ф', 'Х', 'х', 'Ц', 'ц', - 'Ч', 'ч', 'Ш', 'ш', 'Щ', 'щ', 'Ъ', 'ъ', - 'Ы', 'ы', 'Ь', 'ь', 'Э', 'э', 'Ю', 'ю', - 'Я', 'я' - ); - - protected $apiUrl; protected $apiKey; protected $apiVersion = '1'; @@ -95,8 +70,6 @@ class RestApi public function orderCreate($order) { $dataJson = json_encode($order); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['order'] = $dataJson; $url = $this->apiUrl.'orders/create'; @@ -113,8 +86,6 @@ class RestApi public function orderEdit($order) { $dataJson = json_encode($order); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['order'] = $dataJson; $url = $this->apiUrl.'orders/'.$order['externalId'].'/edit'; @@ -131,8 +102,6 @@ class RestApi public function orderUpload($orders) { $dataJson = json_encode($orders); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['orders'] = $dataJson; $url = $this->apiUrl.'orders/upload'; @@ -149,8 +118,6 @@ class RestApi public function orderFixExternalIds($order) { $dataJson = json_encode($order); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['orders'] = $dataJson; $url = $this->apiUrl.'orders/fix-external-ids'; @@ -223,8 +190,6 @@ class RestApi public function customerCreate($customer) { $dataJson = json_encode($customer); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['customer'] = $dataJson; $url = $this->apiUrl.'customers/create'; @@ -241,8 +206,6 @@ class RestApi public function customerEdit($customer) { $dataJson = json_encode($customer); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['customer'] = $dataJson; $url = $this->apiUrl.'customers/'.$customer['externalId'].'/edit'; @@ -315,8 +278,6 @@ class RestApi public function deliveryTypeEdit($deliveryType) { $dataJson = json_encode($deliveryType); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['deliveryType'] = $dataJson; $url = $this->apiUrl.'delivery-types/'.$deliveryType['code'].'/edit'; @@ -346,8 +307,6 @@ class RestApi public function paymentTypesEdit($paymentType) { $dataJson = json_encode($paymentType); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['paymentType'] = $dataJson; $url = $this->apiUrl.'payment-types/'.$paymentType['code'].'/edit'; @@ -377,8 +336,6 @@ class RestApi public function paymentStatusesEdit($paymentStatus) { $dataJson = json_encode($paymentStatus); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['paymentStatus'] = $dataJson; $url = $this->apiUrl.'payment-statuses/'.$paymentStatus['code'].'/edit'; @@ -408,8 +365,6 @@ class RestApi public function orderTypesEdit($orderType) { $dataJson = json_encode($orderType); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['orderType'] = $dataJson; $url = $this->apiUrl.'order-types/'.$orderType['code'].'/edit'; @@ -438,8 +393,6 @@ class RestApi public function orderStatusEdit($status) { $dataJson = json_encode($status); - $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, - $dataJson); $this->parameters['status'] = $dataJson; $url = $this->apiUrl.'statuses/'.$status['code'].'/edit';