1
0
mirror of synced 2024-11-21 21:06:07 +03:00

Minor bugfixes (#42)

This commit is contained in:
Alex Lushpai 2017-06-22 16:42:42 +03:00 committed by GitHub
parent a18767bddc
commit 4f57734e92
48 changed files with 356 additions and 377 deletions

View File

@ -15,7 +15,7 @@ Use [API documentation](http://retailcrm.github.io/api-client-php)
2) Run into your project directory: 2) Run into your project directory:
```bash ```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. 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( $client = new \RetailCrm\ApiClient(
'https://demo.retailcrm.ru', 'https://demo.retailcrm.ru',
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH', 'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
'v5' \RetailCrm\ApiClient::V5
); );
try { try {
@ -65,7 +65,7 @@ if ($response->isSuccessful()) {
$client = new \RetailCrm\ApiClient( $client = new \RetailCrm\ApiClient(
'https://demo.retailcrm.ru', 'https://demo.retailcrm.ru',
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH', 'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
'v4' \RetailCrm\ApiClient::V4
); );
try { try {

View File

@ -15,7 +15,7 @@ PHP-клиент для работы с [retailCRM API](http://www.retailcrm.ru/
2) Выполните в папке проекта: 2) Выполните в папке проекта:
```bash ```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/`. При отсутствии файла конфига или папки с вендорами они будут созданы. В конфиг `composer.json` вашего проекта будет добавлена библиотека `retailcrm/api-client-php`, которая установится в папку `vendor/`. При отсутствии файла конфига или папки с вендорами они будут созданы.
@ -32,7 +32,7 @@ require 'path/to/vendor/autoload.php';
$client = new \RetailCrm\ApiClient( $client = new \RetailCrm\ApiClient(
'https://demo.retailcrm.ru', 'https://demo.retailcrm.ru',
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH', 'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
'v5' \RetailCrm\ApiClient::V5
); );
try { try {
@ -67,7 +67,7 @@ if ($response->isSuccessful()) {
$client = new \RetailCrm\ApiClient( $client = new \RetailCrm\ApiClient(
'https://demo.retailcrm.ru', 'https://demo.retailcrm.ru',
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH', 'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
'v4' \RetailCrm\ApiClient::V4
); );
try { try {

View File

@ -34,6 +34,10 @@ class ApiClient
public $request; public $request;
public $version; public $version;
const V3 = 'v3';
const V4 = 'v4';
const V5 = 'v5';
/** /**
* Init version based client * Init version based client
* *
@ -43,18 +47,18 @@ class ApiClient
* @param string $site site code * @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; $this->version = $version;
switch ($version) { switch ($version) {
case 'v5': case self::V5:
$this->request = new ApiVersion5($url, $apiKey, $version, $site); $this->request = new ApiVersion5($url, $apiKey, $version, $site);
break; break;
case 'v4': case self::V4:
$this->request = new ApiVersion4($url, $apiKey, $version, $site); $this->request = new ApiVersion4($url, $apiKey, $version, $site);
break; break;
case 'v3': case self::V3:
$this->request = new ApiVersion3($url, $apiKey, $version, $site); $this->request = new ApiVersion3($url, $apiKey, $version, $site);
break; break;
} }

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* API client class * Abstract API client
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Http\Client;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* API client class * Abstract API client class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* API client class * API client v3
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* API client class * API client v3 class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* API client class * API client v4
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* API client class * API client v4 class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -49,6 +49,7 @@ class ApiVersion4 extends AbstractLoader
use V4\Orders; use V4\Orders;
use V4\Packs; use V4\Packs;
use V4\References; use V4\References;
use V4\Settings;
use V4\Statistic; use V4\Statistic;
use V4\Stores; use V4\Stores;
use V4\Telephony; use V4\Telephony;

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* API client class * API client v5
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V5;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* API client class * API client v5 class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -46,7 +46,6 @@ class ApiVersion5 extends AbstractLoader
use V5\Customers; use V5\Customers;
use V5\CustomFields; use V5\CustomFields;
use V5\Delivery; use V5\Delivery;
use V5\Marketplace;
use V5\Orders; use V5\Orders;
use V5\Packs; use V5\Packs;
use V5\References; use V5\References;

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* Class CurlException * CurlException
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* Class InvalidJsonException * InvalidJsonException
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Customers
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Customers class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Orders
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Orders class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Packs
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Packs class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * References
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * References class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* Statistic class * Statistic
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Stores
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V3;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Stores class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Customers
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Customers as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Customers class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Delivery
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V4;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Delivery class
* *
* @category RetailCrm * @category RetailCrm
* @package 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 * Delivery tracking update
* *

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Orders
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Orders as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Orders class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Packs
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Packs as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Packs class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * References
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\References as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * References class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View 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)]
);
}
}

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Statistic
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Statistic as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Statistic class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Stores
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Stores as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Stores class
* *
* @category RetailCrm * @category RetailCrm
* @package 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 * Upload store prices

View File

@ -30,108 +30,4 @@ use RetailCrm\Methods\V3\Telephony as Previous;
trait Telephony trait Telephony
{ {
use Previous; 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)]
);
}
} }

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Users
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V4;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Users class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Customers
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\Customers as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Customers class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -115,12 +115,12 @@ trait Customers
return $this->client->makeRequest( return $this->client->makeRequest(
'/customers/notes/create', '/customers/notes/create',
"POST", "POST",
['note' => json_encode($note)] $this->fillSite($site, ['note' => json_encode($note)])
); );
} }
/** /**
* Create customer note * Delete customer note
* *
* @param integer $id * @param integer $id
* *

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Delivery
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\Delivery as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Delivery class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -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;
}

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Orders
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -14,13 +14,12 @@
namespace RetailCrm\Methods\V5; namespace RetailCrm\Methods\V5;
use RetailCrm\Response\ApiResponse;
use RetailCrm\Methods\V4\Orders as Previous; use RetailCrm\Methods\V4\Orders as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Orders class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Packs
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\Packs as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Packs class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * References
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\References as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * References class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Statistic
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V3\Statistic as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Statistic class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Stores
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -19,7 +19,7 @@ use RetailCrm\Methods\V4\Stores as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Stores class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Tasks
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -17,7 +17,7 @@ namespace RetailCrm\Methods\V5;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Tasks class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -3,7 +3,7 @@
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait * Users
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm
@ -20,7 +20,7 @@ use RetailCrm\Methods\V4\Users as Previous;
/** /**
* PHP version 5.4 * PHP version 5.4
* *
* TaskTrait class * Users class
* *
* @category RetailCrm * @category RetailCrm
* @package RetailCrm * @package RetailCrm

View File

@ -34,7 +34,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersCreate() public function testCustomersCreate()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$externalId = 'c-create-' . time(); $externalId = 'c-create-' . time();
@ -59,7 +59,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCreateExceptionEmpty() public function testCreateExceptionEmpty()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->customersCreate([]); $client->request->customersCreate([]);
} }
@ -73,7 +73,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersGet(array $ids) public function testCustomersGet(array $ids)
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->customersGet(678678678); $response = $client->request->customersGet(678678678);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -99,7 +99,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersGetException() public function testCustomersGetException()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->customersGet(678678678, 'asdf'); $client->request->customersGet(678678678, 'asdf');
} }
@ -111,7 +111,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersEdit(array $ids) public function testCustomersEdit(array $ids)
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->customersEdit( $response = $client->request->customersEdit(
[ [
@ -138,7 +138,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersEditExceptionEmpty() public function testCustomersEditExceptionEmpty()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->customersEdit([], 'asdf'); $client->request->customersEdit([], 'asdf');
} }
@ -148,7 +148,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersEditException() public function testCustomersEditException()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->customersEdit(['id' => 678678678], 'asdf'); $client->request->customersEdit(['id' => 678678678], 'asdf');
} }
@ -157,7 +157,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersList() public function testCustomersList()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->customersList(); $response = $client->request->customersList();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -185,7 +185,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersFixExternalIdsException() public function testCustomersFixExternalIdsException()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->customersFixExternalIds([]); $client->request->customersFixExternalIds([]);
} }
@ -194,7 +194,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersFixExternalIds() public function testCustomersFixExternalIds()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->ordersCreate([ $response = $client->request->ordersCreate([
'firstName' => 'Aaa111', 'firstName' => 'Aaa111',
@ -246,7 +246,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersUploadExceptionEmpty() public function testCustomersUploadExceptionEmpty()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->customersUpload([]); $client->request->customersUpload([]);
} }
@ -255,7 +255,7 @@ class ApiClientCustomersTest extends TestCase
*/ */
public function testCustomersUpload() public function testCustomersUpload()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$externalIdA = 'upload-a-' . time(); $externalIdA = 'upload-a-' . time();
$externalIdB = 'upload-b-' . time(); $externalIdB = 'upload-b-' . time();

View File

@ -34,7 +34,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersCreate() public function testOrdersCreate()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$externalId = 'o-create-' . time(); $externalId = 'o-create-' . time();
@ -58,7 +58,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersCreateExceptionEmpty() public function testOrdersCreateExceptionEmpty()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->ordersCreate([]); $client->request->ordersCreate([]);
} }
@ -70,7 +70,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersStatuses(array $ids) public function testOrdersStatuses(array $ids)
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->ordersStatuses(); $response = $client->request->ordersStatuses();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -117,7 +117,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersGet(array $ids) public function testOrdersGet(array $ids)
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->ordersGet(678678678); $response = $client->request->ordersGet(678678678);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -143,7 +143,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersGetException() public function testOrdersGetException()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->ordersGet(678678678, 'asdf'); $client->request->ordersGet(678678678, 'asdf');
} }
@ -155,7 +155,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersEdit(array $ids) public function testOrdersEdit(array $ids)
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->ordersEdit( $response = $client->request->ordersEdit(
[ [
@ -182,7 +182,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersEditExceptionEmpty() public function testOrdersEditExceptionEmpty()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->ordersEdit([], 'asdf'); $client->request->ordersEdit([], 'asdf');
} }
@ -192,7 +192,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersEditException() public function testOrdersEditException()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->ordersEdit(['id' => 678678678], 'asdf'); $client->request->ordersEdit(['id' => 678678678], 'asdf');
} }
@ -201,7 +201,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersHistory() public function testOrdersHistory()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->ordersHistory(); $response = $client->request->ordersHistory();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -214,7 +214,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersList() public function testOrdersList()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->ordersList(); $response = $client->request->ordersList();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -238,7 +238,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersFixExternalIdsException() public function testOrdersFixExternalIdsException()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->ordersFixExternalIds([]); $client->request->ordersFixExternalIds([]);
} }
@ -247,7 +247,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersFixExternalIds() public function testOrdersFixExternalIds()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->ordersCreate([ $response = $client->request->ordersCreate([
'firstName' => 'Aaa', 'firstName' => 'Aaa',
@ -292,7 +292,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersUploadExceptionEmpty() public function testOrdersUploadExceptionEmpty()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->ordersUpload([]); $client->request->ordersUpload([]);
} }
@ -301,7 +301,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersUpload() public function testOrdersUpload()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$externalIdA = 'upload-a-' . time(); $externalIdA = 'upload-a-' . time();
$externalIdB = 'upload-b-' . time(); $externalIdB = 'upload-b-' . time();

View File

@ -34,7 +34,7 @@ class ApiClientReferenceTest extends TestCase
*/ */
public function testList($name) public function testList($name)
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$method = $name . 'List'; $method = $name . 'List';
$response = $client->request->$method(); $response = $client->request->$method();
@ -56,7 +56,7 @@ class ApiClientReferenceTest extends TestCase
*/ */
public function testEditingException($name) public function testEditingException($name)
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$method = $name . 'Edit'; $method = $name . 'Edit';
$client->request->$method([]); $client->request->$method([]);
@ -70,7 +70,7 @@ class ApiClientReferenceTest extends TestCase
*/ */
public function testEditing($name) public function testEditing($name)
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$code = 'dict-' . strtolower($name) . '-' . time(); $code = 'dict-' . strtolower($name) . '-' . time();
$method = $name . 'Edit'; $method = $name . 'Edit';
@ -104,7 +104,7 @@ class ApiClientReferenceTest extends TestCase
public function testSiteEditing() public function testSiteEditing()
{ {
$name = 'sites'; $name = 'sites';
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$code = 'dict-' . strtolower($name) . '-' . time(); $code = 'dict-' . strtolower($name) . '-' . time();
$method = $name . 'Edit'; $method = $name . 'Edit';

View File

@ -35,7 +35,7 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testStoreCreate() 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]); $response = $client->request->storesEdit(['name' => self::SNAME, 'code' => self::SCODE]);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -48,7 +48,7 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testStoreInventories() public function testStoreInventories()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->storeInventories(); $response = $client->request->storeInventories();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -66,7 +66,7 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testInventoriesException() public function testInventoriesException()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client->request->storeInventoriesUpload([]); $client->request->storeInventoriesUpload([]);
} }
@ -75,7 +75,7 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testInventoriesUpload() public function testInventoriesUpload()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->storeInventoriesUpload([ $response = $client->request->storeInventoriesUpload([
[ [
@ -109,7 +109,7 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testInventoriesFailed() public function testInventoriesFailed()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$externalIdA = 'upload-a-' . time(); $externalIdA = 'upload-a-' . time();
$externalIdB = 'upload-b-' . time(); $externalIdB = 'upload-b-' . time();
@ -136,7 +136,7 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testStoreProducts() public function testStoreProducts()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->storeProducts(); $response = $client->request->storeProducts();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);

View File

@ -40,7 +40,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonySettingsEdit() public function testTelephonySettingsEdit()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->telephonySettingsEdit( $response = $client->request->telephonySettingsEdit(
self::TEL_CODE, self::TEL_CODE,
@ -67,7 +67,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonySettingsGet() public function testTelephonySettingsGet()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->telephonySettingsGet(self::TEL_CODE); $response = $client->request->telephonySettingsGet(self::TEL_CODE);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -84,7 +84,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonyEvent() public function testTelephonyEvent()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->telephonyCallEvent( $response = $client->request->telephonyCallEvent(
'+79999999999', '+79999999999',
@ -109,7 +109,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonyUpload() public function testTelephonyUpload()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->telephonyCallsUpload( $response = $client->request->telephonyCallsUpload(
[ [
@ -148,7 +148,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonyManager() public function testTelephonyManager()
{ {
$client = static::getApiClient(null, null, 'v4'); $client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$response = $client->request->telephonyCallManager('+79999999999', 1); $response = $client->request->telephonyCallManager('+79999999999', 1);

View File

@ -34,7 +34,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersCreate() public function testOrdersCreate()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$externalId = 'o-create-' . time(); $externalId = 'o-create-' . time();
@ -58,7 +58,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersCreateExceptionEmpty() public function testOrdersCreateExceptionEmpty()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$client->request->ordersCreate([]); $client->request->ordersCreate([]);
} }
@ -70,7 +70,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersStatuses(array $ids) public function testOrdersStatuses(array $ids)
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->ordersStatuses(); $response = $client->request->ordersStatuses();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -117,7 +117,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersGet(array $ids) public function testOrdersGet(array $ids)
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->ordersGet(678678678); $response = $client->request->ordersGet(678678678);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -143,7 +143,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersGetException() public function testOrdersGetException()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$client->request->ordersGet(678678678, 'asdf'); $client->request->ordersGet(678678678, 'asdf');
} }
@ -155,7 +155,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersEdit(array $ids) public function testOrdersEdit(array $ids)
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->ordersEdit( $response = $client->request->ordersEdit(
[ [
@ -182,7 +182,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersEditExceptionEmpty() public function testOrdersEditExceptionEmpty()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$client->request->ordersEdit([], 'asdf'); $client->request->ordersEdit([], 'asdf');
} }
@ -192,7 +192,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersEditException() public function testOrdersEditException()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$client->request->ordersEdit(['id' => 678678678], 'asdf'); $client->request->ordersEdit(['id' => 678678678], 'asdf');
} }
@ -201,7 +201,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersHistory() public function testOrdersHistory()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->ordersHistory(); $response = $client->request->ordersHistory();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -214,7 +214,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersList() public function testOrdersList()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->ordersList(); $response = $client->request->ordersList();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -238,7 +238,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersFixExternalIdsException() public function testOrdersFixExternalIdsException()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$client->request->ordersFixExternalIds([]); $client->request->ordersFixExternalIds([]);
} }
@ -247,7 +247,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersFixExternalIds() public function testOrdersFixExternalIds()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->ordersCreate([ $response = $client->request->ordersCreate([
'firstName' => 'Aaa', 'firstName' => 'Aaa',
@ -292,7 +292,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersUploadExceptionEmpty() public function testOrdersUploadExceptionEmpty()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$client->request->ordersUpload([]); $client->request->ordersUpload([]);
} }
@ -301,7 +301,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersUpload() public function testOrdersUpload()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$externalIdA = 'upload-a-' . time(); $externalIdA = 'upload-a-' . time();
$externalIdB = 'upload-b-' . time(); $externalIdB = 'upload-b-' . time();
@ -335,7 +335,7 @@ class ApiClientOrdersTest extends TestCase
*/ */
public function testOrdersCombine() public function testOrdersCombine()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$responseCreateFirst = $client->request->ordersCreate([ $responseCreateFirst = $client->request->ordersCreate([
'firstName' => 'Aaa111', 'firstName' => 'Aaa111',
@ -372,7 +372,7 @@ class ApiClientOrdersTest extends TestCase
public function testOrdersPayment() public function testOrdersPayment()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$externalId = 'AA-' . time(); $externalId = 'AA-' . time();
$responseCreateFirst = $client->request->ordersCreate([ $responseCreateFirst = $client->request->ordersCreate([

View File

@ -32,7 +32,7 @@ class ApiClientPacksTest extends TestCase
*/ */
public function testPacksHistory() public function testPacksHistory()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->ordersPacksHistory(); $response = $client->request->ordersPacksHistory();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -53,7 +53,8 @@ class ApiClientPacksTest extends TestCase
*/ */
public function testPacksCreateFailed() public function testPacksCreateFailed()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$pack = [ $pack = [
'itemId' => 12, 'itemId' => 12,
'store' => 'test', 'store' => 'test',

View File

@ -33,8 +33,7 @@ class ApiClientPricesTest extends TestCase
*/ */
public function testPricesEdit() public function testPricesEdit()
{ {
$client = static::getApiClient();
$client = static::getApiClient(null, null, "v5");
$response = $client->request->pricesTypesEdit( $response = $client->request->pricesTypesEdit(
[ [
@ -56,8 +55,7 @@ class ApiClientPricesTest extends TestCase
*/ */
public function testPricesGet() public function testPricesGet()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->pricesTypes(); $response = $client->request->pricesTypes();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertTrue(in_array($response->getStatusCode(), [200, 201])); static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
@ -72,7 +70,7 @@ class ApiClientPricesTest extends TestCase
*/ */
public function testPricesUploadExceptionEmpty() public function testPricesUploadExceptionEmpty()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$client->request->storePricesUpload([]); $client->request->storePricesUpload([]);
} }
@ -82,7 +80,8 @@ class ApiClientPricesTest extends TestCase
*/ */
public function testPricesUpload() public function testPricesUpload()
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$xmlIdA = 'upload-a-' . time(); $xmlIdA = 'upload-a-' . time();
$xmlIdB = 'upload-b-' . time(); $xmlIdB = 'upload-b-' . time();

View File

@ -34,7 +34,8 @@ class ApiClientReferenceTest extends TestCase
*/ */
public function testList($name) public function testList($name)
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$method = $name . 'List'; $method = $name . 'List';
$response = $client->request->$method(); $response = $client->request->$method();
@ -56,7 +57,8 @@ class ApiClientReferenceTest extends TestCase
*/ */
public function testEditingException($name) public function testEditingException($name)
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$method = $name . 'Edit'; $method = $name . 'Edit';
$client->request->$method([]); $client->request->$method([]);
@ -70,7 +72,8 @@ class ApiClientReferenceTest extends TestCase
*/ */
public function testEditing($name) public function testEditing($name)
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$code = 'dict-' . strtolower($name) . '-' . time(); $code = 'dict-' . strtolower($name) . '-' . time();
$method = $name . 'Edit'; $method = $name . 'Edit';
@ -104,7 +107,8 @@ class ApiClientReferenceTest extends TestCase
public function testSiteEditing() public function testSiteEditing()
{ {
$name = 'sites'; $name = 'sites';
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$code = 'dict-' . strtolower($name) . '-' . time(); $code = 'dict-' . strtolower($name) . '-' . time();
$method = $name . 'Edit'; $method = $name . 'Edit';

View File

@ -35,7 +35,8 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testStoreCreate() public function testStoreCreate()
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$response = $client->request->storesEdit(['name' => self::SNAME, 'code' => self::SCODE]); $response = $client->request->storesEdit(['name' => self::SNAME, 'code' => self::SCODE]);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -48,7 +49,8 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testStoreInventories() public function testStoreInventories()
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$response = $client->request->storeInventories(); $response = $client->request->storeInventories();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -66,7 +68,8 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testInventoriesException() public function testInventoriesException()
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$client->request->storeInventoriesUpload([]); $client->request->storeInventoriesUpload([]);
} }
@ -75,7 +78,8 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testInventoriesUpload() public function testInventoriesUpload()
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$response = $client->request->storeInventoriesUpload([ $response = $client->request->storeInventoriesUpload([
[ [
@ -109,7 +113,8 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testInventoriesFailed() public function testInventoriesFailed()
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$externalIdA = 'upload-a-' . time(); $externalIdA = 'upload-a-' . time();
$externalIdB = 'upload-b-' . time(); $externalIdB = 'upload-b-' . time();
@ -136,7 +141,8 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testStoreProducts() public function testStoreProducts()
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$response = $client->request->storeProducts(); $response = $client->request->storeProducts();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -149,7 +155,8 @@ class ApiClientStoreTest extends TestCase
*/ */
public function testStoreProductsGroups() public function testStoreProductsGroups()
{ {
$client = static::getApiClient(null, null, "v5");
$client = static::getApiClient();
$response = $client->request->storeProductsGroups(); $response = $client->request->storeProductsGroups();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);

View File

@ -32,8 +32,8 @@ class ApiClientTasksTest extends TestCase
*/ */
public function testTasksList() public function testTasksList()
{ {
$client = static::getApiClient(null, null, 'v5');
$client = static::getApiClient();
$response = $client->request->tasksList(); $response = $client->request->tasksList();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -46,14 +46,14 @@ class ApiClientTasksTest extends TestCase
*/ */
public function testTasksCreateExceptionEmpty() public function testTasksCreateExceptionEmpty()
{ {
$client = static::getApiClient(null, null, 'v5'); $client = static::getApiClient();
$client->request->tasksCreate([]); $client->request->tasksCreate([]);
} }
public function testTasksCRU() public function testTasksCRU()
{ {
$client = static::getApiClient(null, null, 'v5');
$client = static::getApiClient();
$task = [ $task = [
'text' => 'test task', 'text' => 'test task',
'commentary' => 'test task commentary', 'commentary' => 'test task commentary',

View File

@ -31,33 +31,6 @@ class ApiClientTelephonyTest extends TestCase
const TEL_CLIENT = '456'; const TEL_CLIENT = '456';
const TEL_IMAGE = 'http://www.mec.ph/horizon/wp-content/uploads/2011/11/telephony.svg'; 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 * Settings Get test
* *
@ -67,8 +40,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonySettingsGet() public function testTelephonySettingsGet()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->telephonySettingsGet(self::TEL_CODE); $response = $client->request->telephonySettingsGet(self::TEL_CODE);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(200, $response->getStatusCode()); static::assertEquals(200, $response->getStatusCode());
@ -84,8 +56,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonyEvent() public function testTelephonyEvent()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->telephonyCallEvent( $response = $client->request->telephonyCallEvent(
'+79999999999', '+79999999999',
'in', 'in',
@ -109,8 +80,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonyUpload() public function testTelephonyUpload()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->telephonyCallsUpload( $response = $client->request->telephonyCallsUpload(
[ [
[ [
@ -148,8 +118,7 @@ class ApiClientTelephonyTest extends TestCase
*/ */
public function testTelephonyManager() public function testTelephonyManager()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->telephonyCallManager('+79999999999', 1); $response = $client->request->telephonyCallManager('+79999999999', 1);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);

View File

@ -32,7 +32,7 @@ class ApiClientUsersTest extends TestCase
*/ */
public function testUsersGroups() public function testUsersGroups()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->usersGroups(); $response = $client->request->usersGroups();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -45,7 +45,7 @@ class ApiClientUsersTest extends TestCase
*/ */
public function testUsersList() public function testUsersList()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->usersList(); $response = $client->request->usersList();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -58,8 +58,7 @@ class ApiClientUsersTest extends TestCase
*/ */
public function testUsersGet() public function testUsersGet()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->usersGet($_SERVER["CRM_USER_ID"]); $response = $client->request->usersGet($_SERVER["CRM_USER_ID"]);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertTrue(in_array($response->getStatusCode(), [200, 201])); static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
@ -71,8 +70,7 @@ class ApiClientUsersTest extends TestCase
*/ */
public function testUsersStatus() public function testUsersStatus()
{ {
$client = static::getApiClient(null, null, "v5"); $client = static::getApiClient();
$response = $client->request->usersStatus($_SERVER["CRM_USER_ID"], 'dinner'); $response = $client->request->usersStatus($_SERVER["CRM_USER_ID"], 'dinner');
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response); static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertTrue(in_array($response->getStatusCode(), [200, 201])); static::assertTrue(in_array($response->getStatusCode(), [200, 201]));