mirror of
https://github.com/anthonyaxenov/atol-online.git
synced 2024-11-25 17:34:10 +00:00
Убрал схему Атола валидации количества НДС, оплат и предметов
This commit is contained in:
parent
d3fe2cba9a
commit
7558cb6638
@ -106,7 +106,7 @@ class ItemArray extends Entity
|
|||||||
protected function validateCount(?array $items = null): bool
|
protected function validateCount(?array $items = null): bool
|
||||||
{
|
{
|
||||||
if ((!empty($items) && count($items) >= self::MAX_COUNT) || count($this->items) >= self::MAX_COUNT) {
|
if ((!empty($items) && count($items) >= self::MAX_COUNT) || count($this->items) >= self::MAX_COUNT) {
|
||||||
throw new AtolTooManyItemsException(self::MAX_COUNT);
|
throw new AtolTooManyItemsException(count($items), self::MAX_COUNT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
namespace AtolOnline\Entities;
|
namespace AtolOnline\Entities;
|
||||||
|
|
||||||
use AtolOnline\Api\SellSchema;
|
|
||||||
use AtolOnline\Exceptions\AtolTooManyPaymentsException;
|
use AtolOnline\Exceptions\AtolTooManyPaymentsException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +18,11 @@ use AtolOnline\Exceptions\AtolTooManyPaymentsException;
|
|||||||
*/
|
*/
|
||||||
class PaymentArray extends Entity
|
class PaymentArray extends Entity
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Максимальное количество элементов массива
|
||||||
|
*/
|
||||||
|
public const MAX_COUNT = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Payment[] Массив оплат
|
* @var Payment[] Массив оплат
|
||||||
*/
|
*/
|
||||||
@ -99,9 +103,8 @@ class PaymentArray extends Entity
|
|||||||
*/
|
*/
|
||||||
protected function validateCount(?array $payments = null): bool
|
protected function validateCount(?array $payments = null): bool
|
||||||
{
|
{
|
||||||
$max_items = SellSchema::get()->properties->receipt->properties->payments->maxItems;
|
if ((!empty($payments) && count($payments) >= self::MAX_COUNT) || count($this->payments) >= self::MAX_COUNT) {
|
||||||
if ((!empty($payments) && count($payments) >= $max_items) || count($this->payments) >= $max_items) {
|
throw new AtolTooManyPaymentsException(count($payments), self::MAX_COUNT);
|
||||||
throw new AtolTooManyPaymentsException($max_items);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
namespace AtolOnline\Entities;
|
namespace AtolOnline\Entities;
|
||||||
|
|
||||||
use AtolOnline\Api\SellSchema;
|
|
||||||
use AtolOnline\Exceptions\AtolTooManyVatsException;
|
use AtolOnline\Exceptions\AtolTooManyVatsException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +18,11 @@ use AtolOnline\Exceptions\AtolTooManyVatsException;
|
|||||||
*/
|
*/
|
||||||
class VatArray extends Entity
|
class VatArray extends Entity
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Максимальное количество элементов массива
|
||||||
|
*/
|
||||||
|
public const MAX_COUNT = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Vat[] Массив ставок НДС
|
* @var Vat[] Массив ставок НДС
|
||||||
*/
|
*/
|
||||||
@ -103,9 +107,8 @@ class VatArray extends Entity
|
|||||||
*/
|
*/
|
||||||
protected function validateCount(?array $vats = null): bool
|
protected function validateCount(?array $vats = null): bool
|
||||||
{
|
{
|
||||||
$max_items = SellSchema::get()->properties->receipt->properties->vats->maxItems;
|
if ((!empty($vats) && count($vats) >= self::MAX_COUNT) || count($this->vats) >= self::MAX_COUNT) {
|
||||||
if ((!empty($vats) && count($vats) >= $max_items) || count($this->vats) >= $max_items) {
|
throw new AtolTooManyVatsException(count($vats), self::MAX_COUNT);
|
||||||
throw new AtolTooManyVatsException(count($vats), $max_items);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user