1
0
mirror of synced 2024-11-24 22:36:06 +03:00

first alpha

This commit is contained in:
Alex Lushpai 2016-07-11 14:22:06 +03:00
parent a9b60cfd62
commit de70ffd2bd
4 changed files with 140 additions and 12 deletions

View File

@ -1,6 +1,6 @@
# retailCRM API PHP client
PHP-client for [retailCRM API](http://www.retailcrm.pro/docs/Developers/ApiVersion3).
PHP-client for [retailCRM API](http://www.retailcrm.pro/docs/Developers/ApiVersion4).
Use [API documentation](http://retailcrm.github.io/api-client-php)

View File

@ -1,6 +1,6 @@
# PHP-клиент для retailCRM API
PHP-клиент для работы с [retailCRM API](http://www.retailcrm.ru/docs/Developers/ApiVersion3).
PHP-клиент для работы с [retailCRM API](http://www.retailcrm.ru/docs/Developers/ApiVersion4).
Рекомендуем обращаться к [документации](http://retailcrm.github.io/api-client-php) по библиотеке, в частности по классу [RetailCrm\ApiClient](http://retailcrm.github.io/api-client-php/class-RetailCrm.ApiClient.html).

View File

@ -15,16 +15,6 @@
"php": ">=5.3.0",
"ext-curl": "*"
},
"require-dev": {
"phpunit/phpunit": "5.2.*",
"phpunit/php-code-coverage": "3.3.0",
"phpunit/php-invoker": "1.1.4",
"phpmd/phpmd": "2.4.*",
"sebastian/phpcpd": "2.0.*",
"sebastian/phpdcd": "1.0.*",
"squizlabs/php_codesniffer": "2.5.*",
"apigen/apigen": "4.1.*"
},
"support": {
"email": "support@retailcrm.pro"
},

View File

@ -321,6 +321,35 @@ class ApiClient
);
}
/**
* Get orders history
* @param array $filter
* @param null $page
* @param null $limit
*
* @return ApiResponse
*/
public function ordersHistory(array $filter = array(), $page = null, $limit = null)
{
$parameters = array();
if (count($filter)) {
$parameters['filter'] = $filter;
}
if (null !== $page) {
$parameters['page'] = (int) $page;
}
if (null !== $limit) {
$parameters['limit'] = (int) $limit;
}
return $this->client->makeRequest(
'/orders/history',
Client::METHOD_GET,
$parameters
);
}
/**
* Returns filtered customers list
*
@ -498,6 +527,35 @@ class ApiClient
);
}
/**
* Get customers history
* @param array $filter
* @param null $page
* @param null $limit
*
* @return ApiResponse
*/
public function customersHistory(array $filter = array(), $page = null, $limit = null)
{
$parameters = array();
if (count($filter)) {
$parameters['filter'] = $filter;
}
if (null !== $page) {
$parameters['page'] = (int) $page;
}
if (null !== $limit) {
$parameters['limit'] = (int) $limit;
}
return $this->client->makeRequest(
'/customers/history',
Client::METHOD_GET,
$parameters
);
}
/**
* Get orders assembly list
*
@ -811,6 +869,86 @@ class ApiClient
);
}
/**
* Get delivery settings
*
* @param string $code
*
* @throws \InvalidArgumentException
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return ApiResponse
*/
public function deliverySettingsGet($code)
{
if (empty($code)) {
throw new \InvalidArgumentException('Parameter `code` must be set');
}
return $this->client->makeRequest(
"/delivery/generic/setting/$code",
Client::METHOD_GET
);
}
/**
* Edit delivery configuration
*
* @param array $configuration
*
* @throws \RetailCrm\Exception\InvalidJsonException
* @throws \RetailCrm\Exception\CurlException
* @throws \InvalidArgumentException
*
* @return ApiResponse
*/
public function deliverySettingsEdit(array $configuration)
{
if (!count($configuration) || empty($configuration['code'])) {
throw new \InvalidArgumentException(
'Parameter `configuration` must contains a data & configuration `code` must be set'
);
}
return $this->client->makeRequest(
sprintf('/delivery/generic/settings/%s/edit', $configuration['code']),
Client::METHOD_POST,
$configuration
);
}
/**
* Delivery tracking update
*
* @param string $code
* @param array $statusUpdate
*
* @throws \RetailCrm\Exception\InvalidJsonException
* @throws \RetailCrm\Exception\CurlException
* @throws \InvalidArgumentException
*
* @return ApiResponse
*/
public function deliveryTracking($code, array $statusUpdate)
{
if (empty($code)) {
throw new \InvalidArgumentException('Parameter `code` must be set');
}
if (!count($statusUpdate)) {
throw new \InvalidArgumentException(
'Parameter `statusUpdate` must contains a data'
);
}
return $this->client->makeRequest(
sprintf('/delivery/generic/%s/tracking', $code),
Client::METHOD_POST,
$statusUpdate
);
}
/**
* Returns available county list
*