Skip to content

Commit 3a86259

Browse files
shochmuthbuchen
authored andcommitted
Fix Postfinance TWINT crediting statement syntax
Fixed PostfinancePDFExtractor to also recognize "TWINT GELD EMPFANGEN VOM" syntax for crediting. Extended test cases to cover additional edge case.
1 parent ace4c97 commit 3a86259

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/postfinance/Kontoauszug01.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ TWINT KAUF/DIENSTLEISTUNG 25.00 10.04.18 7 050.00
7272
10.04.18 TWINT GELD EMPFANGEN 10.00 10.04.18 7 090.00
7373
10.04.18 TWINT GELD EMPFANGEN 15.00 10.04.18
7474
TWINT GELD EMPFANGEN 25.00 10.04.18 7 050.00
75+
11.04.18 TWINT GELD EMPFANGEN VOM 11.00 11.04.18 7 090.00
76+
11.04.18 TWINT GELD EMPFANGEN VOM 16.00 11.04.18
77+
TWINT GELD EMPFANGEN VOM 26.00 11.04.18 7 050.00
7578
20.04.18 GUTSCHRIFT V ON F REMDBANK 10 000.00 20.04.18 17 050.00
7679
20.04.18 GUTSCHRIFT V ON F REMDBANK 600.00 20.04.18
7780
GUTSCHRIFT V ON F REMDBANK 500.00 20.04.18 18 150.00

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/postfinance/PostfinancePDFExtractorTest.java

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,16 +1111,16 @@ public void testKontoauszug01()
11111111
assertThat(errors, empty());
11121112
assertThat(countSecurities(results), is(0L));
11131113
assertThat(countBuySell(results), is(0L));
1114-
assertThat(countAccountTransactions(results), is(73L));
1114+
assertThat(countAccountTransactions(results), is(76L));
11151115
assertThat(countAccountTransfers(results), is(0L));
11161116
assertThat(countItemsWithFailureMessage(results), is(0L));
1117-
assertThat(results.size(), is(73));
1117+
assertThat(results.size(), is(76));
11181118
new AssertImportActions().check(results, "CHF");
11191119

11201120
// check transaction
11211121
// get transactions
11221122
var iter = results.stream().filter(i -> i instanceof TransactionItem).iterator();
1123-
assertThat(results.stream().filter(i -> i instanceof TransactionItem).count(), is(73L));
1123+
assertThat(results.stream().filter(i -> i instanceof TransactionItem).count(), is(76L));
11241124

11251125
var item = iter.next();
11261126

@@ -1664,6 +1664,36 @@ public void testKontoauszug01()
16641664

16651665
item = iter.next();
16661666

1667+
// assert transaction
1668+
transaction = (AccountTransaction) item.getSubject();
1669+
assertThat(transaction.getType(), is(AccountTransaction.Type.DEPOSIT));
1670+
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2018-04-11T00:00")));
1671+
assertThat(transaction.getMonetaryAmount(), is(Money.of("CHF", Values.Amount.factorize(11.00))));
1672+
assertThat(transaction.getSource(), is("Kontoauszug01.txt"));
1673+
assertThat(transaction.getNote(), is("TWINT Geld empfangen"));
1674+
1675+
item = iter.next();
1676+
1677+
// assert transaction
1678+
transaction = (AccountTransaction) item.getSubject();
1679+
assertThat(transaction.getType(), is(AccountTransaction.Type.DEPOSIT));
1680+
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2018-04-11T00:00")));
1681+
assertThat(transaction.getMonetaryAmount(), is(Money.of("CHF", Values.Amount.factorize(16.00))));
1682+
assertThat(transaction.getSource(), is("Kontoauszug01.txt"));
1683+
assertThat(transaction.getNote(), is("TWINT Geld empfangen"));
1684+
1685+
item = iter.next();
1686+
1687+
// assert transaction
1688+
transaction = (AccountTransaction) item.getSubject();
1689+
assertThat(transaction.getType(), is(AccountTransaction.Type.DEPOSIT));
1690+
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2018-04-11T00:00")));
1691+
assertThat(transaction.getMonetaryAmount(), is(Money.of("CHF", Values.Amount.factorize(26.00))));
1692+
assertThat(transaction.getSource(), is("Kontoauszug01.txt"));
1693+
assertThat(transaction.getNote(), is("TWINT Geld empfangen"));
1694+
1695+
item = iter.next();
1696+
16671697
// assert transaction
16681698
transaction = (AccountTransaction) item.getSubject();
16691699
assertThat(transaction.getType(), is(AccountTransaction.Type.DEPOSIT));

name.abuchen.portfolio/src/name/abuchen/portfolio/datatransfer/pdf/PostfinancePDFExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ else if (note.contains("KAUF/DIENSTLEISTUNG"))
936936
.section("note", "amount", "date").optional() //
937937
.documentContext("currency") //
938938
.match("^([\\d]{2}\\.[\\d]{2}\\.[\\d]{2} )?" //
939-
+ "(?<note>(TWINT .*EMPFANGEN" //
939+
+ "(?<note>(TWINT .*EMPFANGEN( VOM)?" //
940940
+ "|GIRO (AUSLAND|AUS ONLINE-SIC [\\-\\d]+|AUS KONTO)" //
941941
+ "|GUTSCHRIFT VON FREMDBANK [\\-\\d]+" //
942942
+ "|GUTSCHRIFT( .*(BANK|PING))?" //

0 commit comments

Comments
 (0)