1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Genkgo\Camt\DTO; |
6
|
|
|
|
7
|
|
|
class RemittanceInformation |
8
|
|
|
{ |
9
|
|
|
private ?string $message = null; |
10
|
|
|
|
11
|
|
|
private ?CreditorReferenceInformation $creditorReferenceInformation = null; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @var StructuredRemittanceInformation[] |
15
|
|
|
*/ |
16
|
|
|
private array $structuredBlocks = []; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var UnstructuredRemittanceInformation[] |
20
|
|
|
*/ |
21
|
|
|
private array $unstructuredBlocks = []; |
22
|
|
|
|
23
|
|
|
public static function fromUnstructured(string $message): self |
24
|
|
|
{ |
25
|
|
|
$information = new self(); |
26
|
|
|
$information->message = $message; |
27
|
|
|
|
28
|
|
|
return $information; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function getCreditorReferenceInformation(): ?CreditorReferenceInformation |
32
|
|
|
{ |
33
|
|
|
return $this->creditorReferenceInformation; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function setCreditorReferenceInformation(CreditorReferenceInformation $creditorReferenceInformation): void |
37
|
14 |
|
{ |
38
|
|
|
$this->creditorReferenceInformation = $creditorReferenceInformation; |
39
|
14 |
|
$this->message = $creditorReferenceInformation->getRef(); |
40
|
|
|
} |
41
|
|
|
|
42
|
14 |
|
/** |
43
|
|
|
* @deprecated Use getStructuredBlocks method instead |
44
|
14 |
|
*/ |
45
|
14 |
|
public function getMessage(): ?string |
46
|
14 |
|
{ |
47
|
|
|
return $this->message; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
11 |
|
* @deprecated Use addStructuredBlock method instead |
52
|
|
|
*/ |
53
|
11 |
|
public function setMessage(string $message): void |
54
|
|
|
{ |
55
|
|
|
$this->message = $message; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function addStructuredBlock(StructuredRemittanceInformation $structuredRemittanceInformation): void |
59
|
10 |
|
{ |
60
|
|
|
$this->structuredBlocks[] = $structuredRemittanceInformation; |
61
|
10 |
|
} |
62
|
10 |
|
|
63
|
|
|
/** |
64
|
14 |
|
* @return StructuredRemittanceInformation[] |
65
|
|
|
*/ |
66
|
14 |
|
public function getStructuredBlocks(): array |
67
|
14 |
|
{ |
68
|
|
|
return $this->structuredBlocks; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function getStructuredBlock(): ?StructuredRemittanceInformation |
72
|
1 |
|
{ |
73
|
|
|
if (isset($this->structuredBlocks[0])) { |
74
|
1 |
|
return $this->structuredBlocks[0]; |
75
|
|
|
} |
76
|
|
|
|
77
|
1 |
|
return null; |
78
|
|
|
} |
79
|
1 |
|
|
80
|
1 |
|
public function addUnstructuredBlock(UnstructuredRemittanceInformation $unstructuredRemittanceInformation): void |
81
|
|
|
{ |
82
|
|
|
$this->unstructuredBlocks[] = $unstructuredRemittanceInformation; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
10 |
|
* @return UnstructuredRemittanceInformation[] |
87
|
|
|
*/ |
88
|
10 |
|
public function getUnstructuredBlocks(): array |
89
|
10 |
|
{ |
90
|
|
|
return $this->unstructuredBlocks; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getUnstructuredBlock(): ?UnstructuredRemittanceInformation |
94
|
1 |
|
{ |
95
|
|
|
if (isset($this->unstructuredBlocks[0])) { |
96
|
1 |
|
return $this->unstructuredBlocks[0]; |
97
|
|
|
} |
98
|
|
|
|
99
|
1 |
|
return null; |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|