1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Monobank\Response\Model; |
6
|
|
|
|
7
|
|
|
final class Statement |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
private $id; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var int |
16
|
|
|
*/ |
17
|
|
|
private $time; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
private $description; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var int |
26
|
|
|
*/ |
27
|
|
|
private $mcc; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var bool |
31
|
|
|
*/ |
32
|
|
|
private $hold; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var int |
36
|
|
|
*/ |
37
|
|
|
private $amount; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var int |
41
|
|
|
*/ |
42
|
|
|
private $operationAmount; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var int |
46
|
|
|
*/ |
47
|
|
|
private $currencyCode; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var int |
51
|
|
|
*/ |
52
|
|
|
private $commissionRate; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var int |
56
|
|
|
*/ |
57
|
|
|
private $cashbackAmount; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var int |
61
|
|
|
*/ |
62
|
|
|
private $balance; |
63
|
|
|
|
64
|
|
|
public function __construct( |
65
|
|
|
string $id, |
66
|
|
|
int $time, |
67
|
|
|
string $description, |
68
|
|
|
int $mcc, |
69
|
|
|
bool $hold, |
70
|
|
|
int $amount, |
71
|
|
|
int $operationAmount, |
72
|
|
|
int $currencyCode, |
73
|
|
|
int $commissionRate, |
74
|
|
|
int $cashbackAmount, |
75
|
|
|
int $balance |
76
|
|
|
) { |
77
|
|
|
$this->id = $id; |
78
|
|
|
$this->time = $time; |
79
|
|
|
$this->description = $description; |
80
|
|
|
$this->mcc = $mcc; |
81
|
|
|
$this->hold = $hold; |
82
|
|
|
$this->amount = $amount; |
83
|
|
|
$this->operationAmount = $operationAmount; |
84
|
|
|
$this->currencyCode = $currencyCode; |
85
|
|
|
$this->commissionRate = $commissionRate; |
86
|
|
|
$this->cashbackAmount = $cashbackAmount; |
87
|
|
|
$this->balance = $balance; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public static function fromResponse(array $data): self |
91
|
|
|
{ |
92
|
|
|
return new self( |
93
|
|
|
$data['id'], |
94
|
|
|
$data['time'], |
95
|
|
|
$data['description'], |
96
|
|
|
$data['mcc'], |
97
|
|
|
$data['hold'], |
98
|
|
|
$data['amount'], |
99
|
|
|
$data['operationAmount'], |
100
|
|
|
$data['currencyCode'], |
101
|
|
|
$data['commissionRate'], |
102
|
|
|
$data['cashbackAmount'], |
103
|
|
|
$data['balance'] |
104
|
|
|
); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function id(): string |
108
|
|
|
{ |
109
|
|
|
return $this->id; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function time(): \DateTime |
113
|
|
|
{ |
114
|
|
|
return (new \DateTime())->setTimestamp($this->time); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function description(): string |
118
|
|
|
{ |
119
|
|
|
return $this->description; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function mcc(): int |
123
|
|
|
{ |
124
|
|
|
return $this->mcc; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function isHold(): bool |
128
|
|
|
{ |
129
|
|
|
return $this->hold; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function amount(): int |
133
|
|
|
{ |
134
|
|
|
return $this->amount; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function operationAmount(): int |
138
|
|
|
{ |
139
|
|
|
return $this->operationAmount; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function currencyCode(): int |
143
|
|
|
{ |
144
|
|
|
return $this->currencyCode; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function commissionRate(): int |
148
|
|
|
{ |
149
|
|
|
return $this->commissionRate; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function cashbackAmount(): int |
153
|
|
|
{ |
154
|
|
|
return $this->cashbackAmount; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
public function balance(): int |
158
|
|
|
{ |
159
|
|
|
return $this->balance; |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
|