Skip to content

Commit

Permalink
Modify Hypothekarbank Lenzburg AG PDF-Importer to support new transac…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirus2000 committed Apr 9, 2024
1 parent 6fac05e commit 51359ee
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 2 deletions.
Expand Up @@ -56,7 +56,7 @@ public void testWertpapierKauf01()
// check security
assertThat(results, hasItem(security( //
hasIsin("IE000716YHJ7"), hasWkn("125615212"), hasTicker(null), //
hasName("Accum Shs USD Inve FTSE All"), //
hasName("Inve FTSE All"), //
hasCurrencyCode("CHF"))));

// check buy sell transaction
Expand All @@ -67,4 +67,66 @@ public void testWertpapierKauf01()
hasAmount("CHF", 3974.14), hasGrossValue("CHF", 3948.48), //
hasTaxes("CHF", 5.92), hasFees("CHF", 19.74))));
}

@Test
public void testWertpapierKauf02()
{
HypothekarbankLenzburgAGPDFExtractor extractor = new HypothekarbankLenzburgAGPDFExtractor(new Client());

List<Exception> errors = new ArrayList<>();

List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Kauf02.txt"), errors);

assertThat(errors, empty());
assertThat(countSecurities(results), is(1L));
assertThat(countBuySell(results), is(1L));
assertThat(countAccountTransactions(results), is(0L));
assertThat(results.size(), is(2));
new AssertImportActions().check(results, "CHF");

// check security
assertThat(results, hasItem(security( //
hasIsin("IE000716YHJ7"), hasWkn("125615212"), hasTicker(null), //
hasName("Inve FTSE All"), //
hasCurrencyCode("CHF"))));

// check buy sell transaction
assertThat(results, hasItem(purchase( //
hasDate("2024-04-04T00:00"), hasShares(44), //
hasSource("Kauf02.txt"), //
hasNote("Transaktion 62108127-0002"), //
hasAmount("CHF", 251.86), hasGrossValue("CHF", 250.23), //
hasTaxes("CHF", 0.38), hasFees("CHF", 1.25))));
}

@Test
public void testWertpapierKauf03()
{
HypothekarbankLenzburgAGPDFExtractor extractor = new HypothekarbankLenzburgAGPDFExtractor(new Client());

List<Exception> errors = new ArrayList<>();

List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Kauf03.txt"), errors);

assertThat(errors, empty());
assertThat(countSecurities(results), is(1L));
assertThat(countBuySell(results), is(1L));
assertThat(countAccountTransactions(results), is(0L));
assertThat(results.size(), is(2));
new AssertImportActions().check(results, "CHF");

// check security
assertThat(results, hasItem(security( //
hasIsin("IE00BKS7L097"), hasWkn("51992937"), hasTicker(null), //
hasName("Inv S&P 500 ESG"), //
hasCurrencyCode("CHF"))));

// check buy sell transaction
assertThat(results, hasItem(purchase( //
hasDate("2024-04-04T00:00"), hasShares(4), //
hasSource("Kauf03.txt"), //
hasNote("Transaktion 62108136-0002"), //
hasAmount("CHF", 260.10), hasGrossValue("CHF", 258.42), //
hasTaxes("CHF", 0.39), hasFees("CHF", 1.29))));
}
}
@@ -0,0 +1,30 @@
PDFBox Version: 1.8.17
Portfolio Performance Version: 0.68.3
-----------------------------------------
Hypothekarbank Lenzburg AG
Bahnhofstrasse 2 | 5600 Lenzburg 1
Telefon +41 62 885 11 11 | info@hbl.ch | www.hbl.ch
BC 8307 | HYPLCH22 | CHE-105.779.532 MWST
Herr
Max Mustermann
Musterstrasse 3
1234 Musterhausen
Ihr Betreuerteam: Service Center / Tel. +41 43 508 03 76
Lenzburg, 04.04.2024 Seite 1 von 1
Börse / Kauf Portfolio 582.267.706
Transaktion 62108127-0002
Wir haben am 04.04.2024 an der BX Swiss für Sie gekauft
44 Accum Shs USD Inve FTSE All Depotstelle 3500
Valor: 125615212 / IE000716YHJ7
Menge 44 Kurs CHF 5.687 CHF 250.23
Eidg. Umsatzabgabe CHF 0.38
Eigene Kommission (NEON) CHF 1.25
Belastung 582.267.307 Valuta 08.04.2024 CHF 251.86
Neon Konto - neon
Die Titel buchen wir in Ihr Portfolio ein.
Dieser Auftrag erfolgte ohne Beratung durch die Bank.
Sofern für das gehandelte Finanzinstrument ein BIB vorhanden ist, wird Ihnen dieses auf unserer Internetseite unter
https://www.hbl.ch/de/private/anlegen/basisinformationsblatt/ zur Verfügung gestellt.
Freundliche Grüsse
Hypothekarbank Lenzburg AG
Anzeige ohne Unterschrift
@@ -0,0 +1,30 @@
PDFBox Version: 1.8.17
Portfolio Performance Version: 0.68.3
-----------------------------------------
Hypothekarbank Lenzburg AG
Bahnhofstrasse 2 | 5600 Lenzburg 1
Telefon +41 62 885 11 11 | info@hbl.ch | www.hbl.ch
BC 8307 | HYPLCH22 | CHE-105.779.532 MWST
Herr
Max Mustermann
Musterstr. 3
1234 Musterhausen
Ihr Betreuerteam: Service Center / Tel. +41 43 508 03 76
Lenzburg, 04.04.2024 Seite 1 von 1
Börse / Kauf Portfolio 582.267.706
Transaktion 62108136-0002
Wir haben am 04.04.2024 an der BX Swiss für Sie gekauft
4 Accum Shs USD Inv S&P 500 ESG Depotstelle 3500
Valor: 51992937 / IE00BKS7L097
Menge 4 Kurs CHF 64.605 CHF 258.42
Eidg. Umsatzabgabe CHF 0.39
Eigene Kommission (NEON) CHF 1.29
Belastung 582.267.307 Valuta 08.04.2024 CHF 260.10
Neon Konto - neon
Die Titel buchen wir in Ihr Portfolio ein.
Dieser Auftrag erfolgte ohne Beratung durch die Bank.
Sofern für das gehandelte Finanzinstrument ein BIB vorhanden ist, wird Ihnen dieses auf unserer Internetseite unter
https://www.hbl.ch/de/private/anlegen/basisinformationsblatt/ zur Verfügung gestellt.
Freundliche Grüsse
Hypothekarbank Lenzburg AG
Anzeige ohne Unterschrift
Expand Up @@ -66,7 +66,7 @@ private void addBuySellTransaction()
// @formatter:on
.section("name", "wkn", "isin", "currency") //
.find("Wir haben am .* f.r Sie gekauft") //)
.match("^.*[\\,'\\d]+ (?<name>.*) Depotstelle .*$") //
.match("^.*[\\,'\\d]+ .* [A-Z]{3} (?<name>.*) Depotstelle .*$") //
.match("^Valor: (?<wkn>[A-Z0-9]{5,9}) \\/ (?<isin>[A-Z]{2}[A-Z0-9]{9}[0-9])$")
.match("^Menge[\\s]{1,}[\\.'\\d]+ Kurs (?<currency>[\\w]{3})[\\s]{1,}[\\.'\\d]+[\\s]{1,}[\\w]{3}[\\s]{1,}[\\.'\\d]+$") //
.assign((t, v) -> t.setSecurity(getOrCreateSecurity(v)))
Expand Down

0 comments on commit 51359ee

Please sign in to comment.