1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Shoman4eg\Nalog\Model\Tax; |
5
|
|
|
|
6
|
|
|
use Shoman4eg\Nalog\Model\CreatableFromArray; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @author Artem Dubinin <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
final class Payment implements CreatableFromArray |
12
|
|
|
{ |
13
|
|
|
private string $sourceType; |
14
|
|
|
private string $type; |
15
|
|
|
private string $documentIndex; |
16
|
|
|
private float $amount; |
17
|
|
|
private \DateTimeImmutable $operationDate; |
18
|
|
|
private \DateTimeImmutable $dueDate; |
19
|
|
|
private string $oktmo; |
20
|
|
|
private string $kbk; |
21
|
|
|
private string $status; |
22
|
|
|
private int $taxPeriodId; |
23
|
|
|
private string $regionName; |
24
|
|
|
private ?\DateTimeImmutable $krsbAcceptedDate; |
25
|
|
|
|
26
|
|
|
private function __construct() {} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @throws \Exception |
30
|
|
|
*/ |
31
|
|
|
public static function createFromArray(array $data): self |
32
|
|
|
{ |
33
|
|
|
$model = new self(); |
34
|
|
|
$model->sourceType = $data['sourceType']; |
35
|
|
|
$model->type = $data['type']; |
36
|
|
|
$model->documentIndex = $data['documentIndex']; |
37
|
|
|
$model->amount = $data['amount']; |
38
|
|
|
$model->operationDate = new \DateTimeImmutable($data['operationDate']); |
39
|
|
|
$model->dueDate = new \DateTimeImmutable($data['dueDate']); |
40
|
|
|
$model->oktmo = $data['oktmo']; |
41
|
|
|
$model->kbk = $data['kbk']; |
42
|
|
|
$model->status = $data['status']; |
43
|
|
|
$model->taxPeriodId = $data['taxPeriodId']; |
44
|
|
|
$model->regionName = $data['regionName']; |
45
|
|
|
$model->krsbAcceptedDate = $data['krsbAcceptedDate'] ? new \DateTimeImmutable($data['krsbAcceptedDate']) : null; |
46
|
|
|
|
47
|
|
|
return $model; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function getSourceType(): string |
51
|
|
|
{ |
52
|
|
|
return $this->sourceType; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function getKrsbAcceptedDate(): ?\DateTimeImmutable |
56
|
|
|
{ |
57
|
|
|
return $this->krsbAcceptedDate; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getType(): string |
61
|
|
|
{ |
62
|
|
|
return $this->type; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function getDocumentIndex(): string |
66
|
|
|
{ |
67
|
|
|
return $this->documentIndex; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function getAmount(): float |
71
|
|
|
{ |
72
|
|
|
return $this->amount; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getOperationDate(): \DateTimeImmutable |
76
|
|
|
{ |
77
|
|
|
return $this->operationDate; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getDueDate(): \DateTimeImmutable |
81
|
|
|
{ |
82
|
|
|
return $this->dueDate; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getOktmo(): string |
86
|
|
|
{ |
87
|
|
|
return $this->oktmo; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getStatus(): string |
91
|
|
|
{ |
92
|
|
|
return $this->status; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function getKbk(): string |
96
|
|
|
{ |
97
|
|
|
return $this->kbk; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function getTaxPeriodId(): int |
101
|
|
|
{ |
102
|
|
|
return $this->taxPeriodId; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function getRegionName(): string |
106
|
|
|
{ |
107
|
|
|
return $this->regionName; |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|