DocumentList::getRuleList()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 34
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 29
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 34
rs 9.456
1
<?php
2
3
namespace alekciy\ofd\providers\yandex\Request;
4
5
use alekciy\ofd\providers\yandex\Model\Document;
6
use alekciy\ofd\providers\yandex\RequestPage;
7
8
/**
9
 * Список документов.
10
 */
11
class DocumentList extends RequestPage
12
{
13
	public $method = 'POST';
14
	protected $path = '/v1/docs/aggregations/receipts';
15
16
	/** @var string Начало периода */
17
	public $start = '';
18
19
	/** @var string Окончание периода */
20
	public $end = '';
21
22
	/** @var array Список идентификаторов ККТ, по которым будет построен отчет */
23
	public $cashDeskIdList = [];
24
25
	/** @var array Список идентификаторов компаний, по ККТ (кассам) которых будет построен отчет */
26
	public $companyIdList = [];
27
28
	/** @var array Список идентификаторов точек продаж, по ККТ которых будет построен отчет */
29
	public $outletIdList = [];
30
31
	/** @var array Тип фискального документа (ФД) */
32
	public $documentTypeList = [];
33
34
	/** @var array Тип операции */
35
	public $operationList = [];
36
37
	/** @var array Тип операции */
38
	public $taxList = [];
39
40
	/** @var string Фискальный признак документа (ФПД) */
41
	public $fpd = '';
42
43
	/** @var string Порядковый номер фискального документа */
44
	public $fdNumber = '';
45
46
	/** @var integer Список смен */
47
	public $shiftNumber;
48
49
	/**
50
	 * @inheritDoc
51
	 */
52
	public function getPropertyMap(): array
53
	{
54
		return array_merge(parent::getPropertyMap(), [
55
			'cashDeskIdList'   => ['body' => 'cashbox_ids'],
56
			'companyIdList'    => ['body' => 'company_ids'],
57
			'outletIdList'     => ['body' => 'retail_point_ids'],
58
			'documentTypeList' => ['body' => 'document_types'],
59
			'operationList'    => ['body' => 'operation_types'],
60
			'taxList'          => ['body' => 'taxation_types'],
61
			'shiftNumber'      => ['body' => 'shifts'],
62
			'start'            => ['body' => 'date_from'],
63
			'end'              => ['body' => 'date_to'],
64
		]);
65
	}
66
67
	/**
68
	 * @inheritDoc
69
	 */
70
	public function getRuleList(): array
71
	{
72
		return array_merge(parent::getRuleList(), [
73
			'start' => ['required', ['dateFormat', 'Y-m-d H:i:s']],
74
			'end'   => ['required', ['dateFormat', 'Y-m-d H:i:s']],
75
76
			'cashDeskIdList' => ['array'],
77
			'companyIdList'  => ['array'],
78
			'outletIdList'   => ['array'],
79
			'shiftNumber'    => ['integer', ['min', 1]],
80
			'taxList'        => ['array', ['subset', [
81
				Document::TAX_AGRICULTURAL,
82
				Document::TAX_OSN,
83
				Document::TAX_PATENT,
84
				Document::TAX_USN_INCOME,
85
				Document::TAX_USN_INCOME_EXPENDITURE,
86
			]]],
87
			'operationList' => ['array', ['subset', [
88
				Document::OPERATION_INCOME,
89
				Document::OPERATION_INCOME_RETURN,
90
				Document::OPERATION_OUTCOME,
91
				Document::OPERATION_OUTCOME_RETURN,
92
			]]],
93
			'documentTypeList' => ['array', ['subset', [
94
				Document::TYPE_OPEN,
95
				Document::TYPE_CLOSE,
96
				Document::TYPE_STATE,
97
				Document::TYPE_CHECK,
98
				Document::TYPE_CHECK_CORRECT,
99
				Document::TYPE_STRICT,
100
				Document::TYPE_STRICT_CORRECT,
101
				Document::TYPE_REGISTRATION,
102
				Document::TYPE_REGISTRATION_CHANGE,
103
				Document::TYPE_FN_CLOSE,
104
			]]],
105
		]);
106
	}
107
}