1
0
mirror of synced 2024-11-25 06:46:07 +03:00
orderType methods added;
composer.json, README.md fixed
This commit is contained in:
kruglov 2013-07-04 15:21:23 +04:00
parent 623b667aef
commit c14a661174

View File

@ -1,6 +1,6 @@
<?php <?php
class IntaroCrmRestApi class RestApi
{ {
protected static $jsonReplaceSource = array( protected static $jsonReplaceSource = array(
'\u0410','\u0430','\u0411','\u0431','\u0412','\u0432','\u0413','\u0433', '\u0410','\u0430','\u0411','\u0431','\u0412','\u0432','\u0413','\u0433',
@ -355,6 +355,38 @@ class IntaroCrmRestApi
} }
/**
* Получение списка типов заказа
*
* @return array - массив типов заказа
*/
public function orderTypesList()
{
$url = $this->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') protected function curlRequest($url, $parameters = null, $method = 'GET', $format = 'json')