Minor bugfixes (#42)
This commit is contained in:
parent
a18767bddc
commit
4f57734e92
@ -15,7 +15,7 @@ Use [API documentation](http://retailcrm.github.io/api-client-php)
|
||||
|
||||
2) Run into your project directory:
|
||||
```bash
|
||||
composer require retailcrm/api-client-php 5.* --no-dev
|
||||
composer require retailcrm/api-client-php ~5.0
|
||||
```
|
||||
|
||||
If you have not used `composer` before, include autoloader into your project.
|
||||
@ -30,7 +30,7 @@ require 'path/to/vendor/autoload.php';
|
||||
$client = new \RetailCrm\ApiClient(
|
||||
'https://demo.retailcrm.ru',
|
||||
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
|
||||
'v5'
|
||||
\RetailCrm\ApiClient::V5
|
||||
);
|
||||
|
||||
try {
|
||||
@ -65,7 +65,7 @@ if ($response->isSuccessful()) {
|
||||
$client = new \RetailCrm\ApiClient(
|
||||
'https://demo.retailcrm.ru',
|
||||
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
|
||||
'v4'
|
||||
\RetailCrm\ApiClient::V4
|
||||
);
|
||||
|
||||
try {
|
||||
|
@ -15,7 +15,7 @@ PHP-клиент для работы с [retailCRM API](http://www.retailcrm.ru/
|
||||
|
||||
2) Выполните в папке проекта:
|
||||
```bash
|
||||
composer require retailcrm/api-client-php 5.* --no-dev
|
||||
composer require retailcrm/api-client-php ~5.0
|
||||
```
|
||||
|
||||
В конфиг `composer.json` вашего проекта будет добавлена библиотека `retailcrm/api-client-php`, которая установится в папку `vendor/`. При отсутствии файла конфига или папки с вендорами они будут созданы.
|
||||
@ -32,7 +32,7 @@ require 'path/to/vendor/autoload.php';
|
||||
$client = new \RetailCrm\ApiClient(
|
||||
'https://demo.retailcrm.ru',
|
||||
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
|
||||
'v5'
|
||||
\RetailCrm\ApiClient::V5
|
||||
);
|
||||
|
||||
try {
|
||||
@ -67,7 +67,7 @@ if ($response->isSuccessful()) {
|
||||
$client = new \RetailCrm\ApiClient(
|
||||
'https://demo.retailcrm.ru',
|
||||
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
|
||||
'v4'
|
||||
\RetailCrm\ApiClient::V4
|
||||
);
|
||||
|
||||
try {
|
||||
|
@ -34,6 +34,10 @@ class ApiClient
|
||||
public $request;
|
||||
public $version;
|
||||
|
||||
const V3 = 'v3';
|
||||
const V4 = 'v4';
|
||||
const V5 = 'v5';
|
||||
|
||||
/**
|
||||
* Init version based client
|
||||
*
|
||||
@ -43,18 +47,18 @@ class ApiClient
|
||||
* @param string $site site code
|
||||
*
|
||||
*/
|
||||
public function __construct($url, $apiKey, $version = 'v5', $site = null)
|
||||
public function __construct($url, $apiKey, $version = self::V5, $site = null)
|
||||
{
|
||||
$this->version = $version;
|
||||
|
||||
switch ($version) {
|
||||
case 'v5':
|
||||
case self::V5:
|
||||
$this->request = new ApiVersion5($url, $apiKey, $version, $site);
|
||||
break;
|
||||
case 'v4':
|
||||
case self::V4:
|
||||
$this->request = new ApiVersion4($url, $apiKey, $version, $site);
|
||||
break;
|
||||
case 'v3':
|
||||
case self::V3:
|
||||
$this->request = new ApiVersion3($url, $apiKey, $version, $site);
|
||||
break;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* API client class
|
||||
* Abstract API client
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Http\Client;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* API client class
|
||||
* Abstract API client class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* API client class
|
||||
* API client v3
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* API client class
|
||||
* API client v3 class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* API client class
|
||||
* API client v4
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* API client class
|
||||
* API client v4 class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -49,6 +49,7 @@ class ApiVersion4 extends AbstractLoader
|
||||
use V4\Orders;
|
||||
use V4\Packs;
|
||||
use V4\References;
|
||||
use V4\Settings;
|
||||
use V4\Statistic;
|
||||
use V4\Stores;
|
||||
use V4\Telephony;
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* API client class
|
||||
* API client v5
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V5;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* API client class
|
||||
* API client v5 class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -46,7 +46,6 @@ class ApiVersion5 extends AbstractLoader
|
||||
use V5\Customers;
|
||||
use V5\CustomFields;
|
||||
use V5\Delivery;
|
||||
use V5\Marketplace;
|
||||
use V5\Orders;
|
||||
use V5\Packs;
|
||||
use V5\References;
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* Class CurlException
|
||||
* CurlException
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* Class InvalidJsonException
|
||||
* InvalidJsonException
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Customers
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Customers class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Orders
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Orders class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Packs
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Packs class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* References
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* References class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* Statistic class
|
||||
* Statistic
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Stores
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Stores class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Customers
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Customers as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Customers class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Delivery
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V4;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Delivery class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -50,32 +50,6 @@ trait Delivery
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit delivery configuration
|
||||
*
|
||||
* @param array $configuration
|
||||
*
|
||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||
* @throws \RetailCrm\Exception\CurlException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return \RetailCrm\Response\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/setting/%s/edit', $configuration['code']),
|
||||
"POST",
|
||||
['configuration' => json_encode($configuration)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delivery tracking update
|
||||
*
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Orders
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Orders as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Orders class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Packs
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Packs as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Packs class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* References
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\References as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* References class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
186
lib/RetailCrm/Methods/V4/Settings.php
Normal file
186
lib/RetailCrm/Methods/V4/Settings.php
Normal file
@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* Settings
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
* @author RetailCrm <integration@retailcrm.ru>
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Methods\V4;
|
||||
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* Settings class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
* @author RetailCrm <integration@retailcrm.ru>
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
|
||||
*/
|
||||
trait Settings
|
||||
{
|
||||
|
||||
/**
|
||||
* Edit store configuration
|
||||
*
|
||||
* @param array $configuration
|
||||
*
|
||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||
* @throws \RetailCrm\Exception\CurlException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
public function storeSettingsEdit(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('/store/setting/%s/edit', $configuration['code']),
|
||||
"POST",
|
||||
['configuration' => json_encode($configuration)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit telephony settings
|
||||
*
|
||||
* @param string $code symbolic code
|
||||
* @param string $clientId client id
|
||||
* @param boolean $active telephony activity
|
||||
* @param mixed $name service name
|
||||
* @param mixed $makeCallUrl service init url
|
||||
* @param mixed $image service logo url(svg file)
|
||||
*
|
||||
* @param array $additionalCodes
|
||||
* @param array $externalPhones
|
||||
* @param bool $allowEdit
|
||||
* @param bool $inputEventSupported
|
||||
* @param bool $outputEventSupported
|
||||
* @param bool $hangupEventSupported
|
||||
* @param bool $changeUserStatusUrl
|
||||
*
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
public function telephonySettingsEdit(
|
||||
$code,
|
||||
$clientId,
|
||||
$active = false,
|
||||
$name = false,
|
||||
$makeCallUrl = false,
|
||||
$image = false,
|
||||
$additionalCodes = [],
|
||||
$externalPhones = [],
|
||||
$allowEdit = false,
|
||||
$inputEventSupported = false,
|
||||
$outputEventSupported = false,
|
||||
$hangupEventSupported = false,
|
||||
$changeUserStatusUrl = false
|
||||
) {
|
||||
if (!isset($code)) {
|
||||
throw new \InvalidArgumentException('Code must be set');
|
||||
}
|
||||
|
||||
$parameters['code'] = $code;
|
||||
|
||||
if (!isset($clientId)) {
|
||||
throw new \InvalidArgumentException('client id must be set');
|
||||
}
|
||||
|
||||
$parameters['clientId'] = $clientId;
|
||||
|
||||
if (!isset($active)) {
|
||||
$parameters['active'] = false;
|
||||
} else {
|
||||
$parameters['active'] = $active;
|
||||
}
|
||||
|
||||
if (!isset($name)) {
|
||||
throw new \InvalidArgumentException('name must be set');
|
||||
}
|
||||
|
||||
if (isset($name)) {
|
||||
$parameters['name'] = $name;
|
||||
}
|
||||
|
||||
if (isset($makeCallUrl)) {
|
||||
$parameters['makeCallUrl'] = $makeCallUrl;
|
||||
}
|
||||
|
||||
if (isset($image)) {
|
||||
$parameters['image'] = $image;
|
||||
}
|
||||
|
||||
if (isset($additionalCodes)) {
|
||||
$parameters['additionalCodes'] = $additionalCodes;
|
||||
}
|
||||
|
||||
if (isset($externalPhones)) {
|
||||
$parameters['externalPhones'] = $externalPhones;
|
||||
}
|
||||
|
||||
if (isset($allowEdit)) {
|
||||
$parameters['allowEdit'] = $allowEdit;
|
||||
}
|
||||
|
||||
if (isset($inputEventSupported)) {
|
||||
$parameters['inputEventSupported'] = $inputEventSupported;
|
||||
}
|
||||
|
||||
if (isset($outputEventSupported)) {
|
||||
$parameters['outputEventSupported'] = $outputEventSupported;
|
||||
}
|
||||
|
||||
if (isset($hangupEventSupported)) {
|
||||
$parameters['hangupEventSupported'] = $hangupEventSupported;
|
||||
}
|
||||
|
||||
if (isset($changeUserStatusUrl)) {
|
||||
$parameters['changeUserStatusUrl'] = $changeUserStatusUrl;
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
"/telephony/setting/$code/edit",
|
||||
"POST",
|
||||
['configuration' => json_encode($parameters)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit delivery configuration
|
||||
*
|
||||
* @param array $configuration
|
||||
*
|
||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||
* @throws \RetailCrm\Exception\CurlException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return \RetailCrm\Response\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/setting/%s/edit', $configuration['code']),
|
||||
"POST",
|
||||
['configuration' => json_encode($configuration)]
|
||||
);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Statistic
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Statistic as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Statistic class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Stores
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Stores as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Stores class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -55,31 +55,6 @@ trait Stores
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit store configuration
|
||||
*
|
||||
* @param array $configuration
|
||||
*
|
||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||
* @throws \RetailCrm\Exception\CurlException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
public function storeSettingsEdit(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('/store/setting/%s/edit', $configuration['code']),
|
||||
"POST",
|
||||
['configuration' => json_encode($configuration)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload store prices
|
||||
|
@ -30,108 +30,4 @@ use RetailCrm\Methods\V3\Telephony as Previous;
|
||||
trait Telephony
|
||||
{
|
||||
use Previous;
|
||||
|
||||
/**
|
||||
* Edit telephony settings
|
||||
*
|
||||
* @param string $code symbolic code
|
||||
* @param string $clientId client id
|
||||
* @param boolean $active telephony activity
|
||||
* @param mixed $name service name
|
||||
* @param mixed $makeCallUrl service init url
|
||||
* @param mixed $image service logo url(svg file)
|
||||
*
|
||||
* @param array $additionalCodes
|
||||
* @param array $externalPhones
|
||||
* @param bool $allowEdit
|
||||
* @param bool $inputEventSupported
|
||||
* @param bool $outputEventSupported
|
||||
* @param bool $hangupEventSupported
|
||||
* @param bool $changeUserStatusUrl
|
||||
*
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
public function telephonySettingsEdit(
|
||||
$code,
|
||||
$clientId,
|
||||
$active = false,
|
||||
$name = false,
|
||||
$makeCallUrl = false,
|
||||
$image = false,
|
||||
$additionalCodes = [],
|
||||
$externalPhones = [],
|
||||
$allowEdit = false,
|
||||
$inputEventSupported = false,
|
||||
$outputEventSupported = false,
|
||||
$hangupEventSupported = false,
|
||||
$changeUserStatusUrl = false
|
||||
) {
|
||||
if (!isset($code)) {
|
||||
throw new \InvalidArgumentException('Code must be set');
|
||||
}
|
||||
|
||||
$parameters['code'] = $code;
|
||||
|
||||
if (!isset($clientId)) {
|
||||
throw new \InvalidArgumentException('client id must be set');
|
||||
}
|
||||
|
||||
$parameters['clientId'] = $clientId;
|
||||
|
||||
if (!isset($active)) {
|
||||
$parameters['active'] = false;
|
||||
} else {
|
||||
$parameters['active'] = $active;
|
||||
}
|
||||
|
||||
if (!isset($name)) {
|
||||
throw new \InvalidArgumentException('name must be set');
|
||||
}
|
||||
|
||||
if (isset($name)) {
|
||||
$parameters['name'] = $name;
|
||||
}
|
||||
|
||||
if (isset($makeCallUrl)) {
|
||||
$parameters['makeCallUrl'] = $makeCallUrl;
|
||||
}
|
||||
|
||||
if (isset($image)) {
|
||||
$parameters['image'] = $image;
|
||||
}
|
||||
|
||||
if (isset($additionalCodes)) {
|
||||
$parameters['additionalCodes'] = $additionalCodes;
|
||||
}
|
||||
|
||||
if (isset($externalPhones)) {
|
||||
$parameters['externalPhones'] = $externalPhones;
|
||||
}
|
||||
|
||||
if (isset($allowEdit)) {
|
||||
$parameters['allowEdit'] = $allowEdit;
|
||||
}
|
||||
|
||||
if (isset($inputEventSupported)) {
|
||||
$parameters['inputEventSupported'] = $inputEventSupported;
|
||||
}
|
||||
|
||||
if (isset($outputEventSupported)) {
|
||||
$parameters['outputEventSupported'] = $outputEventSupported;
|
||||
}
|
||||
|
||||
if (isset($hangupEventSupported)) {
|
||||
$parameters['hangupEventSupported'] = $hangupEventSupported;
|
||||
}
|
||||
|
||||
if (isset($changeUserStatusUrl)) {
|
||||
$parameters['changeUserStatusUrl'] = $changeUserStatusUrl;
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
"/telephony/setting/$code/edit",
|
||||
"POST",
|
||||
['configuration' => json_encode($parameters)]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Users
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V4;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Users class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Customers
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\Customers as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Customers class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -115,12 +115,12 @@ trait Customers
|
||||
return $this->client->makeRequest(
|
||||
'/customers/notes/create',
|
||||
"POST",
|
||||
['note' => json_encode($note)]
|
||||
$this->fillSite($site, ['note' => json_encode($note)])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create customer note
|
||||
* Delete customer note
|
||||
*
|
||||
* @param integer $id
|
||||
*
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Delivery
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\Delivery as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Delivery class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* Marketplace
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
* @author RetailCrm <integration@retailcrm.ru>
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Methods\V5;
|
||||
|
||||
use RetailCrm\Methods\V4\Marketplace as Previous;
|
||||
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* Marketplace class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
* @author RetailCrm <integration@retailcrm.ru>
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
|
||||
*/
|
||||
trait Marketplace
|
||||
{
|
||||
use Previous;
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Orders
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -14,13 +14,12 @@
|
||||
|
||||
namespace RetailCrm\Methods\V5;
|
||||
|
||||
use RetailCrm\Response\ApiResponse;
|
||||
use RetailCrm\Methods\V4\Orders as Previous;
|
||||
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Orders class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Packs
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\Packs as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Packs class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* References
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\References as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* References class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Statistic
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Statistic as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Statistic class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Stores
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\Stores as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Stores class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Tasks
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V5;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Tasks class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait
|
||||
* Users
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
@ -20,7 +20,7 @@ use RetailCrm\Methods\V4\Users as Previous;
|
||||
/**
|
||||
* PHP version 5.4
|
||||
*
|
||||
* TaskTrait class
|
||||
* Users class
|
||||
*
|
||||
* @category RetailCrm
|
||||
* @package RetailCrm
|
||||
|
@ -34,7 +34,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersCreate()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$externalId = 'c-create-' . time();
|
||||
|
||||
@ -59,7 +59,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCreateExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->customersCreate([]);
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersGet(array $ids)
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->customersGet(678678678);
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -99,7 +99,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersGetException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->customersGet(678678678, 'asdf');
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersEdit(array $ids)
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->customersEdit(
|
||||
[
|
||||
@ -138,7 +138,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersEditExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->customersEdit([], 'asdf');
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersEditException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->customersEdit(['id' => 678678678], 'asdf');
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersList()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->customersList();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -185,7 +185,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersFixExternalIdsException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->customersFixExternalIds([]);
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersFixExternalIds()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->ordersCreate([
|
||||
'firstName' => 'Aaa111',
|
||||
@ -246,7 +246,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersUploadExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->customersUpload([]);
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ class ApiClientCustomersTest extends TestCase
|
||||
*/
|
||||
public function testCustomersUpload()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$externalIdA = 'upload-a-' . time();
|
||||
$externalIdB = 'upload-b-' . time();
|
||||
|
@ -34,7 +34,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersCreate()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$externalId = 'o-create-' . time();
|
||||
|
||||
@ -58,7 +58,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersCreateExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->ordersCreate([]);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersStatuses(array $ids)
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->ordersStatuses();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -117,7 +117,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersGet(array $ids)
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->ordersGet(678678678);
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -143,7 +143,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersGetException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->ordersGet(678678678, 'asdf');
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersEdit(array $ids)
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->ordersEdit(
|
||||
[
|
||||
@ -182,7 +182,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersEditExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->ordersEdit([], 'asdf');
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersEditException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->ordersEdit(['id' => 678678678], 'asdf');
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersHistory()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->ordersHistory();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -214,7 +214,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersList()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->ordersList();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -238,7 +238,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersFixExternalIdsException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->ordersFixExternalIds([]);
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersFixExternalIds()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->ordersCreate([
|
||||
'firstName' => 'Aaa',
|
||||
@ -292,7 +292,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersUploadExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->ordersUpload([]);
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersUpload()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$externalIdA = 'upload-a-' . time();
|
||||
$externalIdB = 'upload-b-' . time();
|
||||
|
@ -34,7 +34,7 @@ class ApiClientReferenceTest extends TestCase
|
||||
*/
|
||||
public function testList($name)
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$method = $name . 'List';
|
||||
$response = $client->request->$method();
|
||||
@ -56,7 +56,7 @@ class ApiClientReferenceTest extends TestCase
|
||||
*/
|
||||
public function testEditingException($name)
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$method = $name . 'Edit';
|
||||
$client->request->$method([]);
|
||||
@ -70,7 +70,7 @@ class ApiClientReferenceTest extends TestCase
|
||||
*/
|
||||
public function testEditing($name)
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$code = 'dict-' . strtolower($name) . '-' . time();
|
||||
$method = $name . 'Edit';
|
||||
@ -104,7 +104,7 @@ class ApiClientReferenceTest extends TestCase
|
||||
public function testSiteEditing()
|
||||
{
|
||||
$name = 'sites';
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$code = 'dict-' . strtolower($name) . '-' . time();
|
||||
$method = $name . 'Edit';
|
||||
|
@ -35,7 +35,7 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testStoreCreate()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->storesEdit(['name' => self::SNAME, 'code' => self::SCODE]);
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -48,7 +48,7 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testStoreInventories()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->storeInventories();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -66,7 +66,7 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testInventoriesException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
$client->request->storeInventoriesUpload([]);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testInventoriesUpload()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->storeInventoriesUpload([
|
||||
[
|
||||
@ -109,7 +109,7 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testInventoriesFailed()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$externalIdA = 'upload-a-' . time();
|
||||
$externalIdB = 'upload-b-' . time();
|
||||
@ -136,7 +136,7 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testStoreProducts()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->storeProducts();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
|
@ -40,7 +40,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonySettingsEdit()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->telephonySettingsEdit(
|
||||
self::TEL_CODE,
|
||||
@ -67,7 +67,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonySettingsGet()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->telephonySettingsGet(self::TEL_CODE);
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -84,7 +84,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonyEvent()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->telephonyCallEvent(
|
||||
'+79999999999',
|
||||
@ -109,7 +109,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonyUpload()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->telephonyCallsUpload(
|
||||
[
|
||||
@ -148,7 +148,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonyManager()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v4');
|
||||
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
|
||||
|
||||
$response = $client->request->telephonyCallManager('+79999999999', 1);
|
||||
|
||||
|
@ -34,7 +34,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersCreate()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$externalId = 'o-create-' . time();
|
||||
|
||||
@ -58,7 +58,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersCreateExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
$client->request->ordersCreate([]);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersStatuses(array $ids)
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->ordersStatuses();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -117,7 +117,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersGet(array $ids)
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->ordersGet(678678678);
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -143,7 +143,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersGetException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
$client->request->ordersGet(678678678, 'asdf');
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersEdit(array $ids)
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->ordersEdit(
|
||||
[
|
||||
@ -182,7 +182,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersEditExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
$client->request->ordersEdit([], 'asdf');
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersEditException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
$client->request->ordersEdit(['id' => 678678678], 'asdf');
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersHistory()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->ordersHistory();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -214,7 +214,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersList()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->ordersList();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -238,7 +238,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersFixExternalIdsException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
$client->request->ordersFixExternalIds([]);
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersFixExternalIds()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->ordersCreate([
|
||||
'firstName' => 'Aaa',
|
||||
@ -292,7 +292,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersUploadExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
$client->request->ordersUpload([]);
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersUpload()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$externalIdA = 'upload-a-' . time();
|
||||
$externalIdB = 'upload-b-' . time();
|
||||
@ -335,7 +335,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
*/
|
||||
public function testOrdersCombine()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$responseCreateFirst = $client->request->ordersCreate([
|
||||
'firstName' => 'Aaa111',
|
||||
@ -372,7 +372,7 @@ class ApiClientOrdersTest extends TestCase
|
||||
|
||||
public function testOrdersPayment()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
$externalId = 'AA-' . time();
|
||||
|
||||
$responseCreateFirst = $client->request->ordersCreate([
|
||||
|
@ -32,7 +32,7 @@ class ApiClientPacksTest extends TestCase
|
||||
*/
|
||||
public function testPacksHistory()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->ordersPacksHistory();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -53,7 +53,8 @@ class ApiClientPacksTest extends TestCase
|
||||
*/
|
||||
public function testPacksCreateFailed()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$pack = [
|
||||
'itemId' => 12,
|
||||
'store' => 'test',
|
||||
|
@ -33,8 +33,7 @@ class ApiClientPricesTest extends TestCase
|
||||
*/
|
||||
public function testPricesEdit()
|
||||
{
|
||||
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->pricesTypesEdit(
|
||||
[
|
||||
@ -56,8 +55,7 @@ class ApiClientPricesTest extends TestCase
|
||||
*/
|
||||
public function testPricesGet()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
$response = $client->request->pricesTypes();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
|
||||
@ -72,7 +70,7 @@ class ApiClientPricesTest extends TestCase
|
||||
*/
|
||||
public function testPricesUploadExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
$client->request->storePricesUpload([]);
|
||||
}
|
||||
|
||||
@ -82,7 +80,8 @@ class ApiClientPricesTest extends TestCase
|
||||
*/
|
||||
public function testPricesUpload()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$xmlIdA = 'upload-a-' . time();
|
||||
$xmlIdB = 'upload-b-' . time();
|
||||
|
@ -34,7 +34,8 @@ class ApiClientReferenceTest extends TestCase
|
||||
*/
|
||||
public function testList($name)
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$method = $name . 'List';
|
||||
$response = $client->request->$method();
|
||||
@ -56,7 +57,8 @@ class ApiClientReferenceTest extends TestCase
|
||||
*/
|
||||
public function testEditingException($name)
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$method = $name . 'Edit';
|
||||
$client->request->$method([]);
|
||||
@ -70,7 +72,8 @@ class ApiClientReferenceTest extends TestCase
|
||||
*/
|
||||
public function testEditing($name)
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$code = 'dict-' . strtolower($name) . '-' . time();
|
||||
$method = $name . 'Edit';
|
||||
@ -104,7 +107,8 @@ class ApiClientReferenceTest extends TestCase
|
||||
public function testSiteEditing()
|
||||
{
|
||||
$name = 'sites';
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$code = 'dict-' . strtolower($name) . '-' . time();
|
||||
$method = $name . 'Edit';
|
||||
|
@ -35,7 +35,8 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testStoreCreate()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->storesEdit(['name' => self::SNAME, 'code' => self::SCODE]);
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -48,7 +49,8 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testStoreInventories()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->storeInventories();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -66,7 +68,8 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testInventoriesException()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
$client->request->storeInventoriesUpload([]);
|
||||
}
|
||||
|
||||
@ -75,7 +78,8 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testInventoriesUpload()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->storeInventoriesUpload([
|
||||
[
|
||||
@ -109,7 +113,8 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testInventoriesFailed()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$externalIdA = 'upload-a-' . time();
|
||||
$externalIdB = 'upload-b-' . time();
|
||||
@ -136,7 +141,8 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testStoreProducts()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->storeProducts();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -149,7 +155,8 @@ class ApiClientStoreTest extends TestCase
|
||||
*/
|
||||
public function testStoreProductsGroups()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->storeProductsGroups();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
|
@ -32,8 +32,8 @@ class ApiClientTasksTest extends TestCase
|
||||
*/
|
||||
public function testTasksList()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v5');
|
||||
|
||||
$client = static::getApiClient();
|
||||
$response = $client->request->tasksList();
|
||||
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -46,14 +46,14 @@ class ApiClientTasksTest extends TestCase
|
||||
*/
|
||||
public function testTasksCreateExceptionEmpty()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v5');
|
||||
$client = static::getApiClient();
|
||||
$client->request->tasksCreate([]);
|
||||
}
|
||||
|
||||
public function testTasksCRU()
|
||||
{
|
||||
$client = static::getApiClient(null, null, 'v5');
|
||||
|
||||
$client = static::getApiClient();
|
||||
$task = [
|
||||
'text' => 'test task',
|
||||
'commentary' => 'test task commentary',
|
||||
|
@ -31,33 +31,6 @@ class ApiClientTelephonyTest extends TestCase
|
||||
const TEL_CLIENT = '456';
|
||||
const TEL_IMAGE = 'http://www.mec.ph/horizon/wp-content/uploads/2011/11/telephony.svg';
|
||||
|
||||
/**
|
||||
* Settings Edit test
|
||||
*
|
||||
* @group telephony
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testTelephonySettingsEdit()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$response = $client->request->telephonySettingsEdit(
|
||||
self::TEL_CODE,
|
||||
self::TEL_CLIENT,
|
||||
true,
|
||||
'TestTelephonyV5',
|
||||
false,
|
||||
self::TEL_IMAGE,
|
||||
[['userId' => $_SERVER['CRM_USER_ID'], 'code' => '101']],
|
||||
[['siteCode' => 'api-client-php', 'externalPhone' => '+74950000000']]
|
||||
);
|
||||
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
|
||||
static::assertTrue($response->isSuccessful());
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings Get test
|
||||
*
|
||||
@ -67,8 +40,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonySettingsGet()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
$response = $client->request->telephonySettingsGet(self::TEL_CODE);
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
static::assertEquals(200, $response->getStatusCode());
|
||||
@ -84,8 +56,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonyEvent()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
$response = $client->request->telephonyCallEvent(
|
||||
'+79999999999',
|
||||
'in',
|
||||
@ -109,8 +80,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonyUpload()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
$response = $client->request->telephonyCallsUpload(
|
||||
[
|
||||
[
|
||||
@ -148,8 +118,7 @@ class ApiClientTelephonyTest extends TestCase
|
||||
*/
|
||||
public function testTelephonyManager()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
$response = $client->request->telephonyCallManager('+79999999999', 1);
|
||||
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
|
@ -32,7 +32,7 @@ class ApiClientUsersTest extends TestCase
|
||||
*/
|
||||
public function testUsersGroups()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->usersGroups();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -45,7 +45,7 @@ class ApiClientUsersTest extends TestCase
|
||||
*/
|
||||
public function testUsersList()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
$client = static::getApiClient();
|
||||
|
||||
$response = $client->request->usersList();
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
@ -58,8 +58,7 @@ class ApiClientUsersTest extends TestCase
|
||||
*/
|
||||
public function testUsersGet()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
$response = $client->request->usersGet($_SERVER["CRM_USER_ID"]);
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
|
||||
@ -71,8 +70,7 @@ class ApiClientUsersTest extends TestCase
|
||||
*/
|
||||
public function testUsersStatus()
|
||||
{
|
||||
$client = static::getApiClient(null, null, "v5");
|
||||
|
||||
$client = static::getApiClient();
|
||||
$response = $client->request->usersStatus($_SERVER["CRM_USER_ID"], 'dinner');
|
||||
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
|
||||
|
Loading…
Reference in New Issue
Block a user