Skip to content

Commit

Permalink
Modify Trade Republic PDF-Importer to support new transaction (#4556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirus2000 authored Feb 27, 2025
1 parent d3d7cd3 commit a067e09
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3453,6 +3453,36 @@ public void testTransaccionesDeCuenta03()
hasSource("TransaccionesDeCuenta03.txt"), hasNote("WAYLET"))));
}

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

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

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

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

// assert transaction
assertThat(results, hasItem(withFailureMessage( //
Messages.MsgErrorTransactionAlternativeDocumentRequired, //
interest(hasDate("2024-11-01"), hasAmount("EUR", 124.66), //
hasSource("TransaccionesDeCuenta04.txt"), hasNote(null)))));

// assert transaction
assertThat(results, hasItem(withFailureMessage( //
Messages.MsgErrorTransactionAlternativeDocumentRequired, //
interest(hasDate("2024-12-02"), hasAmount("EUR", 113.59), //
hasSource("TransaccionesDeCuenta04.txt"), hasNote(null)))));

}

@Test
public void testAccountStatementSummary01()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
PDFBox Version: 3.0.3 != 1.8.17

Portfolio Performance Version: 0.74.1

System: macosx | aarch64 | 21.0.5+11-LTS | Azul Systems, Inc.

-----------------------------------------

TRADE REPUBLIC BANK GMBH BRUNNENSTRASSE 19-21 10119 BERLIN

kAtUa YYnAo OYHijp PÁGINA 1 de 10

tWgEFJ XqY de la MVpivK 936 - hx 5, 06203 FECHA 01 nov 2024 - 23 feb 2025

Barcelona, ES IBAN PX12345678901234567890

BIC CITIDEFF

RESUMEN DE ESTADO DE CUENTA

PRODUCTO BALANCE INICIAL ENTRADA DE DINERO SALIDA DE DINERO BALANCE FINAL

Cuenta de valores 43.873,16 € 19.977,34 € 18.130,55 € 45.719,95 €

TRANSACCIONES DE CUENTA

ENTRADA DE SALIDA DE

FECHA TIPO DESCRIPCIÓN BALANCE

DINERO DINERO

01 nov Pago de

Your interest payment 124,66 € 43.997,82 €

2024 intereses

04 nov Savings plan execution IE000716YHJ7 Invesco Markets II plc - Invesco FTSE All-World

Comercio 100,00 € 43.890,39 €

2024 UCITS ETF Acc, quantity: 16.064257

04 nov Savings plan execution IE000716YHJ7 Invesco Markets II plc - Invesco FTSE All-World

Comercio 2,57 € 43.887,82 €

2024 UCITS ETF Acc, quantity: 0.412851

04 nov

Comercio Buy trade US0378331005 APPLE INC., quantity: 0.0413 9,76 € 47.095,16 €

2024

Trade Republic Bank GmbH www.traderepublic.com Domicilio social de la empresa: Berlin Directores

Brunnenstraße 19-21 service@traderepublic.com AG Charlottenburg HRB 244347 B Andreas Torner

10119 Berlin ID-IVA DE307510626 Gernot Mittendorfer

Christian Hecker

Thomas Pischke

Creado en 24 feb 2025 Página 1 de 10

ENTRADA DE SALIDA DE

FECHA TIPO DESCRIPCIÓN BALANCE

DINERO DINERO

14 nov

Rendimientos Cash Dividend for ISIN US0378331005 0,07 € 41.350,28 €

2024

Trade Republic Bank GmbH www.traderepublic.com Domicilio social de la empresa: Berlin Directores

Brunnenstraße 19-21 service@traderepublic.com AG Charlottenburg HRB 244347 B Andreas Torner

10119 Berlin ID-IVA DE307510626 Gernot Mittendorfer

Christian Hecker

Thomas Pischke

Creado en 24 feb 2025 Página 2 de 3

ENTRADA DE SALIDA DE

FECHA TIPO DESCRIPCIÓN BALANCE

DINERO DINERO

02 dic Pago de

Your interest payment 113,59 € 46.911,01 €

2024 intereses

02 dic Savings plan execution IE000716YHJ7 Invesco Markets II plc - Invesco FTSE All-World

Comercio 15,00 € 46.911,01 €

2024 UCITS ETF Acc, quantity: 2.243158

02 dic Savings plan execution IE000716YHJ7 Invesco Markets II plc - Invesco FTSE All-World

Comercio 700,00 € 46.211,01 €

2024 UCITS ETF Acc, quantity: 104.680723

Trade Republic Bank GmbH www.traderepublic.com Domicilio social de la empresa: Berlin Directores

Brunnenstraße 19-21 service@traderepublic.com AG Charlottenburg HRB 244347 B Andreas Torner

10119 Berlin ID-IVA DE307510626 Gernot Mittendorfer

Christian Hecker

Thomas Pischke

DISCLAIMER

Estimado Cliente

Por favor, asegúrate de revisar las transacciones de tu cuenta, los cálculos y el saldo final en el extracto bancario, que también constituye tu liquidación

de cuentas. La liquidación de cuentas se considera aceptada si no presentas ninguna objeción en el plazo de seis semanas a partir de su recepción. La

liquidación de cuentas se considera aceptada si no presenta ninguna objeción en un plazo de seis semanas tras su recepción. Los saldos acreedores son

admisibles como depósitos de conformidad con la Ley alemana sobre el seguro de depósitos (Einlagensicherungsgesetz ? EinSiG). Encontrará más

información en la hoja informativa para el depositante, que puede consultar junto con nuestras Condiciones Generales.

Trade Republic Bank GmbH www.traderepublic.com Domicilio social de la empresa: Berlin Directores

Brunnenstraße 19-21 service@traderepublic.com AG Charlottenburg HRB 244347 B Andreas Torner

10119 Berlin ID-IVA DE307510626 Gernot Mittendorfer

Christian Hecker

Thomas Pischke

Creado en 24 feb 2025 Página 3 de 3
Original file line number Diff line number Diff line change
Expand Up @@ -2527,22 +2527,10 @@ private void addAccountStatementTransaction_Format02()
return null;
}));

// @formatter:off
// 01 Apr.
// 2024 Zinszahlung Your interest payment 147,34 € 50.152,41 €
//
// 01 may Pago de
// 2024 intereses Your interest payment 26,13 € 15.692,15 €
//
// 01 juil. Paiement
// 2024 d'intérêts Your interest payment 1,24 € 397,24 €
//
// 01 août Paiement
// 2024 d'intérêts Your interest payment 1,30 € 605,60 €
// @formatter:on

Block interestBlock_Format02 = new Block("^[\\d]{2} [\\p{L}]{3,4}([\\.]{1})?[\\s]((Pago|Paiement).*)?$");
type.addBlock(interestBlock_Format02);
interestBlock_Format02.setMaxSize(2);
interestBlock_Format02.setMaxSize(5);
interestBlock_Format02.set(new Transaction<AccountTransaction>()

.subject(() -> {
Expand All @@ -2552,10 +2540,41 @@ private void addAccountStatementTransaction_Format02()
})

.optionalOneOf( //
// @formatter:off
// 01 Apr.
// 2024 Zinszahlung Your interest payment 147,34 € 50.152,41 €
//
// 01 may Pago de
// 2024 intereses Your interest payment 26,13 € 15.692,15 €
//
// 01 juil. Paiement
// 2024 d'intérêts Your interest payment 1,24 € 397,24 €
//
// 01 août Paiement
// 2024 d'intérêts Your interest payment 1,30 € 605,60 €
// @formatter:on
section -> section //
.attributes("date", "year", "amount", "currency") //
.match("^(?<date>[\\d]{2} [\\p{L}]{3,4}([\\.]{1})?)[\\s]((Pago|Paiement).*)?$")
.match("^(?<year>[\\d]{4}) (Zinszahlung|intereses|d.int.r.ts) Your interest payment (?<amount>[\\.,\\d]+) (?<currency>\\p{Sc}) [\\.,\\d]+ \\p{Sc}$") //
.assign((t, v) -> {
t.setDateTime(asDate(v.get("date") + " " + v.get("year")));
t.setAmount(asAmount(v.get("amount")));
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
v.getTransactionContext().put(FAILURE, Messages.MsgErrorTransactionAlternativeDocumentRequired);
}),
// @formatter:off
// 01 nov Pago de
//
// Your interest payment 124,66 € 43.997,82 €
//
// 2024 intereses
// @formatter:on
section -> section //
.attributes("date", "amount", "currency", "year") //
.match("^(?<date>[\\d]{2} [\\p{L}]{3,4}([\\.]{1})?)[\\s]((Pago|Paiement).*)?$")
.match("^Your interest payment (?<amount>[\\.,\\d]+) (?<currency>\\p{Sc}) [\\.,\\d]+ \\p{Sc}$") //
.match("^(?<year>[\\d]{4}) (Zinszahlung|intereses|d.int.r.ts)$") //
.assign((t, v) -> {
t.setDateTime(asDate(v.get("date") + " " + v.get("year")));
t.setAmount(asAmount(v.get("amount")));
Expand Down

0 comments on commit a067e09

Please sign in to comment.