Skip to content

Commit

Permalink
Improve Trade Republic PDF-Importer (#4263)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirus2000 authored Oct 1, 2024
1 parent 7afc7c0 commit 43bc051
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2301,15 +2301,19 @@ public void testReleveDeCompte03()
assertThat(errors, empty());
assertThat(countSecurities(results), is(0L));
assertThat(countBuySell(results), is(0L));
assertThat(countAccountTransactions(results), is(4L));
assertThat(results.size(), is(4));
assertThat(countAccountTransactions(results), is(5L));
assertThat(results.size(), is(5));
new AssertImportActions().check(results, CurrencyUnit.EUR);


// assert transaction
assertThat(results, hasItem(deposit(hasDate("2023-10-12"), hasAmount("EUR", 100.00), //
hasSource("ReleveDeCompte03.txt"), hasNote(null))));

// assert transaction
assertThat(results, hasItem(deposit(hasDate("2023-10-16"), hasAmount("EUR", 25.57), //
hasSource("ReleveDeCompte03.txt"), hasNote("Remboursement de votre cadeau"))));

// assert transaction
assertThat(results, hasItem(withFailureMessage( //
Messages.MsgErrorTransactionAlternativeDocumentRequired, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1840,11 +1840,18 @@ private void addAccountStatementTransaction_Format02()
//
// 28 juil.
// 2024 Virement Apple Pay Top up 100,00 € 104,30 €
//
// 16 oct.
// 2023 Parrainage Remboursement de votre cadeau 25,57 € 111,58 €
// @formatter:on
section -> section //
.attributes("date", "year", "note", "amount", "currency", "amountAfter", "currencyAfter") //
.match("^(?<date>[\\d]{2} [\\p{L}]{3,4}([\\.]{1})?)[\\s](Transacci.n.*)?$") //
.match("^(?<year>[\\d]{4}) (Kartentransaktion|con tarjeta|Virement) (?<note>(?!(Einzahlung|Ingreso|Paiement)).*) (?<amount>[\\.,\\d]+) (?<currency>\\p{Sc}) (?<amountAfter>[\\.,\\d]+) (?<currencyAfter>\\p{Sc})$") //
.match("^(?<year>[\\d]{4}) " //
+ "(Kartentransaktion|con tarjeta|Virement|Parrainage) " //
+ "(?<note>(?!(Einzahlung|Ingreso|Paiement)).*) " //
+ "(?<amount>[\\.,\\d]+) (?<currency>\\p{Sc}) " //
+ "(?<amountAfter>[\\.,\\d]+) (?<currencyAfter>\\p{Sc})$") //
.assign((t, v) -> {
DocumentContext context = type.getCurrentContext();
Money amountAfter = Money.of(asCurrencyCode(v.get("currencyAfter")), asAmount(v.get("amountAfter")));
Expand Down

0 comments on commit 43bc051

Please sign in to comment.