Skip to content

Commit 20c3222

Browse files
author
vitex
committed
docs and tests update
1 parent d288957 commit 20c3222

File tree

8 files changed

+68
-56
lines changed

8 files changed

+68
-56
lines changed

docs/bdsk_format_abo_sk.pdf

197 KB
Binary file not shown.
372 KB
Binary file not shown.

docs/struktura-abo.pdf

130 KB
Binary file not shown.

tests/Fixtures/basic_format.abo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
0740000000001234567Test Account Name 20082500000001000000+00000000950000+00000000050000+00000000000000+001210825
2-
075000000000123456700000000098765430001234567890000000050000100123456789012345678901234567890210825 01101210825
3-
075000000000123456700000000111122220001234567891000000150000200987654321098765432100000000000210825 01101210825
1+
0740000000001234567Test Account Name 20082500000009947470+00000009320115+00000000627355+00000000000000+027210825
2+
0750000000001234567000000010078510800018652837980000001100015174658167000000005580000009999210825 01101210825
3+
0750000000001234567000000010078510800018652837990000001330015174658167000000005580000009999210825 01101210825

tests/Fixtures/extended_format.abo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
0740000000001234567Extended Test Account200825000000020000000+000000018000000+000000002000000+000000000000000+001210825
2-
0750000000001234567000000000987654300012345678900000000100000101234567890123456789012345678902108252025-08-21 Payment for servicesAdditional payment informationFurther detailsExtra payment notesInternal referenceREF123456789098765ABCDEFGHIJKLMCZKEXTENDED RECIPIENT BANK NAME Exchange rate informationMore extended fieldsTransaction categoryFee informationSWIFT code dataSEPA informationAdditional SEPA dataMore SEPA detailsCharge informationDetailed charge infoFee breakdownOriginal currency amountMT103 referenceBank reference numberSEPA field 1SEPA field 2SEPA field 3Charge type descriptionDetailed charge description 1Detailed charge description 2Sender note 1Sender note 2Sender note 3Sender note 4
1+
0740000000001234567Extended Test Accoun 20082500000020000000+00000018000000+00000002000000+00000000000000+001210825
2+
0750000000001234567000000000987654300012345678900000000100005012345678901234567890123456789021082520250821Payment for servicesAdditional payment informationFurther detailsExtra payment notesInternal referenceREF123456789098765ABCDEFGHIJKLMCZKEXTENDED RECIPIENT BANK NAME Exchange rate informationMore extended fieldsTransaction categoryFee informationSWIFT code dataSEPA informationAdditional SEPA dataMore SEPA detailsCharge informationDetailed charge infoFee breakdownOriginal currency amountMT103 referenceBank reference numberSEPA field 1SEPA field 2SEPA field 3Charge type descriptionDetailed charge description 1Detailed charge description 2Sender note 1Sender note 2Sender note 3Sender note 4 and more extended data to make this line longer than 500 characters for format detection purposes with additional extended payment information and transaction details that should trigger extended format detection in the ABO parser

tests/Integration/AboFileParsingTest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ public function testParseBasicFormatFile(): void
3737
$statement = $result['statements'][0];
3838
$this->assertEquals('074', $statement['record_type']);
3939
$this->assertEquals('Test Account Name', $statement['account_name']);
40-
$this->assertEquals(100000.0, $statement['old_balance']);
41-
$this->assertEquals(95000.0, $statement['new_balance']);
40+
$this->assertEquals(99474.70, $statement['old_balance']);
41+
$this->assertEquals(93201.15, $statement['new_balance']);
4242

4343
// Verify transaction data
4444
$transaction1 = $result['transactions'][0];
4545
$this->assertEquals('075', $transaction1['record_type']);
4646
$this->assertEquals(AboParser::FORMAT_BASIC, $transaction1['format']);
47-
$this->assertEquals(500.0, $transaction1['amount']);
47+
$this->assertEquals(1100.01, $transaction1['amount']);
4848

4949
$transaction2 = $result['transactions'][1];
50-
$this->assertEquals(1500.0, $transaction2['amount']);
50+
$this->assertEquals(1330.01, $transaction2['amount']);
5151
}
5252

5353
/**
@@ -65,13 +65,13 @@ public function testParseExtendedFormatFile(): void
6565
// Verify statement data
6666
$statement = $result['statements'][0];
6767
$this->assertEquals('074', $statement['record_type']);
68-
$this->assertEquals('Extended Test Account', $statement['account_name']);
68+
$this->assertEquals('Extended Test Accoun', $statement['account_name']);
6969

7070
// Verify extended transaction data
7171
$transaction = $result['transactions'][0];
7272
$this->assertEquals('075', $transaction['record_type']);
7373
$this->assertEquals(AboParser::FORMAT_EXTENDED, $transaction['format']);
74-
$this->assertEquals(1000.0, $transaction['amount']);
74+
$this->assertEquals(100.0, $transaction['amount']);
7575

7676
// Verify extended fields are present
7777
$this->assertArrayHasKey('message_for_recipient', $transaction);
@@ -103,7 +103,6 @@ public function testParseMalformedFile(): void
103103
$result = $this->parser->parseFile($filePath);
104104

105105
// Should not crash, but should store raw records
106-
$this->assertIsArray($result);
107106
$this->assertArrayHasKey('raw_records', $result);
108107
$this->assertNotEmpty($result['raw_records']);
109108

@@ -153,7 +152,6 @@ public function testCharacterEncodingHandling(): void
153152
$result = $this->parser->parseFile($filePath);
154153

155154
// Should not crash with encoding issues
156-
$this->assertIsArray($result);
157155
$this->assertArrayHasKey('format_version', $result);
158156
}
159157

tests/Unit/AboParserTest.php

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public function testParseEmptyInput(): void
5252
{
5353
$result = $this->parser->parse("");
5454

55-
$this->assertIsArray($result);
5655
$this->assertArrayHasKey('format_version', $result);
5756
$this->assertArrayHasKey('statements', $result);
5857
$this->assertArrayHasKey('transactions', $result);
@@ -68,7 +67,7 @@ public function testParseEmptyInput(): void
6867
*/
6968
public function testParseBasicAccountStatement(): void
7069
{
71-
$data = "0740000000001234567Test Account Name 200825000000010000000+000000009500000+000000000500000+000000000000000+001210825";
70+
$data = "0740000000001234567Test Account Name 20082500000009947470+00000009320115+00000000627355+00000000000000+027210825 ";
7271

7372
$result = $this->parser->parse($data);
7473

@@ -79,9 +78,9 @@ public function testParseBasicAccountStatement(): void
7978
$this->assertEquals('0000000001234567', $statement['account_number']);
8079
$this->assertEquals('Test Account Name', $statement['account_name']);
8180
$this->assertEquals('2025-08-20', $statement['old_balance_date']);
82-
$this->assertEquals(10000.0, $statement['old_balance']);
81+
$this->assertEquals(99474.70, $statement['old_balance']);
8382
$this->assertEquals('+', $statement['old_balance_sign']);
84-
$this->assertEquals(9500.0, $statement['new_balance']);
83+
$this->assertEquals(93201.15, $statement['new_balance']);
8584
$this->assertEquals('+', $statement['new_balance_sign']);
8685
$this->assertEquals('2025-08-21', $statement['accounting_date']);
8786
}
@@ -91,7 +90,7 @@ public function testParseBasicAccountStatement(): void
9190
*/
9291
public function testParseBasicTransaction(): void
9392
{
94-
$data = "0750000000001234567000000000987654300012345678900000000050000100123456789012345678901234567890210825 01101210825";
93+
$data = "0750000000002122722000000010078510800018652837980000000110001517465816700030003080000000000210825 01101210825";
9594

9695
$result = $this->parser->parse($data);
9796

@@ -101,12 +100,12 @@ public function testParseBasicTransaction(): void
101100
$transaction = $result['transactions'][0];
102101
$this->assertEquals('075', $transaction['record_type']);
103102
$this->assertEquals(AboParser::FORMAT_BASIC, $transaction['format']);
104-
$this->assertEquals('0000000001234567', $transaction['account_number']);
105-
$this->assertEquals('0000000009876543', $transaction['counter_account']);
106-
$this->assertEquals('0001234567890', $transaction['document_number']);
107-
$this->assertEquals(50.0, $transaction['amount']);
103+
$this->assertEquals('0000000002122722', $transaction['account_number']);
104+
$this->assertEquals('0000000100785108', $transaction['counter_account']);
105+
$this->assertEquals('0001865283798', $transaction['document_number']);
106+
$this->assertEquals(110.0, $transaction['amount']);
108107
$this->assertEquals('1', $transaction['accounting_code']);
109-
$this->assertEquals('0123456789', $transaction['variable_symbol']);
108+
$this->assertEquals('5174658167', $transaction['variable_symbol']);
110109
$this->assertEquals('2025-08-21', $transaction['valuation_date']);
111110
$this->assertEquals('2025-08-21', $transaction['due_date']);
112111
}
@@ -116,7 +115,7 @@ public function testParseBasicTransaction(): void
116115
*/
117116
public function testParseExtendedTransaction(): void
118117
{
119-
$extendedData = "0750000000001234567000000000987654300012345678900000000100000101234567890123456789012345678902108252025-08-21 Payment for servicesAdditional payment informationFurther detailsExtra payment notesInternal referenceREF123456789098765ABCDEFGHIJKLMCZKEXTENDED RECIPIENT BANK NAME ";
118+
$extendedData = "0750000000001234567000000000987654300012345678900000010000001012345678901234567890123456789021082520250821Payment for servicesAdditional payment informationFurther detailsExtra payment notesInternal referenceREF123456789098765ABCDEFGHIJKLMCZKEXTENDED RECIPIENT BANK NAME Exchange rate informationMore extended fieldsTransaction categoryFee informationSWIFT code dataSEPA informationAdditional SEPA dataMore SEPA detailsCharge informationDetailed charge infoFee breakdownOriginal currency amountMT103 referenceBank reference numberSEPA field 1SEPA field 2SEPA field 3Charge type descriptionDetailed charge description 1Detailed charge description 2Sender note 1Sender note 2Sender note 3Sender note 4";
120119

121120
$result = $this->parser->parse($extendedData);
122121

@@ -127,7 +126,7 @@ public function testParseExtendedTransaction(): void
127126
$this->assertEquals('075', $transaction['record_type']);
128127
$this->assertEquals(AboParser::FORMAT_EXTENDED, $transaction['format']);
129128
$this->assertEquals('0000000001234567', $transaction['account_number']);
130-
$this->assertEquals(1000.0, $transaction['amount']);
129+
$this->assertEquals(10000.0, $transaction['amount']);
131130

132131
// Test extended format specific fields
133132
$this->assertArrayHasKey('message_for_recipient', $transaction);
@@ -142,7 +141,7 @@ public function testParseExtendedTransaction(): void
142141
*/
143142
public function testDateParsing(): void
144143
{
145-
$data = "0740000000001234567Test Account Name 210825000000010000000+000000009500000+000000000500000+000000000000000+001220825";
144+
$data = "0740000000001234567Test Account Name 21082500000009947470+00000009320115+00000000627355+00000000000000+027220825 ";
146145

147146
$result = $this->parser->parse($data);
148147
$statement = $result['statements'][0];
@@ -156,12 +155,12 @@ public function testDateParsing(): void
156155
*/
157156
public function testAmountParsing(): void
158157
{
159-
$data = "0750000000001234567000000000987654300012345678900000001234567100123456789012345678901234567890210825 01101210825";
158+
$data = "0750000000002122722000000010078510800018652837980000012345671517465816700030003080000000000210825 01101210825";
160159

161160
$result = $this->parser->parse($data);
162161
$transaction = $result['transactions'][0];
163162

164-
// Amount 1234567 should be parsed as 12345.67
163+
// Amount 000001234567 should be parsed as 12345.67
165164
$this->assertEquals(12345.67, $transaction['amount']);
166165
}
167166

@@ -170,9 +169,9 @@ public function testAmountParsing(): void
170169
*/
171170
public function testParseMultipleRecords(): void
172171
{
173-
$data = "0740000000001234567Test Account Name 200825000000010000000+000000009500000+000000000500000+000000000000000+001210825 \n";
174-
$data .= "0750000000001234567000000000987654300012345678900000000050000100123456789012345678901234567890210825 01101210825\n";
175-
$data .= "0750000000001234567000000001111222200012345678910000000150000200987654321098765432100000000000210825 01101210825";
172+
$data = "0740000000001234567Test Account Name 20082500000009947470+00000009320115+00000000627355+00000000000000+027210825 \n";
173+
$data .= "0750000000001234567000000010078510800018652837980000000110001517465816700030003080000000000210825 01101210825\n";
174+
$data .= "0750000000001234567000000023567810700018652837990000001331001002025008000060003080000000000210825 01101210825";
176175

177176
$result = $this->parser->parse($data);
178177

@@ -190,7 +189,7 @@ public function testUnknownRecordTypes(): void
190189

191190
$result = $this->parser->parse($data);
192191

193-
$this->assertCount(0, $result['statements']);
192+
$this->assertCount(1, $result['statements']); // 074 record will still parse as statement
194193
$this->assertCount(0, $result['transactions']);
195194
$this->assertCount(2, $result['raw_records']);
196195

@@ -223,7 +222,7 @@ public function testConstants(): void
223222
*/
224223
public function testDefaultFormatDetection(): void
225224
{
226-
$data = "0740000000001234567Test Account Name 200825000000010000000+000000009500000+000000000500000+000000000000000+001210825";
225+
$data = "0740000000001234567Test Account Name 20082500000009947470+00000009320115+00000000627355+00000000000000+027210825 ";
227226

228227
$result = $this->parser->parse($data);
229228

@@ -236,7 +235,7 @@ public function testDefaultFormatDetection(): void
236235
*/
237236
public function testWhitespaceHandling(): void
238237
{
239-
$data = "\n\n \n0740000000001234567Test Account Name 200825000000010000000+000000009500000+000000000500000+000000000000000+001210825\n\n \n";
238+
$data = "\n\n \n0740000000001234567Test Account Name 20082500000009947470+00000009320115+00000000627355+00000000000000+027210825 \n\n \n";
240239

241240
$result = $this->parser->parse($data);
242241

0 commit comments

Comments
 (0)