From 8194b6392395746e137f3bd93b952fe0951464af Mon Sep 17 00:00:00 2001 From: Alexander Ott Date: Sun, 8 Dec 2024 08:12:24 +0100 Subject: [PATCH] Add test case to ComDirect PDF-Importer https://forum.portfolio-performance.info/t/pdf-import-von-comdirect/1647/385 --- .../comdirect/ComdirectPDFExtractorTest.java | 71 +++++++++++++++++++ .../pdf/comdirect/Dividende32.txt | 50 +++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/comdirect/Dividende32.txt diff --git a/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/comdirect/ComdirectPDFExtractorTest.java b/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/comdirect/ComdirectPDFExtractorTest.java index f5d3f4f487..e90b8679dc 100644 --- a/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/comdirect/ComdirectPDFExtractorTest.java +++ b/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/comdirect/ComdirectPDFExtractorTest.java @@ -5344,6 +5344,77 @@ public void testDividende31WithSecurityInEUR() })))); } + @Test + public void testDividende32() + { + ComdirectPDFExtractor extractor = new ComdirectPDFExtractor(new Client()); + + List errors = new ArrayList<>(); + + List results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Dividende32.txt"), errors); + + assertThat(errors, empty()); + assertThat(countSecurities(results), is(1L)); + assertThat(countBuySell(results), is(0L)); + assertThat(countAccountTransactions(results), is(1L)); + assertThat(results.size(), is(2)); + new AssertImportActions().check(results, CurrencyUnit.EUR); + + // check security + assertThat(results, hasItem(security( // + hasIsin("US02079K3059"), hasWkn("A14Y6F"), hasTicker(null), // + hasName("A l p h a b et I n c . R e g . Sh s Cl . A D L -, 0 0 1"), // + hasCurrencyCode("USD")))); + + // check dividends transaction + assertThat(results, hasItem(dividend( // + hasDate("2024-06-19T00:00"), hasShares(80.000), // + hasSource("Dividende32.txt"), // + hasNote("Ref.-Nr.: 22IKZEBV1DJ004G8 | Quartalsdividende"), // + hasAmount("EUR", 14.90), hasGrossValue("EUR", 14.90), // + hasForexGrossValue("USD", 16.00), // + hasTaxes("EUR", 0.00), hasFees("EUR", 0.00)))); + } + + @Test + public void testDividende32WithSecurityInEUR() + { + Security security = new Security("A l p h a b et I n c . R e g . Sh s Cl . A D L -, 0 0 1", CurrencyUnit.EUR); + security.setIsin("US02079K3059"); + security.setWkn("A14Y6F"); + + Client client = new Client(); + client.addSecurity(security); + + ComdirectPDFExtractor extractor = new ComdirectPDFExtractor(client); + + List errors = new ArrayList<>(); + + List results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Dividende32.txt"), errors); + + assertThat(errors, empty()); + assertThat(countSecurities(results), is(0L)); + assertThat(countBuySell(results), is(0L)); + assertThat(countAccountTransactions(results), is(1L)); + assertThat(results.size(), is(1)); + new AssertImportActions().check(results, CurrencyUnit.EUR); + + // check dividends transaction + assertThat(results, hasItem(dividend( // + hasDate("2024-06-19T00:00"), hasShares(80.000), // + hasSource("Dividende32.txt"), // + hasNote("Ref.-Nr.: 22IKZEBV1DJ004G8 | Quartalsdividende"), // + hasAmount("EUR", 14.90), hasGrossValue("EUR", 14.90), // + hasTaxes("EUR", 0.00), hasFees("EUR", 0.00), // + check(tx -> { + CheckCurrenciesAction c = new CheckCurrenciesAction(); + Account account = new Account(); + account.setCurrencyCode(CurrencyUnit.EUR); + Status s = c.process((AccountTransaction) tx, account); + assertThat(s, is(Status.OK_STATUS)); + })))); + } + @Test public void testSteuerbehandlungVonEinloesung01() { diff --git a/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/comdirect/Dividende32.txt b/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/comdirect/Dividende32.txt new file mode 100644 index 0000000000..9a7f799681 --- /dev/null +++ b/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/comdirect/Dividende32.txt @@ -0,0 +1,50 @@ +PDFBox Version: 1.8.17 +Portfolio Performance Version: 0.69.1 +----------------------------------------- +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +25449 Quickborn + + + + + + + + + +Depotnr.: 136442118 +83457 431 BLZ: 051 658 95 +Herrn + +OeRNc kJMRkw hlHGYa + + + +quAQCn iKaCQtEiK 56 + +05476 fGNmhqeFn +17.06.2024 +USt-ID-Nr.: bZ511936771 +Rechnungsnummer: 645742171996DD52 +G u t s c h ri f t fä ll ig e r W e r t p a p i e r -E r tr ä g e +Dividendengutschrift +Depotbestand Wertpapier-Bezeichnung WKN/ISIN + pe r 07 . 0 6. 20 2 4 A l p h a b et I n c . A1 4 Y6 F +S TK 80 , 0 00 R e g . Sh s Cl . A D L -, 0 0 1 U S 0 20 7 9K 3 0 5 9 + Emissionsland: VEREINIGTE STAATEN +USD 0,20 Dividende pro Stück für Geschäftsjahr 01.01.24 bis 31.12.24 +zahlbar ab 17.06.2024 Quartalsdividende + Abrechnung Dividendengutschrift +Bruttobetrag: USD 16,00 +30,000 % Quellensteuer USD 4,80 - +Ausmachender Betrag USD 11,20 + zum Devisenkurs: EUR/USD 1,074100 EUR 10,43 +Verrechnung über Konto (IBAN) Valuta Zu Ihren Gunsten vor Steuern +DE92 2004 1133 0552 4095 00 EUR 19.06.2024 EUR 10,43 +Information zur steuerlichen Behandlung dieses Geschäftsvorganges und den auf +Ihrem Konto gebuchten Endbetrag finden Sie auf der separaten Steuermitteilung +(Referenz-Nr. 22IKZEBV1DJ004G8). +Ihre comdirect + +*Diese Abrechnung wird von der Bank nicht unterschrieben +DD762/11/09 \ No newline at end of file