Skip to content

Commit 15f3d03

Browse files
sbuerkPowerKiKi
authored andcommitted
[TASK] Add support for 052.001.08 and 053.001.08
* added xsd files to assets folder: - assets/camt.052.001.08.xsd - assets/camt.053.001.08.xsd * added support for 052.001.08: - added message-format and decoder for 052.001.08 - added camt052.v8.xml test file - added message v8 to EndToEnd tests - added 052.08 message to default config and adjusted default config test - added json file for regression test * added support for 053.001.08: - added message-format for 053.001.08 - added camt053.v8.xml test file - added 053.08 message to default config and adjusted default config test - added json file for regression test * documented as supported in README.md >> Same read capabilities are ensured like the versions before. Some new entities and attributes are missing and can be implemented in a dedicated change. Resolves: #142 Related: #124 Related: #126
1 parent 08fd5f6 commit 15f3d03

File tree

15 files changed

+5028
-8
lines changed

15 files changed

+5028
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,36 @@ Library to read CAMT files. Currently only CAMT.052, CAMT.053 and CAMT.054 are s
1212

1313
#### Camt 052
1414

15-
| Version | Supported |
16-
|:---------------:| :----------------: |
15+
| Version | Supported |
16+
|:---------------:|:------------------:|
1717
| camt.052.001.01 | :heavy_check_mark: |
1818
| camt.052.001.02 | :heavy_check_mark: |
1919
| camt.052.001.03 | |
2020
| camt.052.001.04 | :heavy_check_mark: |
2121
| camt.052.001.05 | |
2222
| camt.052.001.06 | :heavy_check_mark: |
23-
| camt.052.001.08 | |
23+
| camt.052.001.08 | :heavy_check_mark: |
2424
| camt.052.001.10 | |
2525
| camt.052.001.11 | |
2626

2727
#### Camt 053
2828

29-
| Version | Supported |
30-
|:---------------:| :----------------: |
29+
| Version | Supported |
30+
|:---------------:|:------------------:|
3131
| camt.053.001.01 | |
3232
| camt.053.001.02 | :heavy_check_mark: |
3333
| camt.053.001.03 | :heavy_check_mark: |
3434
| camt.053.001.04 | :heavy_check_mark: |
3535
| camt.053.001.05 | |
3636
| camt.053.001.06 | |
37-
| camt.053.001.08 | |
37+
| camt.053.001.08 | :heavy_check_mark: |
3838
| camt.053.001.10 | |
3939
| camt.053.001.11 | |
4040

4141
#### Camt 054
4242

43-
| Version | Supported |
44-
|:---------------:| :----------------: |
43+
| Version | Supported |
44+
|:---------------:|:------------------:|
4545
| camt.054.001.01 | |
4646
| camt.054.001.02 | :heavy_check_mark: |
4747
| camt.054.001.03 | |

assets/camt.052.001.08.xsd

Lines changed: 2070 additions & 0 deletions
Large diffs are not rendered by default.

assets/camt.053.001.08.xsd

Lines changed: 2070 additions & 0 deletions
Large diffs are not rendered by default.

src/Camt052/Decoder/V08/Message.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Genkgo\Camt\Camt052\Decoder\V08;
6+
7+
use Genkgo\Camt\Camt052\Decoder\Message as BaseMessageDecoder;
8+
use SimpleXMLElement;
9+
10+
class Message extends BaseMessageDecoder
11+
{
12+
/**
13+
* @inheritDoc
14+
*/
15+
public function getRootElement(SimpleXMLElement $document): SimpleXMLElement
16+
{
17+
return $document->BkToCstmrAcctRpt;
18+
}
19+
}

src/Camt052/MessageFormat/V08.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Genkgo\Camt\Camt052\MessageFormat;
6+
7+
use Genkgo\Camt\Camt052;
8+
use Genkgo\Camt\Decoder;
9+
use Genkgo\Camt\DecoderInterface;
10+
use Genkgo\Camt\MessageFormatInterface;
11+
12+
final class V08 implements MessageFormatInterface
13+
{
14+
public function getXmlNs(): string
15+
{
16+
return 'urn:iso:std:iso:20022:tech:xsd:camt.052.001.08';
17+
}
18+
19+
public function getMsgId(): string
20+
{
21+
return 'camt.052.001.08';
22+
}
23+
24+
public function getName(): string
25+
{
26+
return 'BankToCustomerAccountReportV08';
27+
}
28+
29+
public function getDecoder(): DecoderInterface
30+
{
31+
$entryTransactionDetailDecoder = new Camt052\Decoder\EntryTransactionDetail(new Decoder\Date());
32+
$entryDecoder = new Decoder\Entry($entryTransactionDetailDecoder);
33+
$recordDecoder = new Decoder\Record($entryDecoder, new Decoder\Date());
34+
$messageDecoder = new Camt052\Decoder\V08\Message($recordDecoder, new Decoder\Date());
35+
36+
return new Decoder($messageDecoder, sprintf('/assets/%s.xsd', $this->getMsgId()));
37+
}
38+
}

src/Camt053/MessageFormat/V08.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Genkgo\Camt\Camt053\MessageFormat;
6+
7+
use Genkgo\Camt\Camt053;
8+
use Genkgo\Camt\Decoder;
9+
use Genkgo\Camt\DecoderInterface;
10+
use Genkgo\Camt\MessageFormatInterface;
11+
12+
final class V08 implements MessageFormatInterface
13+
{
14+
public function getXmlNs(): string
15+
{
16+
return 'urn:iso:std:iso:20022:tech:xsd:camt.053.001.08';
17+
}
18+
19+
public function getMsgId(): string
20+
{
21+
return 'camt.053.001.08';
22+
}
23+
24+
public function getName(): string
25+
{
26+
return 'BankToCustomerStatementV08';
27+
}
28+
29+
public function getDecoder(): DecoderInterface
30+
{
31+
$entryTransactionDetailDecoder = new Camt053\Decoder\EntryTransactionDetail(new Decoder\Date());
32+
$entryDecoder = new Decoder\Entry($entryTransactionDetailDecoder);
33+
$recordDecoder = new Decoder\Record($entryDecoder, new Decoder\Date());
34+
$messageDecoder = new Camt053\Decoder\Message($recordDecoder, new Decoder\Date());
35+
36+
return new Decoder($messageDecoder, sprintf('/assets/%s.xsd', $this->getMsgId()));
37+
}
38+
}

src/Config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public static function getDefault(): self
4747
$config->addMessageFormat(new Camt052\MessageFormat\V02());
4848
$config->addMessageFormat(new Camt052\MessageFormat\V04());
4949
$config->addMessageFormat(new Camt052\MessageFormat\V06());
50+
$config->addMessageFormat(new Camt052\MessageFormat\V08());
5051
$config->addMessageFormat(new Camt053\MessageFormat\V02());
5152
$config->addMessageFormat(new Camt053\MessageFormat\V03());
5253
$config->addMessageFormat(new Camt053\MessageFormat\V04());
54+
$config->addMessageFormat(new Camt053\MessageFormat\V08());
5355
$config->addMessageFormat(new Camt054\MessageFormat\V02());
5456
$config->addMessageFormat(new Camt054\MessageFormat\V04());
5557
$config->addMessageFormat(new Camt054\MessageFormat\V08());

test/Unit/Camt052/EndToEndTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,22 @@ protected function getV6Message(): Message
5656
return (new MessageFormat\V06())->getDecoder()->decode($dom);
5757
}
5858

59+
protected function getV8Message(): Message
60+
{
61+
$dom = new DOMDocument('1.0', 'UTF-8');
62+
$dom->load('test/data/camt052.v8.xml');
63+
64+
return (new MessageFormat\V08())->getDecoder()->decode($dom);
65+
}
66+
5967
public function testGroupHeader(): void
6068
{
6169
$messages = [
6270
$this->getV1Message(),
6371
$this->getV2Message(),
6472
$this->getV4Message(),
6573
$this->getV6Message(),
74+
$this->getV8Message(),
6675
];
6776

6877
/** @var Message $message */
@@ -96,6 +105,7 @@ public function testReports(): void
96105
$this->getV1Message(),
97106
$this->getV2Message(),
98107
$this->getV4Message(),
108+
$this->getV8Message(),
99109
];
100110

101111
foreach ($messages as $message) {
@@ -123,6 +133,7 @@ public function testEntries(): void
123133
$this->getV1Message(),
124134
$this->getV2Message(),
125135
$this->getV4Message(),
136+
$this->getV8Message(),
126137
];
127138

128139
foreach ($messages as $message) {
@@ -154,6 +165,7 @@ public function testStatuses(): void
154165
$messages = [
155166
$this->getV1Message(),
156167
$this->getV4Message(),
168+
$this->getV8Message(),
157169
];
158170

159171
self::assertEquals('BOOK', $messages[0]->getRecords()[0]->getEntries()[0]->getStatus());

test/Unit/Camt053/EndToEndTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ protected function getV4Message(): Message
4949
return (new MessageFormat\V04())->getDecoder()->decode($dom);
5050
}
5151

52+
protected function getV8Message(): Message
53+
{
54+
$dom = new DOMDocument('1.0', 'UTF-8');
55+
$dom->load('test/data/camt053.v8.xml');
56+
57+
return (new MessageFormat\V08())->getDecoder()->decode($dom);
58+
}
59+
5260
public function testWrongDocument(): Message
5361
{
5462
$this->expectException(InvalidMessageException::class);
@@ -80,12 +88,20 @@ public function testV4Document(): void
8088
self::assertInstanceOf(Message::class, (new MessageFormat\V04())->getDecoder()->decode($dom));
8189
}
8290

91+
public function testV8Document(): void
92+
{
93+
$dom = new DOMDocument('1.0', 'UTF-8');
94+
$dom->load('test/data/camt053.v8.xml');
95+
self::assertInstanceOf(Message::class, (new MessageFormat\V08())->getDecoder()->decode($dom));
96+
}
97+
8398
public function testGroupHeader(): void
8499
{
85100
$messages = [
86101
$this->getV2Message(),
87102
$this->getV3Message(),
88103
$this->getV4Message(),
104+
$this->getV8Message(),
89105
$this->getV2UltimateMessage(),
90106
];
91107

@@ -120,6 +136,7 @@ public function testStatements(): void
120136
$this->getV2Message(),
121137
$this->getV3Message(),
122138
$this->getV4Message(),
139+
$this->getV8Message(),
123140
$this->getV2UltimateMessage(),
124141
];
125142

@@ -154,6 +171,7 @@ public function testBalance(): void
154171
$this->getV2Message(),
155172
$this->getV3Message(),
156173
$this->getV4Message(),
174+
$this->getV8Message(),
157175
$this->getV2UltimateMessage(),
158176
];
159177

@@ -212,6 +230,7 @@ public function testEntries(): void
212230
$this->getV2Message(),
213231
$this->getV3Message(),
214232
$this->getV4Message(),
233+
$this->getV8Message(),
215234
$this->getV2UltimateMessage(),
216235
];
217236

@@ -278,6 +297,7 @@ public function testStructuredMessage(): void
278297
$this->getV2Message(),
279298
$this->getV3Message(),
280299
$this->getV4Message(),
300+
$this->getV8Message(),
281301
$this->getV2UltimateMessage(),
282302
];
283303

test/Unit/ConfigTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ public function testDefaultConfigHasMessageFormats(): void
2727
Camt052\MessageFormat\V02::class,
2828
Camt052\MessageFormat\V04::class,
2929
Camt052\MessageFormat\V06::class,
30+
Camt052\MessageFormat\V08::class,
3031
Camt053\MessageFormat\V02::class,
3132
Camt053\MessageFormat\V03::class,
3233
Camt053\MessageFormat\V04::class,
34+
Camt053\MessageFormat\V08::class,
3335
Camt054\MessageFormat\V02::class,
3436
Camt054\MessageFormat\V04::class,
3537
Camt054\MessageFormat\V08::class,

0 commit comments

Comments
 (0)