diff --git a/src/DTO/Balance.php b/src/DTO/Balance.php
index d068de1..86dd2d2 100644
--- a/src/DTO/Balance.php
+++ b/src/DTO/Balance.php
@@ -17,6 +17,16 @@ class Balance
public const TYPE_CLOSING_AVAILABLE = 'closing_available';
+ public const TYPE_FORWARD_AVAILABLE = 'forward_available';
+
+ public const TYPE_INFORMATION = 'information';
+
+ public const TYPE_INTERIM = 'interim';
+
+ public const TYPE_INTERIM_AVAILABLE = 'interim_available';
+
+ public const TYPE_EXPECTED_CREDIT = 'expected_credit';
+
private Money $amount;
private string $type;
@@ -64,4 +74,29 @@ public static function closingAvailable(Money $amount, DateTimeImmutable $date):
{
return new self(self::TYPE_CLOSING_AVAILABLE, $amount, $date);
}
+
+ public static function forwardAvailable(Money $amount, DateTimeImmutable $date): self
+ {
+ return new self(self::TYPE_FORWARD_AVAILABLE, $amount, $date);
+ }
+
+ public static function information(Money $amount, DateTimeImmutable $date): self
+ {
+ return new self(self::TYPE_INFORMATION, $amount, $date);
+ }
+
+ public static function interim(Money $amount, DateTimeImmutable $date): self
+ {
+ return new self(self::TYPE_INTERIM, $amount, $date);
+ }
+
+ public static function interimAvailable(Money $amount, DateTimeImmutable $date): self
+ {
+ return new self(self::TYPE_INTERIM_AVAILABLE, $amount, $date);
+ }
+
+ public static function expectedCredit(Money $amount, DateTimeImmutable $date): self
+ {
+ return new self(self::TYPE_EXPECTED_CREDIT, $amount, $date);
+ }
}
diff --git a/src/Decoder/Record.php b/src/Decoder/Record.php
index b468aa4..a3d4570 100644
--- a/src/Decoder/Record.php
+++ b/src/Decoder/Record.php
@@ -68,6 +68,42 @@ public function addBalances(RecordWithBalances $record, SimpleXMLElement $xmlRec
$date
));
+ break;
+ case 'FWAV':
+ $record->addBalance(DTO\Balance::forwardAvailable(
+ $money,
+ $date
+ ));
+
+ break;
+ case 'INFO':
+ $record->addBalance(DTO\Balance::information(
+ $money,
+ $date
+ ));
+
+ break;
+ case 'ITAV':
+ $record->addBalance(DTO\Balance::interimAvailable(
+ $money,
+ $date
+ ));
+
+ break;
+ case 'ITBD':
+ $record->addBalance(DTO\Balance::interim(
+ $money,
+ $date
+ ));
+
+ break;
+
+ case 'XPCD':
+ $record->addBalance(DTO\Balance::expectedCredit(
+ $money,
+ $date
+ ));
+
break;
default:
break;
diff --git a/test/Unit/RegressionTest.php b/test/Unit/RegressionTest.php
index b864d6c..bbc577e 100644
--- a/test/Unit/RegressionTest.php
+++ b/test/Unit/RegressionTest.php
@@ -27,14 +27,13 @@ protected function tearDown(): void
/**
* @dataProvider providerRegression
*/
- public function testRegression(string $file): void
+ public function testRegression(string $file, string $expectedFile): void
{
$reader = new Reader(Config::getDefault());
$message = $reader->readFile($file);
$dumper = new Dumper();
$actual = $dumper->dump($message);
- $expectedFile = str_replace('.xml', '.json', $file);
$this->assertFile($expectedFile, $actual);
}
@@ -58,23 +57,11 @@ private function assertFile(string $file, string $actualContent): void
public static function providerRegression(): iterable
{
- yield ['test/data/camt052.v1.xml'];
- yield ['test/data/camt052.v2.other-account.xml'];
- yield ['test/data/camt052.v2.xml'];
- yield ['test/data/camt052.v4.xml'];
- yield ['test/data/camt052.v6.xml'];
- yield ['test/data/camt052.v8.xml'];
- yield ['test/data/camt053.v2.five.decimals.xml'];
- yield ['test/data/camt053.v2.minimal.ultimate.xml'];
- yield ['test/data/camt053.v2.minimal.xml'];
- yield ['test/data/camt053.v2.multi.statement.xml'];
- yield ['test/data/camt053.v3.xml'];
- yield ['test/data/camt053.v4.xml'];
- yield ['test/data/camt053.v8.xml'];
- yield ['test/data/camt054.v2.xml'];
- yield ['test/data/camt054.v4.xml'];
- yield ['test/data/camt054.v8-with-UETR.xml'];
- yield ['test/data/camt054.v8-with-financial-institution.xml'];
- yield ['test/data/camt054.v8.xml'];
+ foreach ((glob('test/data/*.xml') ?: []) as $file) {
+ $expectedFile = str_replace('.xml', '.json', $file);
+ if (is_file($expectedFile)) {
+ yield $file => [$file, $expectedFile];
+ }
+ }
}
}
diff --git a/test/data/camt052.v4.json b/test/data/camt052.v4.json
index 71a7b92..eb08709 100644
--- a/test/data/camt052.v4.json
+++ b/test/data/camt052.v4.json
@@ -49,7 +49,24 @@
"getIdentification": "CH2801234000123456789"
},
"getAdditionalInformation": "Additional Information",
- "getBalances": [],
+ "getBalances": [
+ {
+ "__CLASS__": "Genkgo\\Camt\\DTO\\Balance",
+ "getAmount": {
+ "__CLASS__": "Money\\Money",
+ "getAmount": "1002215",
+ "getCurrency": {
+ "__CLASS__": "Money\\Currency",
+ "getCode": "CHF"
+ }
+ },
+ "getDate": {
+ "__CLASS__": "DateTimeImmutable",
+ "0": "2016-06-14T00:00:00+00:00"
+ },
+ "getType": "interim"
+ }
+ ],
"getCopyDuplicateIndicator": "CODU",
"getCreatedOn": {
"__CLASS__": "DateTimeImmutable",
diff --git a/test/data/camt052.v6.json b/test/data/camt052.v6.json
index 0879fe5..f80ef45 100644
--- a/test/data/camt052.v6.json
+++ b/test/data/camt052.v6.json
@@ -49,7 +49,24 @@
"getIdentification": "CH2801234000123456789"
},
"getAdditionalInformation": "Additional Information",
- "getBalances": [],
+ "getBalances": [
+ {
+ "__CLASS__": "Genkgo\\Camt\\DTO\\Balance",
+ "getAmount": {
+ "__CLASS__": "Money\\Money",
+ "getAmount": "1002215",
+ "getCurrency": {
+ "__CLASS__": "Money\\Currency",
+ "getCode": "CHF"
+ }
+ },
+ "getDate": {
+ "__CLASS__": "DateTimeImmutable",
+ "0": "2020-04-04T00:00:00+00:00"
+ },
+ "getType": "interim"
+ }
+ ],
"getCopyDuplicateIndicator": "CODU",
"getCreatedOn": {
"__CLASS__": "DateTimeImmutable",
diff --git a/test/data/camt052.v6.xml b/test/data/camt052.v6.xml
index fec4c9f..e133b92 100644
--- a/test/data/camt052.v6.xml
+++ b/test/data/camt052.v6.xml
@@ -64,7 +64,7 @@