|
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
|
|
|
* @throws \Exception |
|
30
|
|
|
*/ |
|
31
|
|
|
public static function createFromArray(array $data): self |
|
32
|
|
|
{ |
|
33
|
|
|
$model = new self(); |
|
34
|
|
|
|
|
35
|
|
|
$model->totalForPayment = $data['totalForPayment']; |
|
36
|
|
|
$model->total = $data['total']; |
|
37
|
|
|
$model->tax = $data['tax']; |
|
38
|
|
|
$model->debt = $data['debt']; |
|
39
|
|
|
$model->overpayment = $data['overpayment']; |
|
40
|
|
|
$model->penalty = $data['penalty']; |
|
41
|
|
|
$model->nominalTax = $data['nominalTax']; |
|
42
|
|
|
$model->nominalOverpayment = $data['nominalOverpayment']; |
|
43
|
|
|
$model->taxPeriodId = $data['taxPeriodId']; |
|
44
|
|
|
$model->lastPaymentAmount = $data['lastPaymentAmount']; |
|
45
|
|
|
$model->lastPaymentDate = $data['lastPaymentDate'] ? new \DateTimeImmutable($data['lastPaymentDate']) : null; |
|
46
|
|
|
$model->regions = $data['regions']; |
|
47
|
|
|
|
|
48
|
|
|
return $model; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getTotalForPayment(): float |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->totalForPayment; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function getTotal(): float |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->total; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getTax(): float |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->tax; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function getDebt(): float |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->debt; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getOverpayment(): float |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->overpayment; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function getPenalty(): float |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->penalty; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function getNominalTax(): float |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->nominalTax; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function getNominalOverpayment(): float |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->nominalOverpayment; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
public function getTaxPeriodId(): int |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->taxPeriodId; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function getLastPaymentAmount(): ?float |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->lastPaymentAmount; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function getLastPaymentDate(): ?\DateTimeImmutable |
|
102
|
|
|
{ |
|
103
|
|
|
return $this->lastPaymentDate; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
public function getRegions(): array |
|
107
|
|
|
{ |
|
108
|
|
|
return $this->regions; |
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|