diff --git a/lib/IntaroCrmRestApi.php b/lib/RestApi.php similarity index 90% rename from lib/IntaroCrmRestApi.php rename to lib/RestApi.php index 1fa0b48..9a46c43 100644 --- a/lib/IntaroCrmRestApi.php +++ b/lib/RestApi.php @@ -1,6 +1,6 @@ apiUrl.'reference/order-types'; + $result = $this->curlRequest($url); + return $result; + } + + /** + * Редактирование типа заказа + * + * @param array $paymentType - информация о типе заказа + * @return array + */ + public function orderTypesEdit($orderType) + { + $dataJson = json_encode($orderType); + $dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget, + $dataJson); + $parameters = array(); + $parameters['orderType'] = $dataJson; + + $url = $this->apiUrl.'order-types/'.$paymentType['code'].'/edit'; + $result = $this->curlRequest($url, $parameters, 'POST'); + return $result; + } + + protected function curlRequest($url, $parameters = null, $method = 'GET', $format = 'json')