Туча доработок
- класс `PayingAgent`, покрытый тестами - новые константы для тегов ФФД 1.05 `Ffd105Tags` - `Entity::jsonSerialize()` object -> array (again) - `TooManyException::$max` int -> float - тесты по psr-4, потому что почему бы и нет - некоторые провайдеры вынесены в `BasicTestCase` - улучшен тест покупателя
This commit is contained in:
@@ -25,17 +25,17 @@ final class Constraints
|
||||
* Максимальная длина email
|
||||
*/
|
||||
const MAX_LENGTH_EMAIL = 64;
|
||||
|
||||
|
||||
/**
|
||||
* Максимальная длина логина ККТ
|
||||
*/
|
||||
const MAX_LENGTH_LOGIN = 100;
|
||||
|
||||
|
||||
/**
|
||||
* Максимальная длина пароля ККТ
|
||||
*/
|
||||
const MAX_LENGTH_PASSWORD = 100;
|
||||
|
||||
|
||||
/**
|
||||
* Максимальная длина адреса места расчётов
|
||||
*/
|
||||
@@ -116,17 +116,31 @@ final class Constraints
|
||||
|
||||
/**
|
||||
* Максимальная длина имени кассира (1021)
|
||||
*
|
||||
* @see https://online.atol.ru/files/API_atol_online_v4.pdf Документация, стр 32
|
||||
*/
|
||||
const MAX_LENGTH_CASHIER_NAME = 64;
|
||||
|
||||
|
||||
/**
|
||||
* Регулярное выражание для валидации строки ИНН
|
||||
*
|
||||
* @see https://online.atol.ru/possystem/v4/schema/sell Схема "#/receipt/client/inn"
|
||||
*/
|
||||
const PATTERN_INN = "/(^[0-9]{10}$)|(^[0-9]{12}$)/";
|
||||
|
||||
const PATTERN_INN = /* @lang PhpRegExp */
|
||||
'/(^[\d]{10}$)|(^[\d]{12}$)/';
|
||||
|
||||
/**
|
||||
* Регулярное выражение для валидации номера телефона
|
||||
*
|
||||
* @see https://online.atol.ru/possystem/v4/schema/sell Схема "#/definitions/phone_number"
|
||||
*/
|
||||
const PATTERN_PHONE = /* @lang PhpRegExp */
|
||||
'/^([^\s\\\]{0,17}|\+[^\s\\\]{1,18})$/';
|
||||
|
||||
/**
|
||||
* Регулярное выражание для валидации строки Callback URL
|
||||
*/
|
||||
const PATTERN_CALLBACK_URL = "/^http(s?)\:\/\/[0-9a-zA-Zа-яА-Я]([-.\w]*[0-9a-zA-Zа-яА-Я])*(:(0-9)*)*(\/?)([a-zAZ0-9а-яА-Я\-\.\?\,\'\/\\\+&=%\$#_]*)?$/";
|
||||
}
|
||||
const PATTERN_CALLBACK_URL = /* @lang PhpRegExp */
|
||||
'/^http(s?)\:\/\/[0-9a-zA-Zа-яА-Я]' .
|
||||
'([-.\w]*[0-9a-zA-Zа-яА-Я])*(:(0-9)*)*(\/?)([a-zAZ0-9а-яА-Я\-\.\?\,\'\/\\\+&=%\$#_]*)?$/';
|
||||
}
|
||||
|
||||
86
src/Constants/Ffd105Tags.php
Normal file
86
src/Constants/Ffd105Tags.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Антон Аксенов (Anthony Axenov)
|
||||
*
|
||||
* This code is licensed under MIT.
|
||||
* Этот код распространяется по лицензии MIT.
|
||||
* https://github.com/anthonyaxenov/atol-online/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace AtolOnline\Constants;
|
||||
|
||||
/**
|
||||
* Константы тегов ФФД 1.05
|
||||
*/
|
||||
final class Ffd105Tags
|
||||
{
|
||||
/**
|
||||
* Телефон или электронный адрес покупателя
|
||||
*/
|
||||
const CLIENT_CONTACT = 1008;
|
||||
|
||||
/**
|
||||
* Наименование организации или фамилия, имя, отчество (при наличии), серия и номер паспорта покупателя (клиента)
|
||||
*/
|
||||
const CLIENT_NAME = 1227;
|
||||
|
||||
/**
|
||||
* ИНН организации или покупателя (клиента)
|
||||
*/
|
||||
const CLIENT_INN = 1228;
|
||||
|
||||
/**
|
||||
* Адрес электронной почты отправителя чека
|
||||
*/
|
||||
const COMPANY_EMAIL = 1117;
|
||||
|
||||
/**
|
||||
* ИНН пользователя
|
||||
*/
|
||||
const COMPANY_INN = 1008;
|
||||
|
||||
/**
|
||||
* Место расчетов
|
||||
*/
|
||||
const COMPANY_PADDRESS = 1187;
|
||||
|
||||
/**
|
||||
* ИНН оператора перевода
|
||||
*/
|
||||
const MTO_INN = 1016;
|
||||
|
||||
/**
|
||||
* Телефон платежного агента
|
||||
*/
|
||||
const PAGENT_PHONE = 1073;
|
||||
|
||||
/**
|
||||
* ИНН поставщика
|
||||
*/
|
||||
const SUPPLIER_INN = 1226;
|
||||
|
||||
/**
|
||||
* Кассир
|
||||
*/
|
||||
const CASHIER = 1021;
|
||||
|
||||
/**
|
||||
* Наименование предмета расчета
|
||||
*/
|
||||
const ITEM_NAME = 1030;
|
||||
|
||||
/**
|
||||
* Цена за единицу предмета расчета с учетом скидок и наценок
|
||||
*/
|
||||
const ITEM_PRICE = 1079;
|
||||
|
||||
/**
|
||||
* Единица измерения предмета расчета
|
||||
*/
|
||||
const ITEM_MEASURE = 1197;
|
||||
|
||||
/**
|
||||
* Дополнительный реквизит предмета расчета
|
||||
*/
|
||||
const ITEM_USERDATA = 1191;
|
||||
}
|
||||
@@ -17,8 +17,8 @@ use AtolOnline\{
|
||||
Exceptions\InvalidInnLengthException,
|
||||
Exceptions\TooLongClientContactException,
|
||||
Exceptions\TooLongClientNameException,
|
||||
Exceptions\TooLongEmailException,
|
||||
Exceptions\TooLongItemNameException};
|
||||
Exceptions\TooLongEmailException
|
||||
};
|
||||
|
||||
/**
|
||||
* Класс Client, описывающий сущность покупателя
|
||||
@@ -50,11 +50,11 @@ class Client extends Entity
|
||||
/**
|
||||
* Конструктор объекта покупателя
|
||||
*
|
||||
* @param string|null $name Наименование. Тег ФФД - 1227.
|
||||
* @param string|null $phone Email. Тег ФФД - 1008.
|
||||
* @param string|null $email Телефон покупателя. Тег ФФД - 1008.
|
||||
* @param string|null $inn ИНН. Тег ФФД - 1228.
|
||||
* @throws TooLongItemNameException
|
||||
* @param string|null $name Наименование (1227)
|
||||
* @param string|null $phone Email (1008)
|
||||
* @param string|null $email Телефон покупателя (1008)
|
||||
* @param string|null $inn ИНН (1228)
|
||||
* @throws TooLongClientNameException
|
||||
* @throws TooLongClientContactException
|
||||
* @throws TooLongEmailException
|
||||
* @throws InvalidEmailException
|
||||
@@ -90,6 +90,7 @@ class Client extends Entity
|
||||
*
|
||||
* Тег ФФД - 1227
|
||||
*
|
||||
* @todo улучшить валидацию по Constraints::PATTERN_PHONE
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
* @throws TooLongClientNameException
|
||||
@@ -203,13 +204,13 @@ class Client extends Entity
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize(): object
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
$json = [];
|
||||
$this->getName() && $json['name'] = $this->getName();
|
||||
$this->getEmail() && $json['email'] = $this->getEmail();
|
||||
$this->getPhone() && $json['phone'] = $this->getPhone();
|
||||
$this->getInn() && $json['inn'] = $this->getInn();
|
||||
return (object)$json;
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,9 +205,9 @@ class Company extends Entity
|
||||
* @throws InvalidInnLengthException
|
||||
* @throws InvalidPaymentAddressException
|
||||
*/
|
||||
public function jsonSerialize(): object
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return (object)[
|
||||
return [
|
||||
'email' => $this->email
|
||||
? $this->getEmail()
|
||||
: throw new InvalidEmailException(),
|
||||
@@ -222,4 +222,4 @@ class Company extends Entity
|
||||
: throw new InvalidPaymentAddressException(),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,12 +123,12 @@ class CorrectionInfo extends Entity
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize(): object
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return (object)[
|
||||
'type' => $this->getType() ?? '', // обязателен
|
||||
'base_date' => $this->getDate() ?? '', // обязателен
|
||||
'base_number' => $this->getNumber() ?? '', // обязателен
|
||||
return [
|
||||
'type' => $this->getType() ?? '',
|
||||
'base_date' => $this->getDate() ?? '',
|
||||
'base_number' => $this->getNumber() ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,8 +129,8 @@ final class Kkt extends Entity
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return $this->data;
|
||||
return (array)$this->data;
|
||||
}
|
||||
}
|
||||
|
||||
123
src/Entities/PayingAgent.php
Normal file
123
src/Entities/PayingAgent.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Антон Аксенов (Anthony Axenov)
|
||||
*
|
||||
* This code is licensed under MIT.
|
||||
* Этот код распространяется по лицензии MIT.
|
||||
* https://github.com/anthonyaxenov/atol-online/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Entities;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Exceptions\InvalidPhoneException;
|
||||
use AtolOnline\Exceptions\TooLongPayingAgentOperationException;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Класс, описывающий данные платёжного агента
|
||||
*
|
||||
* @see https://online.atol.ru/files/API_atol_online_v4.pdf Документация, стр 19
|
||||
*/
|
||||
class PayingAgent extends Entity
|
||||
{
|
||||
/**
|
||||
* @var string|null Наименование операции (1044)
|
||||
*/
|
||||
protected ?string $operation = null;
|
||||
|
||||
/**
|
||||
* @var Collection Телефоны платежного агента (1073)
|
||||
*/
|
||||
protected Collection $phones;
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @param string|null $operation Наименование операции (1044)
|
||||
* @param array|Collection|null $phones Телефоны платежного агента (1073)
|
||||
* @throws TooLongPayingAgentOperationException
|
||||
* @throws InvalidPhoneException
|
||||
*/
|
||||
public function __construct(
|
||||
?string $operation = null,
|
||||
array|Collection|null $phones = null,
|
||||
) {
|
||||
!is_null($operation) && $this->setOperation($operation);
|
||||
$this->setPhones($phones);
|
||||
}
|
||||
|
||||
/**
|
||||
* Устанавливает операцию
|
||||
*
|
||||
* @param string|null $operation
|
||||
* @return $this
|
||||
* @throws TooLongPayingAgentOperationException
|
||||
*/
|
||||
public function setOperation(?string $operation): self
|
||||
{
|
||||
if (!is_null($operation)) {
|
||||
$operation = trim($operation);
|
||||
if (mb_strlen($operation) > Constraints::MAX_LENGTH_PAYING_AGENT_OPERATION) {
|
||||
throw new TooLongPayingAgentOperationException($operation);
|
||||
}
|
||||
}
|
||||
$this->operation = empty($operation) ? null : $operation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Вoзвращает установленную операцию
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getOperation(): ?string
|
||||
{
|
||||
return $this->operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Устанавливает массив номеров телефонов
|
||||
*
|
||||
* @param array|Collection|null $phones
|
||||
* @return $this
|
||||
* @throws InvalidPhoneException
|
||||
*/
|
||||
public function setPhones(array|Collection|null $phones): self
|
||||
{
|
||||
if (!is_null($phones)) {
|
||||
$phones = is_array($phones) ? collect($phones) : $phones;
|
||||
$phones->each(function ($phone) {
|
||||
$phone = preg_replace('/[^\d]/', '', trim($phone));
|
||||
if (preg_match(Constraints::PATTERN_PHONE, $phone) != 1) {
|
||||
throw new InvalidPhoneException($phone);
|
||||
}
|
||||
});
|
||||
}
|
||||
$this->phones = empty($phones) ? collect() : $phones;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Возвращает установленные
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getPhones(): Collection
|
||||
{
|
||||
return $this->phones;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
$json = [];
|
||||
$this->getOperation() && $json['operation'] = $this->getOperation();
|
||||
!$this->getPhones()->isEmpty() && $json['phones'] = $this->getPhones()->toArray();
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,18 @@ declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать пустой email
|
||||
*
|
||||
* @see https://online.atol.ru/files/API_atol_online_v4.pdf Документация, стр 17
|
||||
*/
|
||||
class EmptyEmailException extends AtolException
|
||||
{
|
||||
protected $message = 'Email не может быть пустым';
|
||||
protected array $ffd_tags = [1008, 1117];
|
||||
protected array $ffd_tags = [
|
||||
Ffd105Tags::CLIENT_CONTACT,
|
||||
Ffd105Tags::COMPANY_EMAIL,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -11,13 +11,19 @@ declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при ошибке валидации email
|
||||
*
|
||||
* @see https://online.atol.ru/files/API_atol_online_v4.pdf Документация, стр 17
|
||||
*/
|
||||
class InvalidEmailException extends AtolException
|
||||
{
|
||||
protected array $ffd_tags = [1008, 1117];
|
||||
protected array $ffd_tags = [
|
||||
Ffd105Tags::CLIENT_CONTACT,
|
||||
Ffd105Tags::COMPANY_EMAIL,
|
||||
];
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
|
||||
@@ -11,12 +11,19 @@ declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать ИНН некорректной длины
|
||||
*/
|
||||
class InvalidInnLengthException extends AtolException
|
||||
{
|
||||
protected array $ffd_tags = [1016, 1018, 1226, 1228];
|
||||
protected array $ffd_tags = [
|
||||
Ffd105Tags::MTO_INN,
|
||||
Ffd105Tags::COMPANY_INN,
|
||||
Ffd105Tags::SUPPLIER_INN,
|
||||
Ffd105Tags::CLIENT_INN,
|
||||
];
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
|
||||
@@ -11,13 +11,16 @@ declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать некорректный адрес места расчётов
|
||||
*
|
||||
* @see https://online.atol.ru/files/API_atol_online_v4.pdf Документация, стр 35
|
||||
*/
|
||||
class InvalidPaymentAddressException extends AtolException
|
||||
{
|
||||
protected array $ffd_tags = [1187];
|
||||
protected array $ffd_tags = [Ffd105Tags::COMPANY_PADDRESS];
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
|
||||
35
src/Exceptions/InvalidPhoneException.php
Normal file
35
src/Exceptions/InvalidPhoneException.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Антон Аксенов (Anthony Axenov)
|
||||
*
|
||||
* This code is licensed under MIT.
|
||||
* Этот код распространяется по лицензии MIT.
|
||||
* https://github.com/anthonyaxenov/atol-online/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при ошибке валидации телефона
|
||||
*/
|
||||
class InvalidPhoneException extends AtolException
|
||||
{
|
||||
protected array $ffd_tags = [
|
||||
Ffd105Tags::CLIENT_CONTACT,
|
||||
Ffd105Tags::PAGENT_PHONE,
|
||||
];
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @param string $phone
|
||||
*/
|
||||
public function __construct(string $phone = '')
|
||||
{
|
||||
parent::__construct("Невалидный номер телефона: '$phone'");
|
||||
}
|
||||
}
|
||||
@@ -11,20 +11,15 @@ declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком высокую цену (сумму)
|
||||
*/
|
||||
class TooHighPriceException extends TooManyException
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected array $ffd_tags = [
|
||||
1079,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string Сообщение об ошибке
|
||||
*/
|
||||
protected $message = 'Price is too high';
|
||||
}
|
||||
protected $message = 'Слишком высокая цена';
|
||||
protected array $ffd_tags = [Ffd105Tags::ITEM_PRICE];
|
||||
protected float $max = Constraints::MAX_COUNT_ITEM_PRICE;
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongCallbackUrlException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинный адрес колбека';
|
||||
protected int $max = Constraints::MAX_LENGTH_CALLBACK_URL;
|
||||
protected float $max = Constraints::MAX_LENGTH_CALLBACK_URL;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинное имя кассира
|
||||
@@ -19,6 +20,6 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongCashierException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинное имя кассира';
|
||||
protected int $max = Constraints::MAX_LENGTH_CASHIER_NAME;
|
||||
protected array $ffd_tags = [1021];
|
||||
protected float $max = Constraints::MAX_LENGTH_CASHIER_NAME;
|
||||
protected array $ffd_tags = [Ffd105Tags::CASHIER];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинный телефон или email покупателя
|
||||
@@ -19,6 +20,6 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongClientContactException extends TooLongException
|
||||
{
|
||||
protected $message = 'Cлишком длинный телефон или email покупателя';
|
||||
protected int $max = Constraints::MAX_LENGTH_CLIENT_CONTACT;
|
||||
protected array $ffd_tags = [1008];
|
||||
protected float $max = Constraints::MAX_LENGTH_CLIENT_CONTACT;
|
||||
protected array $ffd_tags = [Ffd105Tags::CLIENT_CONTACT];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинное наименование покупателя
|
||||
@@ -19,6 +20,6 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongClientNameException extends TooLongException
|
||||
{
|
||||
protected $message = 'Cлишком длинное наименование покупателя';
|
||||
protected int $max = Constraints::MAX_LENGTH_CLIENT_NAME;
|
||||
protected array $ffd_tags = [1227];
|
||||
protected float $max = Constraints::MAX_LENGTH_CLIENT_NAME;
|
||||
protected array $ffd_tags = [Ffd105Tags::CLIENT_NAME];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинный email
|
||||
@@ -19,6 +20,9 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongEmailException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинный email';
|
||||
protected int $max = Constraints::MAX_LENGTH_EMAIL;
|
||||
protected array $ffd_tags = [1008, 1117];
|
||||
protected float $max = Constraints::MAX_LENGTH_EMAIL;
|
||||
protected array $ffd_tags = [
|
||||
Ffd105Tags::CLIENT_CONTACT,
|
||||
Ffd105Tags::COMPANY_EMAIL,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ class TooLongException extends AtolException
|
||||
protected $message = 'Слишком длинное значение';
|
||||
|
||||
/**
|
||||
* @var int Максимальная длина строки
|
||||
* @var float Максимальная длина строки
|
||||
*/
|
||||
protected int $max = 0;
|
||||
protected float $max = 0;
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
|
||||
@@ -11,7 +11,10 @@ declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\{
|
||||
Constraints,
|
||||
Ffd105Tags
|
||||
};
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинное имя
|
||||
@@ -19,6 +22,6 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongItemNameException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинное наименование предмета расчёта';
|
||||
protected int $max = Constraints::MAX_LENGTH_ITEM_NAME;
|
||||
protected array $ffd_tags = [1030];
|
||||
protected float $max = Constraints::MAX_LENGTH_ITEM_NAME;
|
||||
protected array $ffd_tags = [Ffd105Tags::ITEM_NAME];
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongLoginException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинный логин';
|
||||
protected int $max = Constraints::MAX_LENGTH_LOGIN;
|
||||
protected float $max = Constraints::MAX_LENGTH_LOGIN;
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongPasswordException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинный пароль';
|
||||
protected int $max = Constraints::MAX_LENGTH_PASSWORD;
|
||||
protected float $max = Constraints::MAX_LENGTH_PASSWORD;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,10 @@ declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\{
|
||||
Constraints,
|
||||
Ffd105Tags
|
||||
};
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинную операцию для платёжного агента
|
||||
@@ -19,6 +22,6 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongPayingAgentOperationException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинное yаименование операции платёжного агента';
|
||||
protected int $max = Constraints::MAX_LENGTH_PAYING_AGENT_OPERATION;
|
||||
protected array $ffd_tags = [1073];
|
||||
protected float $max = Constraints::MAX_LENGTH_PAYING_AGENT_OPERATION;
|
||||
protected array $ffd_tags = [Ffd105Tags::PAGENT_PHONE];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинный адрес места расчётов
|
||||
@@ -19,6 +20,6 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongPaymentAddressException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинный адрес места расчётов';
|
||||
protected int $max = Constraints::MAX_LENGTH_PAYMENT_ADDRESS;
|
||||
protected array $ffd_tags = [1187];
|
||||
protected float $max = Constraints::MAX_LENGTH_PAYMENT_ADDRESS;
|
||||
protected array $ffd_tags = [Ffd105Tags::COMPANY_PADDRESS];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинную единицу измерения предмета расчёта
|
||||
@@ -19,6 +20,6 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongUnitException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинная единица измерения предмета расчёта';
|
||||
protected int $max = Constraints::MAX_LENGTH_MEASUREMENT_UNIT;
|
||||
protected array $ffd_tags = [1197];
|
||||
protected float $max = Constraints::MAX_LENGTH_MEASUREMENT_UNIT;
|
||||
protected array $ffd_tags = [Ffd105Tags::ITEM_MEASURE];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ declare(strict_types = 1);
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
use AtolOnline\Constants\Constraints;
|
||||
use AtolOnline\Constants\Ffd105Tags;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при попытке указать слишком длинный дополнительный реквизит
|
||||
@@ -19,6 +20,6 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooLongUserdataException extends TooLongException
|
||||
{
|
||||
protected $message = 'Слишком длинный дополнительный реквизит предмета расчёта';
|
||||
protected int $max = Constraints::MAX_LENGTH_USER_DATA;
|
||||
protected array $ffd_tags = [1191];
|
||||
protected float $max = Constraints::MAX_LENGTH_USER_DATA;
|
||||
protected array $ffd_tags = [Ffd105Tags::ITEM_USERDATA];
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ class TooManyException extends AtolException
|
||||
protected $message = 'Слишком большое количество';
|
||||
|
||||
/**
|
||||
* @var int Максимальное количество
|
||||
* @var float Максимальное количество
|
||||
*/
|
||||
protected int $max = 0;
|
||||
protected float $max = 0;
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
|
||||
@@ -19,5 +19,5 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooManyItemsException extends TooManyException
|
||||
{
|
||||
protected $message = 'Слишком много предметов расчёта в документе';
|
||||
protected int $max = Constraints::MAX_COUNT_DOC_ITEMS;
|
||||
protected float $max = Constraints::MAX_COUNT_DOC_ITEMS;
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooManyPaymentsException extends TooManyException
|
||||
{
|
||||
protected $message = 'Слишком много платежей в документе';
|
||||
protected int $max = Constraints::MAX_COUNT_DOC_PAYMENTS;
|
||||
protected float $max = Constraints::MAX_COUNT_DOC_PAYMENTS;
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ use AtolOnline\Constants\Constraints;
|
||||
class TooManyVatsException extends TooManyException
|
||||
{
|
||||
protected $message = 'Слишком много ставок НДС в документе';
|
||||
protected int $max = Constraints::MAX_COUNT_DOC_VATS;
|
||||
protected float $max = Constraints::MAX_COUNT_DOC_VATS;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ final class Helpers
|
||||
/**
|
||||
* Генерирует случайную строку указанной длины
|
||||
*
|
||||
* @param int $length Длина, по умолчнанию 8
|
||||
* @param int $length Длина, по умолчанию 8
|
||||
* @param bool $with_digits Включать ли цифры
|
||||
* @return string
|
||||
*/
|
||||
@@ -115,4 +115,4 @@ final class Helpers
|
||||
return is_array($actual_classes)
|
||||
&& !empty(array_intersect($classes, $actual_classes));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user