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 Tax implements CreatableFromArray |
12
|
|
|
{ |
13
|
|
|
private float $totalForPayment; |
14
|
|
|
private float $total; |
15
|
|
|
private float $tax; |
16
|
|
|
private float $debt; |
17
|
|
|
private float $overpayment; |
18
|
|
|
private float $penalty; |
19
|
|
|
private float $nominalTax; |
20
|
|
|
private float $nominalOverpayment; |
21
|
|
|
private int $taxPeriodId; |
22
|
|
|
private ?float $lastPaymentAmount; |
23
|
|
|
private ?\DateTimeImmutable $lastPaymentDate; |
24
|
|
|
private array $regions; |
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
|
|
|
|
37
|
|
|
$model->totalForPayment = $data['totalForPayment']; |
38
|
|
|
$model->total = $data['total']; |
39
|
|
|
$model->tax = $data['tax']; |
40
|
|
|
$model->debt = $data['debt']; |
41
|
|
|
$model->overpayment = $data['overpayment']; |
42
|
|
|
$model->penalty = $data['penalty']; |
43
|
|
|
$model->nominalTax = $data['nominalTax']; |
44
|
|
|
$model->nominalOverpayment = $data['nominalOverpayment']; |
45
|
|
|
$model->taxPeriodId = $data['taxPeriodId']; |
46
|
|
|
$model->lastPaymentAmount = $data['lastPaymentAmount']; |
47
|
|
|
$model->lastPaymentDate = $data['lastPaymentDate'] ? new \DateTimeImmutable($data['lastPaymentDate']) : null; |
48
|
|
|
$model->regions = $data['regions']; |
49
|
|
|
|
50
|
|
|
return $model; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getTotalForPayment(): float |
54
|
|
|
{ |
55
|
|
|
return $this->totalForPayment; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getTotal(): float |
59
|
|
|
{ |
60
|
|
|
return $this->total; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getTax(): float |
64
|
|
|
{ |
65
|
|
|
return $this->tax; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getDebt(): float |
69
|
|
|
{ |
70
|
|
|
return $this->debt; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getOverpayment(): float |
74
|
|
|
{ |
75
|
|
|
return $this->overpayment; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getPenalty(): float |
79
|
|
|
{ |
80
|
|
|
return $this->penalty; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getNominalTax(): float |
84
|
|
|
{ |
85
|
|
|
return $this->nominalTax; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getNominalOverpayment(): float |
89
|
|
|
{ |
90
|
|
|
return $this->nominalOverpayment; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getTaxPeriodId(): int |
94
|
|
|
{ |
95
|
|
|
return $this->taxPeriodId; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getLastPaymentAmount(): ?float |
99
|
|
|
{ |
100
|
|
|
return $this->lastPaymentAmount; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function getLastPaymentDate(): ?\DateTimeImmutable |
104
|
|
|
{ |
105
|
|
|
return $this->lastPaymentDate; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function getRegions(): array |
109
|
|
|
{ |
110
|
|
|
return $this->regions; |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|