Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bondora PDF import #1819

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -113,4 +113,47 @@ public void testImportKontoauszug02() throws IOException

}

@Test
public void testImportKontoauszug03() throws IOException
{
BondoraGoAndGrowPDFExtractor extractor = new BondoraGoAndGrowPDFExtractor(new Client());

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

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

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

// check deposit
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
AccountTransaction transaction = (AccountTransaction) item.get().getSubject();
assertThat(transaction.getType(), is(AccountTransaction.Type.INTEREST));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2020-10-25T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 1_00L)));

// check interest
item = results.stream().filter(i -> i instanceof TransactionItem).skip(1).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
transaction = (AccountTransaction) item.get().getSubject();
assertThat(transaction.getType(), is(AccountTransaction.Type.INTEREST));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2020-10-26T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 1_01L)));

// check interest
item = results.stream().filter(i -> i instanceof TransactionItem).skip(2).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
transaction = (AccountTransaction) item.get().getSubject();
assertThat(transaction.getType(), is(AccountTransaction.Type.DEPOSIT));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2020-11-02T00:00")));
assertThat(transaction.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 300_00L)));

}

}
@@ -0,0 +1,15 @@
PDF Autor: ''
PDFBox Version: 1.8.16
-----------------------------------------
Zusammenfassung
Zu Beginn 5'629,99 €
Hans Musert
Einzahlungen 315,45 €
Datum 25.10.2020 - 08.11.2020 Auszahlungen 0 €
Referenznummer GGxxxxx Ergebnis 5'945,44 €
Muster Konto
Datum Zahlungsart Eingänge Ausgänge Guthaben
25.10.2020 Go & Grow Zinsen 1 € 5'630,99 €
26.10.2020 Go & Grow Zinsen 1,01 € 5'632 €
02.11.2020 Überweisen 300 € 5'938,05 €
Gesamt 5'945,44 €
Expand Up @@ -10,7 +10,7 @@
public class BondoraGoAndGrowPDFExtractor extends AbstractPDFExtractor
{
static String ACCOUNT_STATEMENT_DOCUMENT_TYPE = "Zusammenfassung"; //$NON-NLS-1$
static String ACCOUNT_STATEMENT_TRANSACTION_REGEX = "^(?<date>\\d{2}.\\d{2}.\\d{4})\\s(?<kind>[^€\\d]*)(\\D[€]\\D|\\D)(?<amount>[\\d.]+(,\\d+)*)(\\D*)([\\d.]+(,\\d+)*)(.{2})?$"; //$NON-NLS-1$
static String ACCOUNT_STATEMENT_TRANSACTION_REGEX = "^(?<date>\\d{2}.\\d{2}.\\d{4})\\s(?<kind>[^€\\d]*)(\\D[€]\\D|\\D)(?<amount>[\\d.']+(,\\d+)*)(\\D*)([\\d.']+(,\\d+)*)(.{2})?$"; //$NON-NLS-1$


static String BANK_IDENTIFIER = "Go & Grow";
Expand Down