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
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @throws \Exception |
32
|
|
|
*/ |
33
|
|
|
public static function createFromArray(array $data): self |
34
|
|
|
{ |
35
|
|
|
$model = new self(); |
36
|
|
|
$model->sourceType = $data['sourceType']; |
37
|
|
|
$model->type = $data['type']; |
38
|
|
|
$model->documentIndex = $data['documentIndex']; |
39
|
|
|
$model->amount = $data['amount']; |
40
|
|
|
$model->operationDate = new \DateTimeImmutable($data['operationDate']); |
41
|
|
|
$model->dueDate = new \DateTimeImmutable($data['dueDate']); |
42
|
|
|
$model->oktmo = $data['oktmo']; |
43
|
|
|
$model->kbk = $data['kbk']; |
44
|
|
|
$model->status = $data['status']; |
45
|
|
|
$model->taxPeriodId = $data['taxPeriodId']; |
46
|
|
|
$model->regionName = $data['regionName']; |
47
|
|
|
$model->krsbAcceptedDate = $data['krsbAcceptedDate'] ? new \DateTimeImmutable($data['krsbAcceptedDate']) : null; |
48
|
|
|
|
49
|
|
|
return $model; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function getSourceType(): string |
53
|
|
|
{ |
54
|
|
|
return $this->sourceType; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function getKrsbAcceptedDate(): ?\DateTimeImmutable |
58
|
|
|
{ |
59
|
|
|
return $this->krsbAcceptedDate; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function getType(): string |
63
|
|
|
{ |
64
|
|
|
return $this->type; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getDocumentIndex(): string |
68
|
|
|
{ |
69
|
|
|
return $this->documentIndex; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function getAmount(): float |
73
|
|
|
{ |
74
|
|
|
return $this->amount; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getOperationDate(): \DateTimeImmutable |
78
|
|
|
{ |
79
|
|
|
return $this->operationDate; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function getDueDate(): \DateTimeImmutable |
83
|
|
|
{ |
84
|
|
|
return $this->dueDate; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function getOktmo(): string |
88
|
|
|
{ |
89
|
|
|
return $this->oktmo; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function getStatus(): string |
93
|
|
|
{ |
94
|
|
|
return $this->status; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function getKbk(): string |
98
|
|
|
{ |
99
|
|
|
return $this->kbk; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function getTaxPeriodId(): int |
103
|
|
|
{ |
104
|
|
|
return $this->taxPeriodId; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function getRegionName(): string |
108
|
|
|
{ |
109
|
|
|
return $this->regionName; |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|