Skip to content

Commit

Permalink
Downport 0.53.1 to x86 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
buchen committed Jun 16, 2021
2 parents c0d9bc6 + 48db0fb commit f1b9150
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PDF Autor: ''
PDFBox Version: 1.8.16
-----------------------------------------
TRADE REPUBLIC BANK GMBH KASTANIENALLEE 32 10435 BERLIN
Vor Nachname SEITE 1 von 1
Starßestr. 1 DATUM 26.05.2021
12345 PLZORT DEPOT 0122345678
DIVIDENDE
ÜBERSICHT
Dividende mit dem Ex-Tag 24.05.2021.
POSITION ANZAHL ERTRÄGNIS BETRAG
Fresenius SE & Co. KGaA 4,3521 Stk. 0,88 EUR 3,83 EUR
Inhaber-Aktien o.N.
ISIN: DE0005785604
GESAMT 3,83 EUR
ABRECHNUNG
POSITION BETRAG
Kapitalertragsteuer -0,95 EUR
Solidaritätszuschlag -0,05 EUR
GESAMT 2,83 EUR
BUCHUNG
VERRECHNUNGSKONTO VALUTA BETRAG
DE12345678901234567 27.05.2021 2,83 EUR
Fresenius SE & Co. KGaA Inhaber-Aktien o.N. in Girosammelverwahrung in Deutschland.
Diese Abrechnung wird maschinell erstellt und daher nicht unterschrieben.
Sofern keine Umsatzsteuer ausgewiesen ist, handelt es sich gem. § 4 Nr. 8 UStG um eine umsatzsteuerfreie
Leistung.
Trade Republic Bank GmbH www.traderepublic.com Sitz der Gesellschaft: Düsseldorf Geschäftsführer
Kastanienallee 32 [email protected] AG Düsseldorf HRB 85864 Andreas Willius
10435 Berlin USt-ID DE307510626 Karsten Müller
ABRE / 27.05.2021 / 55996703 / 0ad6-d1e5
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
PDF Autor: ''
PDFBox Version: 1.8.16
-----------------------------------------
TRADE REPUBLIC BANK GMBH KASTANIENALLEE 32 10435 BERLIN
MAX MUSTERMANN SEITE 1 von 1
MUSTERSTASSE Str. 88 DATUM 18.12.2020
D 88888 MUSTERSTADT DEPOT 888888888
DIVIDENDE
ÜBERSICHT
Dividende mit dem Ex-Tag 09.12.2020.
POSITION ANZAHL ERTRÄGNIS BETRAG
Stora Enso Oyj 25 Stk. 0,15 EUR 3,75 EUR
Reg. Shares Cl.R EO 1,70
ISIN: FI0009005961
GESAMT 3,75 EUR
ABRECHNUNG
POSITION BETRAG
Quellensteuer -1,13 EUR
Kapitalertragssteuer -0,37 EUR
Solidaritätszuschlag -0,02 EUR
Kirchensteuer -0,03 EUR
GESAMT 2,20 EUR
BUCHUNG
VERRECHNUNGSKONTO VALUTA BETRAG
DE000000000000000000000 2020-12-17 2,20 EUR
Stora Enso Oyj Reg. Shares Cl.R EO 1,70 in Girosammelverwahrung.
Diese Abrechnung wird maschinell erstellt und daher nicht unterschrieben.
Sofern keine Umsatzsteuer ausgewiesen ist, handelt es sich gem. § 4 Nr. 8 UStG um eine umsatzsteuerfreie
Leistung.
Trade Republic Bank GmbH www.traderepublic.com Sitz der Gesellschaft: Düsseldorf Geschäftsführer
Kastanienallee 32 [email protected] AG Düsseldorf HRB 85864 Andreas Willius
10435 Berlin USt-ID DE307510626 Karsten Müller
ABRE / f0e9-f5c0
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PDF Autor: ''
PDFBox Version: 1.8.16
-----------------------------------------
TRADE REPUBLIC BANK GMBH KASTANIENALLEE 32 10435 BERLIN
MAX MUSTERMANN SEITE 1 von 1
MUSTERSTASSE Str. 88 DATUM 18.12.2020
D 88888 MUSTERSTADT DEPOT 888888888
DIVIDENDE
ÜBERSICHT
Dividende mit dem Ex-Tag 01.04.2020.
POSITION ANZAHL ERTRÄGNIS BETRAG
UPM Kymmene Corp. 50 Stk. 1,300 EUR 65,00 EUR
Registered Shares o.N.
ISIN: FI0009005987
GESAMT 65,00 EUR
ABRECHNUNG
POSITION BETRAG
Quellensteuer -19,50 EUR
GESAMT 45,50 EUR
BUCHUNG
VERRECHNUNGSKONTO VALUTA BETRAG
DE000000000000000000000 16.04.2020 45,50 EUR
UPM Kymmene Corp. Registered Shares o.N. in Girosammelverwahrung.
Diese Abrechnung wird maschinell erstellt und daher nicht unterschrieben.
Sofern keine Umsatzsteuer ausgewiesen ist, handelt es sich gem. § 4 Nr. 8 UStG um eine umsatzsteuerfreie
Leistung.
Trade Republic Bank GmbH www.traderepublic.com Sitz der Gesellschaft: Düsseldorf Geschäftsführer
Kastanienallee 32 [email protected] AG Düsseldorf HRB 85864 Ingo Hillen
10435 Berlin USt-ID DE307510626 Karsten Müller
ABRE / 2020-04-15 / 89663937 / 3c5f-deb9
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,117 @@ public void testDividende08()
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(0.00))));
}

@Test
public void testDividende09()
{
TradeRepublicPDFExtractor extractor = new TradeRepublicPDFExtractor(new Client());

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

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

assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);

// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst()
.orElseThrow(IllegalArgumentException::new).getSecurity();
assertThat(security.getIsin(), is("DE0005785604"));
assertThat(security.getName(), is("Fresenius SE & Co. KGaA Inhaber-Aktien o.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));

// check dividends transaction
AccountTransaction transaction = (AccountTransaction) results.stream().filter(i -> i instanceof TransactionItem).findFirst()
.orElseThrow(IllegalArgumentException::new).getSubject();

assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2021-05-27T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(4.3521)));
assertThat(transaction.getMonetaryAmount(),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(2.83))));
assertThat(transaction.getGrossValue(),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(3.83))));
assertThat(transaction.getUnitSum(Unit.Type.TAX),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(0.95 + 0.05))));
assertThat(transaction.getUnitSum(Unit.Type.FEE),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(0.00))));
}

@Test
public void testDividende10()
{
TradeRepublicPDFExtractor extractor = new TradeRepublicPDFExtractor(new Client());

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

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

assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);

// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst()
.orElseThrow(IllegalArgumentException::new).getSecurity();
assertThat(security.getIsin(), is("FI0009005961"));
assertThat(security.getName(), is("Stora Enso Oyj Reg. Shares Cl.R EO 1,70"));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));

// check dividends transaction
AccountTransaction transaction = (AccountTransaction) results.stream().filter(i -> i instanceof TransactionItem).findFirst()
.orElseThrow(IllegalArgumentException::new).getSubject();

assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2020-12-17T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(25)));
assertThat(transaction.getMonetaryAmount(),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(2.20))));
assertThat(transaction.getGrossValue(),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(3.75))));
assertThat(transaction.getUnitSum(Unit.Type.TAX),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(1.13 + 0.37 + 0.02 + 0.03))));
assertThat(transaction.getUnitSum(Unit.Type.FEE),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(0.00))));
}

@Test
public void testDividende11()
{
TradeRepublicPDFExtractor extractor = new TradeRepublicPDFExtractor(new Client());

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

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

assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);

// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst()
.orElseThrow(IllegalArgumentException::new).getSecurity();
assertThat(security.getIsin(), is("FI0009005987"));
assertThat(security.getName(), is("UPM Kymmene Corp. Registered Shares o.N."));
assertThat(security.getCurrencyCode(), is(CurrencyUnit.EUR));

// check dividends transaction
AccountTransaction transaction = (AccountTransaction) results.stream().filter(i -> i instanceof TransactionItem).findFirst()
.orElseThrow(IllegalArgumentException::new).getSubject();

assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2020-04-16T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(50)));
assertThat(transaction.getMonetaryAmount(),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(45.50))));
assertThat(transaction.getGrossValue(),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(65.00))));
assertThat(transaction.getUnitSum(Unit.Type.TAX),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(19.50))));
assertThat(transaction.getUnitSum(Unit.Type.FEE),
is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(0.00))));
}

@Test
public void testVorabpauschale01()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ protected void layout(Composite composite, boolean flushCache)
}
else
{
// on Linux (and Linux only) the toolbar items are indented -
// typically 4 pixels on the left and 3 pixels on the right. We
// determine this by looking at the first item

if (index == 0 && itemBounds.x > 0)
width += (2 * itemBounds.x) - 1;

width += itemBounds.width;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,23 @@ private void addDividendeTransaction()
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
})

/***
* There might be two lines with "GESAMT"
* - one for gross
* - one for the net value
* we pick the second
*/

// GESAMT 3,83 EUR
// GESAMT 2,83 EUR
.section("amount", "currency").optional()
.match("^GESAMT [.,\\d]+ [\\w]{3}$")
.match("^GESAMT (?<amount>[.,\\d]+) (?<currency>[\\w]{3})$")
.assign((t, v) -> {
t.setAmount(asAmount(v.get("amount")));
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
})

// GESAMT 5,63 USD
// Zwischensumme 1,102 EUR/USD 5,11 EUR
// GESAMT 4,18 EUR
Expand Down

0 comments on commit f1b9150

Please sign in to comment.