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

Modify WIR PDF-Importer to support new transactions #3639

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
@@ -0,0 +1,36 @@
PDFBox Version: 1.8.17
Portfolio Performance Version: 0.65.5
-----------------------------------------
Terzo Pension Foundation of WIR Bank
Auberg 1
4002 Basel
E-Mail info@viac.ch
Phone 0800 80 40 40
www.viac.ch
Contract x.xxx.xxx.xxx
Portfolio x.xxx.xxx.xxx.xx
Mr
Max Muster
Musterstrasse 2
0000 Zürich
Basel, 01.11.2023
Commission
On 31.10.2023 we have debited your account:
Effective VIAC administration fee p.a. (calculated at portfolio level): 0.24%
Average pension assets: CHF xx'xxx.xx
Less 3a account balance (liquidity): CHF xxx.xx
Less exempt assets (fee cap): CHF x'xxx.xx
Less allowance: CHF 8'500.00 / 8'500.00
Effective calculation basis: Month October CHF xx'xxx.xx
Charged amount: Valuta 31.10.2023 CHF -5.45
S. E. & O.
Calculation: The effective VIAC administration fee is derived from the average pension assets less cash balance and taking into
account the fee cap of 0.40%. Any allowances are then additionally deducted from this amount. Basis for the calculation is the VIAC
administration fee of 0.52% p.a., which is charged on a maximum of 76.92% of invested assets. Investments above this level are
managed free of charge thanks to the fee cap.
Note: Whenever possible, our foundation bears the product costs (index funds). In the case of ETFs, product costs are charged
within the fund and accrue in favor of the fund provider. Product costs accrue in addition to the administration fee and amount to
0.00 % per year for the currently selected strategy. VIAC does not receive any kind of reimbursements (retrocessions).
Kind regards
Terzo Pension Foundation
Notice without signature
Expand Up @@ -17,6 +17,7 @@
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasTaxes;
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasTicker;
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasWkn;
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.interest;
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.purchase;
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.sale;
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.security;
Expand Down Expand Up @@ -1033,6 +1034,31 @@ public void testInterest04()
is(Money.of("CHF", Values.Amount.factorize(0.00))));
}

@Test
public void testInterest05()
{
WirBankPDFExtractor extractor = new WirBankPDFExtractor(new Client());

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

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

assertThat(errors, empty());
assertThat(countSecurities(results), is(0L));
assertThat(countBuySell(results), is(0L));
assertThat(countAccountTransactions(results), is(1L));
assertThat(results.size(), is(1));
new AssertImportActions().check(results, "CHF");

// check fee transaction
assertThat(results, hasItem(interest( //
hasDate("2023-10-31T00:00"), hasShares(0.00), //
hasSource("Zins05_English.txt"), //
hasNote("Interest rate: 0.90% | Interest period: October"), //
hasAmount("CHF", 0.30), hasGrossValue("CHF", 0.30), //
hasTaxes("CHF", 0.00), hasFees("CHF", 0.00))));
}

@Test
public void testFees01()
{
Expand Down Expand Up @@ -1125,11 +1151,36 @@ public void testFees03()
fee( //
hasDate("2023-07-31T00:00"), hasShares(0.00), //
hasSource("Gebuehren03_English.txt"), //
hasNote(null), //
hasNote("VIAC administration fee: 0.00%"), //
hasAmount("CHF", 0.00), hasGrossValue("CHF", 0.00), //
hasTaxes("CHF", 0.00), hasFees("CHF", 0.00)))));
}

@Test
public void testFees04()
{
WirBankPDFExtractor extractor = new WirBankPDFExtractor(new Client());

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

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

assertThat(errors, empty());
assertThat(countSecurities(results), is(0L));
assertThat(countBuySell(results), is(0L));
assertThat(countAccountTransactions(results), is(1L));
assertThat(results.size(), is(1));
new AssertImportActions().check(results, "CHF");

// check fee transaction
assertThat(results, hasItem(fee( //
hasDate("2023-10-31T00:00"), hasShares(0.00), //
hasSource("Gebuehren04_English.txt"), //
hasNote("VIAC administration fee: 0.24%"), //
hasAmount("CHF", 5.45), hasGrossValue("CHF", 5.45), //
hasTaxes("CHF", 0.00), hasFees("CHF", 0.00))));
}

@Test
public void testCreditNote01()
{
Expand Down
@@ -0,0 +1,26 @@
PDFBox Version: 1.8.17
Portfolio Performance Version: 0.65.5
-----------------------------------------
Terzo Pension Foundation of WIR Bank
Auberg 1
4002 Basel
E-Mail info@viac.ch
Phone 0800 80 40 40
www.viac.ch
Contract x.xxx.xxx.xxx
Portfolio x.xxx.xxx.xxx.xx
Mr
Max Muster
Musterstrasse 2
0000 Zürich
Basel, 01.11.2023
Interest
On 31.10.2023 we have credited you:
Interest rate: 0.90%
Interest period: October
Interest credit: CHF 0.30
Amount credited: CHF 0.30
S. E. & O.
Kind regards
Terzo Pension Foundation
Notice without signature
Expand Up @@ -204,7 +204,9 @@ private void addInterestTransaction()
// @formatter:on
.section("date", "amount", "currency") //
.find("(Zins|Interest|Int.r.ts)") //
.match("^(Am|On|Nous avons cr.dit. le) (?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}) (haben wir (Ihrem Konto|Ihnen) gutgeschrieben|we have credited your account|les int.r.ts suivants):$") //
.match("^(Am|On|Nous avons cr.dit. le) " //
+ "(?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}) " //
+ "(haben wir (Ihrem Konto|Ihnen) gutgeschrieben|we have credited (you|your account)|les int.r.ts suivants):$") //
.match("^(Zinsgutschrift|Interest credit|Int.r.ts cr.diteurs): (?<currency>[\\w]{3}) (?<amount>[\\.,'\\d]+)$") //
.assign((t, v) -> {
t.setDateTime(asDate(v.get("date")));
Expand Down Expand Up @@ -249,7 +251,9 @@ private void addFeeTransaction()
// @formatter:on
.section("date", "amount", "currency") //
.find("(Belastung|Commission)") //
.match("^(Verrechneter Betrag: Valuta|Charged amount: Value date|Montant d.bit.: Valuta) (?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}) (?<currency>[\\w]{3}) (\\-)?(?<amount>[\\.,'\\d]+)$")
.match("^(Verrechneter Betrag|Charged amount|Montant d.bit.): (Valuta|Value)( date)? " //
+ "(?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}) " //
+ "(?<currency>[\\w]{3}) (\\-)?(?<amount>[\\.,'\\d]+)$")
.assign((t, v) -> {
t.setDateTime(asDate(v.get("date")));
t.setAmount(asAmount(v.get("amount")));
Expand All @@ -259,9 +263,13 @@ private void addFeeTransaction()
// @formatter:off
// Effektive VIAC Verwaltungsgebühr: 0.123% p.a. CHF -1.11
// @formatter:on
.section("note").optional() //
.match("^(Effektive|Effective|Commission de gestion effective) (?<note>(VIAC Verwaltungsgeb.hr|VIAC administration fee|VIAC p\\.a\\.): [\\.,\\d]+%) .*$") //
.assign((t, v) -> t.setNote(trim(v.get("note"))))
.section("note1", "note2").optional() //
.match("^(Effektive|Effective|Commission de gestion effective) " //
+ "(?<note1>(VIAC Verwaltungsgeb.hr" //
+ "|VIAC administration fee" //
+ "|VIAC p\\.a\\.)).*" //
+ ": (?<note2>[\\.,\\d]+%).*$") //
.assign((t, v) -> t.setNote(v.get("note1") + ": " + v.get("note2")))

.wrap((t, ctx) -> {
TransactionItem item = new TransactionItem(t);
Expand Down