models, prevent hangup from circular serialization of empty entities, improve compatibility with JMS Serializer (to simplify usage), (de)serialization callbacks
This commit is contained in:
parent
2828d88069
commit
879162f0ef
40 changed files with 1513 additions and 123 deletions
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
@ -12,6 +11,8 @@
|
|||
*/
|
||||
namespace Intaro\RetailCrm\Component\Json;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping\PostDeserialize;
|
||||
use Intaro\RetailCrm\Component\Json\Strategy\AnnotationReaderTrait;
|
||||
use Intaro\RetailCrm\Component\Json\Strategy\StrategyFactory;
|
||||
use RetailCrm\Exception\InvalidJsonException;
|
||||
|
||||
|
@ -22,6 +23,8 @@ use RetailCrm\Exception\InvalidJsonException;
|
|||
*/
|
||||
class Deserializer
|
||||
{
|
||||
use AnnotationReaderTrait;
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param string $json
|
||||
|
@ -47,6 +50,39 @@ class Deserializer
|
|||
*/
|
||||
public static function deserializeArray(string $type, array $value)
|
||||
{
|
||||
return StrategyFactory::deserializeStrategyByType($type)->deserialize($type, $value);
|
||||
$result = StrategyFactory::deserializeStrategyByType($type)->deserialize($type, $value);
|
||||
|
||||
static::processPostDeserialize($result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process post deserialize callback
|
||||
*
|
||||
* @param object $object
|
||||
*/
|
||||
private static function processPostDeserialize($object): void
|
||||
{
|
||||
$class = get_class($object);
|
||||
|
||||
if ($object) {
|
||||
try {
|
||||
$reflection = new \ReflectionClass($class);
|
||||
} catch (\ReflectionException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($reflection->getMethods() as $method) {
|
||||
$postDeserialize = static::annotationReader()
|
||||
->getMethodAnnotation($method, PostDeserialize::class);
|
||||
|
||||
if ($postDeserialize instanceof PostDeserialize) {
|
||||
$method->invoke($object);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Component\Json\Mapping
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
use Intaro\RetailCrm\Component\Doctrine\Common\Annotations\Annotation;
|
||||
use Intaro\RetailCrm\Component\Doctrine\Common\Annotations\Annotation\Target;
|
||||
|
||||
/**
|
||||
* Class PostDeserialize
|
||||
*
|
||||
* @package Intaro\RetailCrm\Component\Json\Mapping
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
final class PostDeserialize
|
||||
{
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Component\Json\Mapping
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
use Intaro\RetailCrm\Component\Doctrine\Common\Annotations\Annotation;
|
||||
use Intaro\RetailCrm\Component\Doctrine\Common\Annotations\Annotation\Target;
|
||||
|
||||
/**
|
||||
* Class PostDeserialize
|
||||
*
|
||||
* @package Intaro\RetailCrm\Component\Json\Mapping
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
final class PostSerialize
|
||||
{
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
@ -18,7 +17,7 @@ use Intaro\RetailCrm\Component\Doctrine\Common\Annotations\Annotation\Attribute;
|
|||
use Intaro\RetailCrm\Component\Doctrine\Common\Annotations\Annotation\Attributes;
|
||||
|
||||
/**
|
||||
* Class Name
|
||||
* Class SerializedName
|
||||
*
|
||||
* @package Intaro\RetailCrm\Component\Json\Mapping
|
||||
* @Annotation
|
||||
|
@ -27,7 +26,7 @@ use Intaro\RetailCrm\Component\Doctrine\Common\Annotations\Annotation\Attributes
|
|||
* )
|
||||
* @Target({"PROPERTY","ANNOTATION"})
|
||||
*/
|
||||
final class Name
|
||||
final class SerializedName
|
||||
{
|
||||
/**
|
||||
* Property name in result JSON
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
@ -12,6 +11,8 @@
|
|||
*/
|
||||
namespace Intaro\RetailCrm\Component\Json;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping\PostSerialize;
|
||||
use Intaro\RetailCrm\Component\Json\Strategy\AnnotationReaderTrait;
|
||||
use Intaro\RetailCrm\Component\Json\Strategy\StrategyFactory;
|
||||
use RetailCrm\Exception\InvalidJsonException;
|
||||
|
||||
|
@ -22,6 +23,8 @@ use RetailCrm\Exception\InvalidJsonException;
|
|||
*/
|
||||
class Serializer
|
||||
{
|
||||
use AnnotationReaderTrait;
|
||||
|
||||
/**
|
||||
* @param object $object
|
||||
*
|
||||
|
@ -45,6 +48,40 @@ class Serializer
|
|||
*/
|
||||
public static function serializeArray($object): array
|
||||
{
|
||||
return (array) StrategyFactory::serializeStrategyByType(gettype($object))->serialize($object);
|
||||
$result = (array) StrategyFactory::serializeStrategyByType(gettype($object))->serialize($object);
|
||||
|
||||
return static::processPostSerialize($object, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process post deserialize callback
|
||||
*
|
||||
* @param object $object
|
||||
* @param array $result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function processPostSerialize($object, array $result): array
|
||||
{
|
||||
$class = get_class($object);
|
||||
|
||||
if ($object) {
|
||||
try {
|
||||
$reflection = new \ReflectionClass($class);
|
||||
} catch (\ReflectionException $e) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
foreach ($reflection->getMethods() as $method) {
|
||||
$postDeserialize = static::annotationReader()
|
||||
->getMethodAnnotation($method, PostSerialize::class);
|
||||
|
||||
if ($postDeserialize instanceof PostSerialize) {
|
||||
return $method->invokeArgs($object, [$result]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
@ -38,6 +37,10 @@ class EntityStrategy implements DeserializeStrategyInterface
|
|||
*/
|
||||
public function deserialize(string $type, $value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$reflection = new \ReflectionClass($type);
|
||||
$instance = new $type();
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
@ -35,6 +34,10 @@ class EntityStrategy implements SerializeStrategyInterface
|
|||
*/
|
||||
public function serialize($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$reflection = new \ReflectionClass(get_class($value));
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
@ -147,7 +146,13 @@ class StrategyFactory
|
|||
}
|
||||
|
||||
if ($matches[0][1] === 'DateTime') {
|
||||
return $matches[0][2];
|
||||
$format = $matches[0][2];
|
||||
|
||||
if (strlen($format) > 2 && $format[0] === "'" && substr($format, -1) === "'") {
|
||||
return substr($format, 1, -1);
|
||||
}
|
||||
|
||||
return $format;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
|
|
57
intaro.retailcrm/lib/model/api/abstractapimodel.php
Normal file
57
intaro.retailcrm/lib/model/api/abstractapimodel.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping\PostDeserialize;
|
||||
use Intaro\RetailCrm\Component\Json\Mapping\PostSerialize;
|
||||
|
||||
/**
|
||||
* Class AbstractApiModel
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class AbstractApiModel implements ApiModelInterface
|
||||
{
|
||||
/**
|
||||
* @PostDeserialize()
|
||||
*/
|
||||
public function postDeserialize(): void
|
||||
{
|
||||
foreach ($this as $field => $value) {
|
||||
if (null === $value) {
|
||||
unset($this->{$field});
|
||||
}
|
||||
|
||||
if (is_string($value)) {
|
||||
$this->{$field} = null !== json_decode($value, true) ?
|
||||
json_decode($value, true, 512, JSON_BIGINT_AS_STRING) :
|
||||
('null' !== $value ?
|
||||
$value :
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes empty fields from serialized data
|
||||
*
|
||||
* @PostSerialize()
|
||||
* @param array $fields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function postSerialize(array $fields): array
|
||||
{
|
||||
return \RCrmActions::clearArr($fields);
|
||||
}
|
||||
}
|
193
intaro.retailcrm/lib/model/api/address.php
Normal file
193
intaro.retailcrm/lib/model/api/address.php
Normal file
|
@ -0,0 +1,193 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
|
||||
/**
|
||||
* Class Address
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class Address extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* ID адреса клиента
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Внешний ID
|
||||
*
|
||||
* @var string $externalId
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("externalId")
|
||||
*/
|
||||
public $externalId;
|
||||
|
||||
/**
|
||||
* Наименование адреса
|
||||
*
|
||||
* @var string $name
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("name")
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Адрес клиента является основным
|
||||
*
|
||||
* @var boolean $isMain
|
||||
*
|
||||
* @Mapping\Type("boolean")
|
||||
* @Mapping\SerializedName("isMain")
|
||||
*/
|
||||
public $isMain;
|
||||
|
||||
/**
|
||||
* Индекс
|
||||
*
|
||||
* @var string $index
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("index")
|
||||
*/
|
||||
public $index;
|
||||
|
||||
/**
|
||||
* Город
|
||||
*
|
||||
* @var string $city
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("city")
|
||||
*/
|
||||
public $city;
|
||||
|
||||
/**
|
||||
* Регион
|
||||
*
|
||||
* @var string $region
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("region")
|
||||
*/
|
||||
public $region;
|
||||
|
||||
/**
|
||||
* Улица
|
||||
*
|
||||
* @var string $street
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("street")
|
||||
*/
|
||||
public $street;
|
||||
|
||||
/**
|
||||
* Дом
|
||||
*
|
||||
* @var string $building
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("building")
|
||||
*/
|
||||
public $building;
|
||||
|
||||
/**
|
||||
* Номер квартиры/офиса
|
||||
*
|
||||
* @var string $flat
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("flat")
|
||||
*/
|
||||
public $flat;
|
||||
|
||||
/**
|
||||
* Этаж
|
||||
*
|
||||
* @var string $floor
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("floor")
|
||||
*/
|
||||
public $floor;
|
||||
|
||||
/**
|
||||
* Подъезд
|
||||
*
|
||||
* @var string $block
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("block")
|
||||
*/
|
||||
public $block;
|
||||
|
||||
/**
|
||||
* Строение
|
||||
*
|
||||
* @var string $house
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("house")
|
||||
*/
|
||||
public $house;
|
||||
|
||||
/**
|
||||
* Корпус
|
||||
*
|
||||
* @var string $housing
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("housing")
|
||||
*/
|
||||
public $housing;
|
||||
|
||||
/**
|
||||
* Метро
|
||||
*
|
||||
* @var string $metro
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("metro")
|
||||
*/
|
||||
public $metro;
|
||||
|
||||
/**
|
||||
* Заметка
|
||||
*
|
||||
* @var string $notes
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("notes")
|
||||
*/
|
||||
public $notes;
|
||||
|
||||
/**
|
||||
* Адрес в текстовом виде
|
||||
*
|
||||
* @var string $text
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("text")
|
||||
*/
|
||||
public $text;
|
||||
}
|
24
intaro.retailcrm/lib/model/api/apimodelinterface.php
Normal file
24
intaro.retailcrm/lib/model/api/apimodelinterface.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
/**
|
||||
* Interface ApiModelInterface
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
interface ApiModelInterface
|
||||
{
|
||||
public function postDeserialize(): void;
|
||||
|
||||
public function postSerialize(array $fields): array;
|
||||
}
|
142
intaro.retailcrm/lib/model/api/company.php
Normal file
142
intaro.retailcrm/lib/model/api/company.php
Normal file
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class Company
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class Company extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* ID компании
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Внешний идентификатор компании в складской системе
|
||||
*
|
||||
* @var string $uuid
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("uuid")
|
||||
*/
|
||||
public $uuid;
|
||||
|
||||
/**
|
||||
* Главная компания
|
||||
*
|
||||
* @var boolean $isMain
|
||||
*
|
||||
* @Mapping\Type("boolean")
|
||||
* @Mapping\SerializedName("isMain")
|
||||
*/
|
||||
public $isMain;
|
||||
|
||||
/**
|
||||
* Магазин
|
||||
*
|
||||
* @var string $site
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("site")
|
||||
*/
|
||||
public $site;
|
||||
|
||||
/**
|
||||
* Внешний ID компании
|
||||
*
|
||||
* @var string $externalId
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("externalId")
|
||||
*/
|
||||
public $externalId;
|
||||
|
||||
/**
|
||||
* Активность
|
||||
*
|
||||
* @var string $active
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("active")
|
||||
*/
|
||||
public $active;
|
||||
|
||||
/**
|
||||
* Наименование
|
||||
*
|
||||
* @var string $name
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("name")
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Бренд
|
||||
*
|
||||
* @var string $brand
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("brand")
|
||||
*/
|
||||
public $brand;
|
||||
|
||||
/**
|
||||
* Дата создания
|
||||
*
|
||||
* @var \DateTime $createdAt
|
||||
*
|
||||
* @Mapping\Type("DateTime<'Y-m-d H:i:s'>")
|
||||
* @Mapping\SerializedName("createdAt")
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* Реквизиты
|
||||
*
|
||||
* @var Contragent $contragent
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Contragent")
|
||||
* @Mapping\SerializedName("contragent")
|
||||
*/
|
||||
public $contragent;
|
||||
|
||||
/**
|
||||
* Адрес
|
||||
*
|
||||
* @var Address $address
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Address")
|
||||
* @Mapping\SerializedName("address")
|
||||
*/
|
||||
public $address;
|
||||
|
||||
/**
|
||||
* Ассоциативный массив пользовательских полей
|
||||
*
|
||||
* @var array $customFields
|
||||
*
|
||||
* @Mapping\Type("array")
|
||||
* @Mapping\SerializedName("customFields")
|
||||
*/
|
||||
public $customFields;
|
||||
}
|
173
intaro.retailcrm/lib/model/api/contragent.php
Normal file
173
intaro.retailcrm/lib/model/api/contragent.php
Normal file
|
@ -0,0 +1,173 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
|
||||
/**
|
||||
* Class Contragent
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class Contragent extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* Тип контрагента
|
||||
*
|
||||
* @var string $contragentType
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("contragentType")
|
||||
*/
|
||||
public $contragentType;
|
||||
|
||||
/**
|
||||
* Полное наименование
|
||||
*
|
||||
* @var string $legalName
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("legalName")
|
||||
*/
|
||||
public $legalName;
|
||||
|
||||
/**
|
||||
* Адрес регистрации
|
||||
*
|
||||
* @var string $legalAddress
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("legalAddress")
|
||||
*/
|
||||
public $legalAddress;
|
||||
|
||||
/**
|
||||
* ИНН
|
||||
*
|
||||
* @var string $inn
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("INN")
|
||||
*/
|
||||
public $inn;
|
||||
|
||||
/**
|
||||
* КПП
|
||||
*
|
||||
* @var string $kpp
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("KPP")
|
||||
*/
|
||||
public $kpp;
|
||||
|
||||
/**
|
||||
* ОКПО
|
||||
*
|
||||
* @var string $okpo
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("OKPO")
|
||||
*/
|
||||
public $okpo;
|
||||
|
||||
/**
|
||||
* ОГРН
|
||||
*
|
||||
* @var string $ogrn
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("OGRN")
|
||||
*/
|
||||
public $ogrn;
|
||||
|
||||
/**
|
||||
* ОГРНИП
|
||||
*
|
||||
* @var string $ogrnip
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("OGRNIP")
|
||||
*/
|
||||
public $ogrnip;
|
||||
|
||||
/**
|
||||
* Номер свидетельства
|
||||
*
|
||||
* @var string $certificateNumber
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("certificateNumber")
|
||||
*/
|
||||
public $certificateNumber;
|
||||
|
||||
/**
|
||||
* Дата свидетельства
|
||||
*
|
||||
* @var \DateTime $certificateDate
|
||||
*
|
||||
* @Mapping\Type("DateTime<'Y-m-d'>")
|
||||
* @Mapping\SerializedName("certificateDate")
|
||||
*/
|
||||
public $certificateDate;
|
||||
|
||||
/**
|
||||
* БИК
|
||||
*
|
||||
* @var string $bik
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("BIK")
|
||||
*/
|
||||
public $bik;
|
||||
|
||||
/**
|
||||
* Банк
|
||||
*
|
||||
* @var string $bank
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("bank")
|
||||
*/
|
||||
public $bank;
|
||||
|
||||
/**
|
||||
* Адрес банка
|
||||
*
|
||||
* @var string $bankAddress
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("bankAddress")
|
||||
*/
|
||||
public $bankAddress;
|
||||
|
||||
/**
|
||||
* Корр. счёт
|
||||
*
|
||||
* @var string $corrAccount
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("corrAccount")
|
||||
*/
|
||||
public $corrAccount;
|
||||
|
||||
/**
|
||||
* Расчётный счёт
|
||||
*
|
||||
* @var string $bankAccount
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("bankAccount")
|
||||
*/
|
||||
public $bankAccount;
|
||||
}
|
262
intaro.retailcrm/lib/model/api/customer.php
Normal file
262
intaro.retailcrm/lib/model/api/customer.php
Normal file
|
@ -0,0 +1,262 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class Customer
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class Customer extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* ID [обычного|корпоративного] клиента
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Внешний ID [обычного|корпоративного] клиента
|
||||
*
|
||||
* @var string $externalId
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("externalId")
|
||||
*/
|
||||
public $externalId;
|
||||
|
||||
/**
|
||||
* Внешний идентификатор [обычного|корпоративного] клиента в складской системе
|
||||
*
|
||||
* @var string $uuid
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("uuid")
|
||||
*/
|
||||
public $uuid;
|
||||
|
||||
/**
|
||||
* Тип клиента (корпоративный или обычный)
|
||||
*
|
||||
* @var string $type
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("type")
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* Контактное лицо корпоративного клиента является основным
|
||||
*
|
||||
* @var string $isMain
|
||||
*
|
||||
* @Mapping\Type("boolean")
|
||||
* @Mapping\SerializedName("isMain")
|
||||
*/
|
||||
public $isMain;
|
||||
|
||||
/**
|
||||
* Является ли клиент контактным лицом корпоративного клиента
|
||||
*
|
||||
* @var boolean $isContact
|
||||
*
|
||||
* @Mapping\Type("boolean")
|
||||
* @Mapping\SerializedName("isContact")
|
||||
*/
|
||||
public $isContact;
|
||||
|
||||
/**
|
||||
* Дата создания в системе
|
||||
*
|
||||
* @var \DateTime $createdAt
|
||||
*
|
||||
* @Mapping\Type("DateTime<'Y-m-d H:i:s'>")
|
||||
* @Mapping\SerializedName("createdAt")
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* Имя
|
||||
*
|
||||
* @var string $firstName
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("firstName")
|
||||
*/
|
||||
public $firstName;
|
||||
|
||||
/**
|
||||
* Фамилия
|
||||
*
|
||||
* @var string $lastName
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("lastName")
|
||||
*/
|
||||
public $lastName;
|
||||
|
||||
/**
|
||||
* Отчество
|
||||
*
|
||||
* @var string $patronymic
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("patronymic")
|
||||
*/
|
||||
public $patronymic;
|
||||
|
||||
/**
|
||||
* Адрес электронной почты
|
||||
*
|
||||
* @var string $email
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("email")
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* Телефоны
|
||||
*
|
||||
* @var array $phones
|
||||
*
|
||||
* @Mapping\Type("array<Intaro\RetailCrm\Model\Api\Phone>")
|
||||
* @Mapping\SerializedName("phones")
|
||||
*/
|
||||
public $phones;
|
||||
|
||||
/**
|
||||
* ID менеджера, к которому привязан клиент
|
||||
*
|
||||
* @var integer $managerId
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("managerId")
|
||||
*/
|
||||
public $managerId;
|
||||
|
||||
/**
|
||||
* Реквизиты
|
||||
*
|
||||
* @var Contragent $contragent
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Contragent")
|
||||
* @Mapping\SerializedName("contragent")
|
||||
*/
|
||||
public $contragent;
|
||||
|
||||
/**
|
||||
* Список пользователских полей
|
||||
*
|
||||
* @var array $customFields
|
||||
*
|
||||
* @Mapping\Type("array")
|
||||
* @Mapping\SerializedName("customFields")
|
||||
*/
|
||||
public $customFields;
|
||||
|
||||
/**
|
||||
* Магазин, с которого пришел клиент
|
||||
*
|
||||
* @var string $site
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("site")
|
||||
*/
|
||||
public $site;
|
||||
|
||||
/**
|
||||
* Наименование
|
||||
*
|
||||
* @var string $nickName
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("nickName")
|
||||
*/
|
||||
public $nickName;
|
||||
|
||||
/**
|
||||
* Адрес
|
||||
*
|
||||
* @var Address $address
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Address")
|
||||
* @Mapping\SerializedName("address")
|
||||
*/
|
||||
public $address;
|
||||
|
||||
/**
|
||||
* Адреса
|
||||
*
|
||||
* @var array $addresses
|
||||
*
|
||||
* @Mapping\Type("array<Intaro\RetailCrm\Model\Api\Address>")
|
||||
* @Mapping\SerializedName("addresses")
|
||||
*/
|
||||
public $addresses;
|
||||
|
||||
/**
|
||||
* Основной адрес
|
||||
*
|
||||
* @var Address $mainAddress
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Address")
|
||||
* @Mapping\SerializedName("mainAddress")
|
||||
*/
|
||||
public $mainAddress;
|
||||
|
||||
/**
|
||||
* Компании
|
||||
*
|
||||
* @var array $companies
|
||||
*
|
||||
* @Mapping\Type("array<Intaro\RetailCrm\Model\Api\Company>")
|
||||
* @Mapping\SerializedName("companies")
|
||||
*/
|
||||
public $companies;
|
||||
|
||||
/**
|
||||
* Основная компания
|
||||
*
|
||||
* @var Company $mainCompany
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Company")
|
||||
* @Mapping\SerializedName("mainCompany")
|
||||
*/
|
||||
public $mainCompany;
|
||||
|
||||
/**
|
||||
* Контактные лица
|
||||
*
|
||||
* @var array $customerContacts
|
||||
*
|
||||
* @Mapping\Type("array<Intaro\RetailCrm\Model\Api\CustomerContact>")
|
||||
* @Mapping\SerializedName("customerContacts")
|
||||
*/
|
||||
public $customerContacts;
|
||||
|
||||
/**
|
||||
* Основное контактное лицо
|
||||
*
|
||||
* @var CustomerContact $mainCustomerContact
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\CustomerContact")
|
||||
* @Mapping\SerializedName("mainCustomerContact")
|
||||
*/
|
||||
public $mainCustomerContact;
|
||||
}
|
62
intaro.retailcrm/lib/model/api/customercontact.php
Normal file
62
intaro.retailcrm/lib/model/api/customercontact.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class CustomerContact
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class CustomerContact extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* ID контакта
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Главный контакт
|
||||
*
|
||||
* @var boolean $isMain
|
||||
*
|
||||
* @Mapping\Type("boolean")
|
||||
* @Mapping\SerializedName("isMain")
|
||||
*/
|
||||
public $isMain;
|
||||
|
||||
/**
|
||||
* Клиент
|
||||
*
|
||||
* @var Customer $customer
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Customer")
|
||||
* @Mapping\SerializedName("customer")
|
||||
*/
|
||||
public $customer;
|
||||
|
||||
/**
|
||||
* Компании контактного лица
|
||||
*
|
||||
* @var array $companies
|
||||
*
|
||||
* @Mapping\Type("array<Intaro\RetailCrm\Model\Api\Company>")
|
||||
* @Mapping\SerializedName("companies")
|
||||
*/
|
||||
public $companies;
|
||||
}
|
203
intaro.retailcrm/lib/model/api/history.php
Normal file
203
intaro.retailcrm/lib/model/api/history.php
Normal file
|
@ -0,0 +1,203 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
|
||||
/**
|
||||
* Class History
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class History extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* Внутренний идентификатор записи в истории
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Дата внесения изменения
|
||||
*
|
||||
* @var \DateTime $createdAt
|
||||
*
|
||||
* @Mapping\Type("DateTime<'Y-m-d H:i:s'>")
|
||||
* @Mapping\SerializedName("createdAt")
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* Признак создания сущности
|
||||
*
|
||||
* @var string $created
|
||||
*
|
||||
* @Mapping\Type("boolean")
|
||||
* @Mapping\SerializedName("created")
|
||||
*/
|
||||
public $created;
|
||||
|
||||
/**
|
||||
* Признак удаления сущности
|
||||
*
|
||||
* @var string $deleted
|
||||
*
|
||||
* @Mapping\Type("boolean")
|
||||
* @Mapping\SerializedName("deleted")
|
||||
*/
|
||||
public $deleted;
|
||||
|
||||
/**
|
||||
* Источник изменения
|
||||
*
|
||||
* @var string $source
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("source")
|
||||
*/
|
||||
public $source;
|
||||
|
||||
/**
|
||||
* Пользователь
|
||||
*
|
||||
* @var \Intaro\RetailCrm\Model\Api\User $user
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\User")
|
||||
* @Mapping\SerializedName("user")
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Имя изменившегося поля
|
||||
*
|
||||
* @var string $field
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("field")
|
||||
*/
|
||||
public $field;
|
||||
|
||||
/**
|
||||
* Информация о ключе api, использовавшемся для этого изменения
|
||||
*
|
||||
* @var array $apiKey
|
||||
*
|
||||
* @Mapping\Type("array")
|
||||
* @Mapping\SerializedName("apiKey")
|
||||
*/
|
||||
public $apiKey;
|
||||
|
||||
/**
|
||||
* Старое значение свойства
|
||||
*
|
||||
* @var string $oldValue
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("oldValue")
|
||||
*/
|
||||
public $oldValue;
|
||||
|
||||
/**
|
||||
* Новое значение свойства
|
||||
*
|
||||
* @var string $newValue
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("newValue")
|
||||
*/
|
||||
public $newValue;
|
||||
|
||||
/**
|
||||
* Клиент
|
||||
*
|
||||
* @var \Intaro\RetailCrm\Model\Api\Customer $customer
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Customer")
|
||||
* @Mapping\SerializedName("customer")
|
||||
*/
|
||||
public $customer;
|
||||
|
||||
/**
|
||||
* Заказ
|
||||
*
|
||||
* @var \Intaro\RetailCrm\Model\Api\Order $order
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Order")
|
||||
* @Mapping\SerializedName("order")
|
||||
*/
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* Позиция в заказе
|
||||
*
|
||||
* @var \Intaro\RetailCrm\Model\Api\Item $item
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Item")
|
||||
* @Mapping\SerializedName("item")
|
||||
*/
|
||||
public $item;
|
||||
|
||||
/**
|
||||
* Платёж
|
||||
*
|
||||
* @var \Intaro\RetailCrm\Model\Api\Payment $payment
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Payment")
|
||||
* @Mapping\SerializedName("payment")
|
||||
*/
|
||||
public $payment;
|
||||
|
||||
/**
|
||||
* Адрес клиента
|
||||
*
|
||||
* @var \Intaro\RetailCrm\Model\Api\Address $address
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Address")
|
||||
* @Mapping\SerializedName("address")
|
||||
*/
|
||||
public $address;
|
||||
|
||||
/**
|
||||
* Информация о [заказе|клиенте], который получился после объединения с текущим клиентом
|
||||
*
|
||||
* @var array $combinedTo
|
||||
*
|
||||
* @Mapping\Type("array")
|
||||
* @Mapping\SerializedName("combinedTo")
|
||||
*/
|
||||
public $combinedTo;
|
||||
|
||||
/**
|
||||
* Информация о клиенте, который получился после объединения с текущим клиентом
|
||||
*
|
||||
* @var \Intaro\RetailCrm\Model\Api\CustomerContact $customerContact
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\CustomerContact")
|
||||
* @Mapping\SerializedName("customerContact")
|
||||
*/
|
||||
public $customerContact;
|
||||
|
||||
/**
|
||||
* Информация о клиенте, который получился после объединения с текущим клиентом
|
||||
*
|
||||
* @var \Intaro\RetailCrm\Model\Api\Company $company
|
||||
*
|
||||
* @Mapping\Type("Intaro\RetailCrm\Model\Api\Company")
|
||||
* @Mapping\SerializedName("company")
|
||||
*/
|
||||
public $company;
|
||||
}
|
63
intaro.retailcrm/lib/model/api/item.php
Normal file
63
intaro.retailcrm/lib/model/api/item.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
|
||||
/**
|
||||
* Class Item
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class Item extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* ID позиции в заказе
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Внешние идентификаторы позиции в заказе
|
||||
*
|
||||
* @var array $externalIds
|
||||
*
|
||||
* @Mapping\Type("array")
|
||||
* @Mapping\SerializedName("externalIds")
|
||||
*/
|
||||
public $externalIds;
|
||||
|
||||
/**
|
||||
* Торговое предложение
|
||||
*
|
||||
* @var array $offer
|
||||
*
|
||||
* @Mapping\Type("array")
|
||||
* @Mapping\SerializedName("offer")
|
||||
*/
|
||||
public $offer;
|
||||
|
||||
/**
|
||||
* [массив] Дополнительные свойства позиции в заказе
|
||||
*
|
||||
* @var array $properties
|
||||
*
|
||||
* @Mapping\Type("array")
|
||||
* @Mapping\SerializedName("properties")
|
||||
*/
|
||||
public $properties;
|
||||
}
|
72
intaro.retailcrm/lib/model/api/order.php
Normal file
72
intaro.retailcrm/lib/model/api/order.php
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class Order
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class Order extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* ID заказа
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Внешний ID корпоративного клиента
|
||||
*
|
||||
* @var string $externalId
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("externalId")
|
||||
*/
|
||||
public $externalId;
|
||||
|
||||
/**
|
||||
* Менеджер, прикрепленный к заказу
|
||||
*
|
||||
* @var string $managerId
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("managerId")
|
||||
*/
|
||||
public $managerId;
|
||||
|
||||
/**
|
||||
* Магазин
|
||||
*
|
||||
* @var string $site
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("site")
|
||||
*/
|
||||
public $site;
|
||||
|
||||
/**
|
||||
* Статус заказа
|
||||
*
|
||||
* @var string $status
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("status")
|
||||
*/
|
||||
public $status;
|
||||
}
|
52
intaro.retailcrm/lib/model/api/payment.php
Normal file
52
intaro.retailcrm/lib/model/api/payment.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class Payment
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class Payment extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* Внутренний ID
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Тип оплаты
|
||||
*
|
||||
* @var string $type
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("type")
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* Внешний ID платежа
|
||||
*
|
||||
* @var string $externalId
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("externalId")
|
||||
*/
|
||||
public $externalId;
|
||||
}
|
32
intaro.retailcrm/lib/model/api/phone.php
Normal file
32
intaro.retailcrm/lib/model/api/phone.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class Phone
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class Phone extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* Номер телефона
|
||||
*
|
||||
* @var string $number
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("number")
|
||||
*/
|
||||
public $number;
|
||||
}
|
32
intaro.retailcrm/lib/model/api/user.php
Normal file
32
intaro.retailcrm/lib/model/api/user.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class User
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class User extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* ID пользователя
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("id")
|
||||
*/
|
||||
public $id;
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model;
|
||||
|
||||
/**
|
||||
* Class Customer
|
||||
* TODO: Create necessary models for retailCRM entities
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model
|
||||
*/
|
||||
class Customer
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $externalId;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isContact = false;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*
|
||||
* @return Customer
|
||||
*/
|
||||
public function setId(int $id): Customer
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExternalId(): string
|
||||
{
|
||||
return $this->externalId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $externalId
|
||||
*
|
||||
* @return Customer
|
||||
*/
|
||||
public function setExternalId(string $externalId): Customer
|
||||
{
|
||||
$this->externalId = $externalId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isContact(): bool
|
||||
{
|
||||
return $this->isContact;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $isContact
|
||||
*
|
||||
* @return Customer
|
||||
*/
|
||||
public function setIsContact(bool $isContact): Customer
|
||||
{
|
||||
$this->isContact = $isContact;
|
||||
return $this;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue