1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Genkgo\Camt\Camt053\DTO; |
4
|
|
|
|
5
|
|
|
use BadMethodCallException; |
6
|
|
|
use DateTimeImmutable; |
7
|
|
|
use Money\Money; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class Entry |
11
|
|
|
* @package Genkgo\Camt\Camt053 |
12
|
|
|
*/ |
13
|
|
|
class Entry |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var Statement |
17
|
|
|
*/ |
18
|
|
|
private $statement; |
19
|
|
|
/** |
20
|
|
|
* @var Money |
21
|
|
|
*/ |
22
|
|
|
private $amount; |
23
|
|
|
/** |
24
|
|
|
* @var DateTimeImmutable |
25
|
|
|
*/ |
26
|
|
|
private $bookingDate; |
27
|
|
|
/** |
28
|
|
|
* @var DateTimeImmutable |
29
|
|
|
*/ |
30
|
|
|
private $valueDate; |
31
|
|
|
/** |
32
|
|
|
* @var EntryTransactionDetail[] |
33
|
|
|
*/ |
34
|
|
|
private $transactionDetails = []; |
35
|
|
|
/** |
36
|
|
|
* @var bool |
37
|
|
|
*/ |
38
|
|
|
private $reversalIndicator = false; |
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
private $reference; |
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
private $accountServicerReference; |
47
|
|
|
/** |
48
|
|
|
* @var int |
49
|
|
|
*/ |
50
|
|
|
private $index; |
51
|
|
|
/** |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
private $batchPaymentId; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param Statement $statement |
58
|
|
|
* @param int $index |
59
|
|
|
* @param Money $amount |
60
|
|
|
* @param DateTimeImmutable $bookingDate |
61
|
|
|
* @param DateTimeImmutable $valueDate |
62
|
|
|
*/ |
63
|
10 |
|
public function __construct(Statement $statement, $index, Money $amount, DateTimeImmutable $bookingDate, DateTimeImmutable $valueDate) |
64
|
|
|
{ |
65
|
10 |
|
$this->statement = $statement; |
66
|
10 |
|
$this->index = $index; |
67
|
10 |
|
$this->amount = $amount; |
68
|
10 |
|
$this->bookingDate = $bookingDate; |
69
|
10 |
|
$this->valueDate = $valueDate; |
70
|
10 |
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return Statement |
74
|
|
|
*/ |
75
|
|
|
public function getStatement() |
76
|
|
|
{ |
77
|
|
|
return $this->statement; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return Money |
82
|
|
|
*/ |
83
|
2 |
|
public function getAmount() |
84
|
|
|
{ |
85
|
2 |
|
return $this->amount; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return DateTimeImmutable |
90
|
|
|
*/ |
91
|
1 |
|
public function getBookingDate() |
92
|
|
|
{ |
93
|
1 |
|
return $this->bookingDate; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return DateTimeImmutable |
98
|
|
|
*/ |
99
|
1 |
|
public function getValueDate() |
100
|
|
|
{ |
101
|
1 |
|
return $this->valueDate; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param EntryTransactionDetail $detail |
106
|
|
|
*/ |
107
|
9 |
|
public function addTransactionDetail(EntryTransactionDetail $detail) |
108
|
|
|
{ |
109
|
9 |
|
$this->transactionDetails[] = $detail; |
110
|
9 |
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return EntryTransactionDetail[] |
114
|
|
|
*/ |
115
|
2 |
|
public function getTransactionDetails() |
116
|
|
|
{ |
117
|
2 |
|
return $this->transactionDetails; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return EntryTransactionDetail |
122
|
|
|
*/ |
123
|
1 |
|
public function getTransactionDetail() |
124
|
|
|
{ |
125
|
1 |
|
if (isset($this->transactionDetails[0])) { |
126
|
1 |
|
return $this->transactionDetails[0]; |
127
|
|
|
} else { |
128
|
|
|
throw new BadMethodCallException('There are no transaction details at all for this entry'); |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return bool |
134
|
|
|
*/ |
135
|
|
|
public function getReversalIndicator() |
136
|
|
|
{ |
137
|
|
|
return $this->reversalIndicator; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param boolean $reversalIndicator |
142
|
|
|
*/ |
143
|
1 |
|
public function setReversalIndicator($reversalIndicator) |
144
|
|
|
{ |
145
|
1 |
|
$this->reversalIndicator = $reversalIndicator; |
146
|
1 |
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return string |
150
|
|
|
*/ |
151
|
|
|
public function getReference() |
152
|
|
|
{ |
153
|
|
|
return $this->reference; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param string $reference |
158
|
|
|
*/ |
159
|
1 |
|
public function setReference($reference) |
160
|
|
|
{ |
161
|
1 |
|
$this->reference = $reference; |
162
|
1 |
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Unique reference as assigned by the account servicing institution to unambiguously identify the entry. |
166
|
|
|
* @return string |
167
|
|
|
*/ |
168
|
|
|
public function getAccountServicerReference() |
169
|
|
|
{ |
170
|
|
|
return $this->accountServicerReference; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @param string $accountServicerReference |
175
|
|
|
*/ |
176
|
3 |
|
public function setAccountServicerReference($accountServicerReference) |
177
|
|
|
{ |
178
|
3 |
|
$this->accountServicerReference = $accountServicerReference; |
179
|
3 |
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return int |
183
|
|
|
*/ |
184
|
|
|
public function getIndex() |
185
|
|
|
{ |
186
|
|
|
return $this->index; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param string $batchPaymentId |
191
|
|
|
*/ |
192
|
1 |
|
public function setBatchPaymentId($batchPaymentId) |
193
|
|
|
{ |
194
|
1 |
|
$this->batchPaymentId = trim($batchPaymentId); |
195
|
1 |
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @return string |
199
|
|
|
*/ |
200
|
|
|
public function getBatchPaymentId() |
201
|
|
|
{ |
202
|
|
|
return $this->batchPaymentId; |
203
|
|
|
} |
204
|
|
|
} |
205
|
|
|
|