-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathTransaction.php
More file actions
219 lines (180 loc) · 5.63 KB
/
Transaction.php
File metadata and controls
219 lines (180 loc) · 5.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
declare(strict_types = 1);
namespace FioApi\Download\Entity;
class Transaction
{
/** @var string */
protected $id;
/** @var \DateTimeImmutable */
protected $date;
/** @var float */
protected $amount;
/** @var string */
protected $currency;
/** @var string|null */
protected $senderAccountNumber;
/** @var string|null */
protected $senderBankCode;
/** @var string|null */
protected $senderBankName;
/** @var string|null */
protected $senderName;
/** @var string|null */
protected $constantSymbol;
/** @var string|null */
protected $variableSymbol;
/** @var string|null */
protected $specificSymbol;
/** @var string|null */
protected $userIdentity;
/** @var string|null */
protected $userMessage;
/** @var string */
protected $transactionType;
/** @var string|null */
protected $performedBy;
/** @var string|null */
protected $comment;
/** @var float|null */
protected $paymentOrderId;
/** @var string|null */
protected $specification;
protected function __construct(
string $id,
\DateTimeImmutable $date,
float $amount,
string $currency,
?string $senderAccountNumber,
?string $senderBankCode,
?string $senderBankName,
?string $senderName,
?string $constantSymbol,
?string $variableSymbol,
?string $specificSymbol,
?string $userIdentity,
?string $userMessage,
string $transactionType,
?string $performedBy,
?string $comment,
?float $paymentOrderId,
?string $specification
) {
$this->id = $id;
$this->date = $date;
$this->amount = $amount;
$this->currency = $currency;
$this->senderAccountNumber = $senderAccountNumber;
$this->senderBankCode = $senderBankCode;
$this->senderBankName = $senderBankName;
$this->senderName = $senderName;
$this->constantSymbol = $constantSymbol;
$this->variableSymbol = $variableSymbol;
$this->specificSymbol = $specificSymbol;
$this->userIdentity = $userIdentity;
$this->userMessage = $userMessage;
$this->transactionType = $transactionType;
$this->performedBy = $performedBy;
$this->comment = $comment;
$this->paymentOrderId = $paymentOrderId;
$this->specification = $specification;
}
/**
* @param \stdClass $data Transaction data from JSON API response
* @return Transaction
*/
public static function create(\stdClass $data): Transaction
{
return new self(
(string) $data->column22->value, //ID pohybu
new \DateTimeImmutable($data->column0->value), //Datum
$data->column1->value, //Objem
$data->column14->value, //Měna
!empty($data->column2) ? $data->column2->value : null, //Protiúčet
!empty($data->column3) ? $data->column3->value : null, //Kód banky
!empty($data->column12) ? $data->column12->value : null, //Název banky
!empty($data->column10) ? $data->column10->value : null, //Název protiúčtu
!empty($data->column4) ? $data->column4->value : null, //KS
!empty($data->column5) ? $data->column5->value : null, //VS
!empty($data->column6) ? $data->column6->value : null, //SS
!empty($data->column7) ? $data->column7->value : null, //Uživatelská identifikace
!empty($data->column16) ? $data->column16->value : null, //Zpráva pro příjemce
!empty($data->column8) ? $data->column8->value : '', //Typ
!empty($data->column9) ? $data->column9->value : null, //Provedl
!empty($data->column25) ? $data->column25->value : null, //Komentář
!empty($data->column17) ? $data->column17->value : null, //ID pokynu
!empty($data->column18) ? $data->column18->value : null //Upřesnění
);
}
public function getId(): string
{
return $this->id;
}
public function getDate(): \DateTimeImmutable
{
return $this->date;
}
public function getAmount(): float
{
return $this->amount;
}
public function getCurrency(): string
{
return $this->currency;
}
public function getSenderAccountNumber(): ?string
{
return $this->senderAccountNumber;
}
public function getSenderBankCode(): ?string
{
return $this->senderBankCode;
}
public function getSenderBankName(): ?string
{
return $this->senderBankName;
}
public function getSenderName(): ?string
{
return $this->senderName;
}
public function getConstantSymbol(): ?string
{
return $this->constantSymbol;
}
public function getVariableSymbol(): ?string
{
return $this->variableSymbol;
}
public function getSpecificSymbol(): ?string
{
return $this->specificSymbol;
}
public function getUserIdentity(): ?string
{
return $this->userIdentity;
}
public function getUserMessage(): ?string
{
return $this->userMessage;
}
public function getTransactionType(): string
{
return $this->transactionType;
}
public function getPerformedBy(): ?string
{
return $this->performedBy;
}
public function getComment(): ?string
{
return $this->comment;
}
public function getPaymentOrderId(): ?float
{
return $this->paymentOrderId;
}
public function getSpecification(): ?string
{
return $this->specification;
}
}