Skip to content

Commit

Permalink
Add Sunrise PDF-Importer to import assistant
Browse files Browse the repository at this point in the history
Issue: #3731
  • Loading branch information
Nirus2000 committed Mar 22, 2024
1 parent f8253a7 commit 3c36388
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public PDFImportAssistant(Client client, List<File> files)
extractors.add(new SimpelPDFExtractor(client));
extractors.add(new SolarisbankAGPDFExtractor(client));
extractors.add(new StakeshopPtyLtdPDFExtractor(client));
extractors.add(new SunrisePDFExtractor(client));
extractors.add(new SuresseDirektBankPDFExtractor(client));
extractors.add(new SwissquotePDFExtractor(client));
extractors.add(new TargobankPDFExtractor(client));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import name.abuchen.portfolio.money.CurrencyUnit;
import name.abuchen.portfolio.money.Values;

@SuppressWarnings("nls")
public class SunrisePDFExtractor extends AbstractPDFExtractor
{

Expand Down Expand Up @@ -119,8 +120,9 @@ private void addDividendeTransaction()

// Fondsname: Standortfonds Österreich
// WKN/ISIN: AT0000A1QA38 Datum des Ertrags: 15.12.2023
.section("name", "isin").match("^Fondsname: (?<name>.*)$")//
.match("^WKN\\/ISIN: (?<isin>[\\w]{12}) Datum des.*$")
.section("name", "isin") //
.match("^Fondsname: (?<name>.*)$") //
.match("^WKN\\/ISIN: (?<isin>[\\w]{12}) Datum des.*$") //
.assign((t, v) -> {
v.put("currency", CurrencyUnit.EUR);
t.setSecurity(getOrCreateSecurity(v));
Expand All @@ -132,9 +134,10 @@ private void addDividendeTransaction()

// Ausschüttung je Anteil: 2.71
// Ausschüttung gesamt: 17.58
.section("amountPerShare", "gross")
.match("^Aussch.ttung je Anteil: (?<amountPerShare>['\\.\\d]+)$")
.match("^Aussch.ttung gesamt: (?<gross>['\\.\\d]+)$").assign((t, v) -> {
.section("amountPerShare", "gross") //
.match("^Aussch.ttung je Anteil: (?<amountPerShare>['\\.\\d]+)$") //
.match("^Aussch.ttung gesamt: (?<gross>['\\.\\d]+)$") //
.assign((t, v) -> {
BigDecimal amountPerShare = asExchangeRate(v.get("amountPerShare"));
BigDecimal amountTotal = asExchangeRate(v.get("gross"));

Expand All @@ -146,20 +149,21 @@ private void addDividendeTransaction()
})

// WKN/ISIN: AT0000A1QA38 Datum des Ertrags: 15.12.2023
.section("date")
.match("^WKN.*Datum des Ertrags: (?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4})$")
.section("date") //
.match("^WKN.*Datum des Ertrags: (?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4})$") //
.assign((t, v) -> t.setDateTime(asDate(v.get("date"))))

// Zur Auszahlung kommender Betrag: 0.00
.section("amount")
.match("^ Zur Auszahlung kommender Betrag: (?<amount>['\\.\\d]+)$")
.section("amount") //
.match("^ Zur Auszahlung kommender Betrag: (?<amount>['\\.\\d]+)$") //
.assign((t, v) -> {
t.setAmount(asAmount(v.get("amount")));
t.setCurrencyCode(asCurrencyCode(CurrencyUnit.EUR));
})

// WKN / ISIN: AT0000A1Z882 Turnus: jährlich
.section("note").optional().match("^.* (?<note>Turnus: .*)$")
.section("note").optional() //
.match("^.* (?<note>Turnus: .*)$") //
.assign((t, v) -> t.setNote(trim(v.get("note"))))

.wrap(TransactionItem::new);
Expand All @@ -173,12 +177,13 @@ private <T extends Transaction<?>> void addTaxesSectionsTransaction(T transactio
{
transaction
// abgeführte Kapitalertragsteuer: 31.61 €
.section("tax").optional()
.match("^abgef.hrte Kapitalertragsteuer: (?<tax>['\\.\\d]+) \\p{Sc}$")
.section("tax").optional() //
.match("^abgef.hrte Kapitalertragsteuer: (?<tax>['\\.\\d]+) \\p{Sc}$") //
.assign((t, v) -> processTaxEntries(t, v, type))

// Kapitalertragsteuer (KESt) gesamt: 4.28
.section("tax").optional().match("^Kapitalertragsteuer \\(KESt\\) gesamt: (?<tax>['\\.\\d]+)$")
.section("tax").optional() //
.match("^Kapitalertragsteuer \\(KESt\\) gesamt: (?<tax>['\\.\\d]+)$") //
.assign((t, v) -> processTaxEntries(t, v, type));
}

Expand Down

0 comments on commit 3c36388

Please sign in to comment.