-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
575 additions
and
0 deletions.
There are no files selected for viewing
190 changes: 190 additions & 0 deletions
190
....tests/src/name/abuchen/portfolio/datatransfer/pdf/avivaplc/AvivaPLCPDFExtractorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
package name.abuchen.portfolio.datatransfer.pdf.avivaplc; | ||
|
||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasAmount; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasCurrencyCode; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasDate; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasFees; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasGrossValue; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasIsin; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasName; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasNote; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasShares; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasSource; | ||
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.purchase; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.sale; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.security; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countAccountTransactions; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countBuySell; | ||
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countSecurities; | ||
import static org.hamcrest.CoreMatchers.hasItem; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.collection.IsEmptyCollection.empty; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.junit.Test; | ||
|
||
import name.abuchen.portfolio.datatransfer.Extractor.Item; | ||
import name.abuchen.portfolio.datatransfer.actions.AssertImportActions; | ||
import name.abuchen.portfolio.datatransfer.pdf.AvivaPLCPDFExtractor; | ||
import name.abuchen.portfolio.datatransfer.pdf.PDFInputFile; | ||
import name.abuchen.portfolio.model.Client; | ||
|
||
@SuppressWarnings("nls") | ||
public class AvivaPLCPDFExtractorTest | ||
{ | ||
@Test | ||
public void testWertpapierKauf01() | ||
{ | ||
AvivaPLCPDFExtractor extractor = new AvivaPLCPDFExtractor(new Client()); | ||
|
||
List<Exception> errors = new ArrayList<>(); | ||
|
||
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Kauf01.txt"), errors); | ||
|
||
assertThat(errors, empty()); | ||
assertThat(countSecurities(results), is(1L)); | ||
assertThat(countBuySell(results), is(1L)); | ||
assertThat(countAccountTransactions(results), is(0L)); | ||
assertThat(results.size(), is(2)); | ||
new AssertImportActions().check(results, "GBP"); | ||
|
||
// check security | ||
assertThat(results, hasItem(security( // | ||
hasIsin("GB00B5B74S01"), hasWkn("B5B74S0"), hasTicker("FPD4"), // | ||
hasName("Vanguard US Equity Index I£"), // | ||
hasCurrencyCode("GBP")))); | ||
|
||
// check buy sell transaction | ||
assertThat(results, hasItem(purchase( // | ||
hasDate("2023-11-02T21:00"), hasShares(1.5661), // | ||
hasSource("Kauf01.txt"), // | ||
hasNote("Order reference: ############"), // | ||
hasAmount("GBP", 999.99), hasGrossValue("GBP", 999.99), // | ||
hasTaxes("GBP", 0.00), hasFees("GBP", 0.00)))); | ||
} | ||
|
||
@Test | ||
public void testWertpapierKauf02() | ||
{ | ||
AvivaPLCPDFExtractor extractor = new AvivaPLCPDFExtractor(new Client()); | ||
|
||
List<Exception> errors = new ArrayList<>(); | ||
|
||
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Kauf02.txt"), errors); | ||
|
||
assertThat(errors, empty()); | ||
assertThat(countSecurities(results), is(2L)); | ||
assertThat(countBuySell(results), is(2L)); | ||
assertThat(countAccountTransactions(results), is(0L)); | ||
assertThat(results.size(), is(4)); | ||
new AssertImportActions().check(results, "GBP"); | ||
|
||
// check security | ||
assertThat(results, hasItem(security( // | ||
hasIsin("GB00B5B74S01"), hasWkn("B5B74S0"), hasTicker("FPD4"), // | ||
hasName("Vanguard US Equity Index I£"), // | ||
hasCurrencyCode("GBP")))); | ||
|
||
assertThat(results, hasItem(security( // | ||
hasIsin("GB00BMJJJF91"), hasWkn("BMJJJF9"), hasTicker("KLDQ"), // | ||
hasName("HSBC FTSE All World Index C"), // | ||
hasCurrencyCode("GBP")))); | ||
|
||
// check 1st buy sell transaction | ||
assertThat(results, hasItem(purchase( // | ||
hasDate("2023-08-30T21:00"), hasShares(1.5399), // | ||
hasSource("Kauf02.txt"), // | ||
hasNote("Order reference: ###########"), // | ||
hasAmount("GBP", 999.99), hasGrossValue("GBP", 999.99), // | ||
hasTaxes("GBP", 0.00), hasFees("GBP", 0.00)))); | ||
|
||
// check 2nd buy sell transaction | ||
assertThat(results, hasItem(purchase( // | ||
hasDate("2023-08-30T12:00"), hasShares(131.3900), // | ||
hasSource("Kauf02.txt"), // | ||
hasNote("Order reference: #########"), // | ||
hasAmount("GBP", 333.34), hasGrossValue("GBP", 333.34), // | ||
hasTaxes("GBP", 0.00), hasFees("GBP", 0.00)))); | ||
} | ||
|
||
@Test | ||
public void testWertpapierVerkauf01() | ||
{ | ||
AvivaPLCPDFExtractor extractor = new AvivaPLCPDFExtractor(new Client()); | ||
|
||
List<Exception> errors = new ArrayList<>(); | ||
|
||
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Verkauf01.txt"), errors); | ||
|
||
assertThat(errors, empty()); | ||
assertThat(countSecurities(results), is(1L)); | ||
assertThat(countBuySell(results), is(1L)); | ||
assertThat(countAccountTransactions(results), is(0L)); | ||
assertThat(results.size(), is(2)); | ||
new AssertImportActions().check(results, "GBP"); | ||
|
||
// check security | ||
assertThat(results, hasItem(security( // | ||
hasIsin(null), hasWkn(null), hasTicker(null), // | ||
hasName("Av MyM My Future Growth"), // | ||
hasCurrencyCode("GBP")))); | ||
|
||
// check buy sell transaction | ||
assertThat(results, hasItem(sale( // | ||
hasDate("2023-03-07T23:59"), hasShares(792.2496), // | ||
hasSource("Verkauf01.txt"), // | ||
hasNote("Order reference: #########"), // | ||
hasAmount("GBP", 1777.41), hasGrossValue("GBP", 1777.41), // | ||
hasTaxes("GBP", 0.00), hasFees("GBP", 0.00)))); | ||
} | ||
|
||
@Test | ||
public void testWertpapierVerkauf02() | ||
{ | ||
AvivaPLCPDFExtractor extractor = new AvivaPLCPDFExtractor(new Client()); | ||
|
||
List<Exception> errors = new ArrayList<>(); | ||
|
||
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Verkauf02.txt"), errors); | ||
|
||
assertThat(errors, empty()); | ||
assertThat(countSecurities(results), is(2L)); | ||
assertThat(countBuySell(results), is(2L)); | ||
assertThat(countAccountTransactions(results), is(0L)); | ||
assertThat(results.size(), is(4)); | ||
new AssertImportActions().check(results, "GBP"); | ||
|
||
// check security | ||
assertThat(results, hasItem(security( // | ||
hasIsin("GB00BMJJJF91"), hasWkn("BMJJJF9"), hasTicker("KLDQ"), // | ||
hasName("HSBC FTSE All World Index C"), // | ||
hasCurrencyCode("GBP")))); | ||
|
||
assertThat(results, hasItem(security( // | ||
hasIsin("GB00B5B71Q71"), hasWkn("B5B71Q7"), hasTicker("FPD3"), // | ||
hasName("Vanguard US Equity Index A£"), // | ||
hasCurrencyCode("GBP")))); | ||
|
||
// check 1st buy sell transaction | ||
assertThat(results, hasItem(purchase( // | ||
hasDate("2023-03-27T12:00"), hasShares(92.3400), // | ||
hasSource("Verkauf02.txt"), // | ||
hasNote("Order reference: ############"), // | ||
hasAmount("GBP", 218.75), hasGrossValue("GBP", 218.75), // | ||
hasTaxes("GBP", 0.00), hasFees("GBP", 0.00)))); | ||
|
||
// check 2nd buy sell transaction | ||
assertThat(results, hasItem(sale( // | ||
hasDate("2023-03-24T21:00"), hasShares(0.0071), // | ||
hasSource("Verkauf02.txt"), // | ||
hasNote("Order reference: ###########"), // | ||
hasAmount("GBP", 5.06), hasGrossValue("GBP", 5.06), // | ||
hasTaxes("GBP", 0.00), hasFees("GBP", 0.00)))); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/avivaplc/Kauf01.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
PDFBox Version: 1.8.16 | ||
----------------------------------------- | ||
Your scheme helpline | ||
Mr XXXX XXXXX 0345 604 9915 | ||
## my address, email and phone here - irrelevant ## | ||
Visit your scheme website | ||
aviva.co.uk/ | ||
myworkplace | ||
Dear ######## | ||
Aviva | ||
Scheme name - ############ | ||
Scheme number - ########## | ||
Account number - ########## | ||
Contract note | ||
Flexible Retirement Account | ||
We’ve completed some trades for you Log in to your account | ||
The tables below outline the details of trade(s) we’ve recently completed on | ||
your behalf for your Flexible Retirement Account. Please read this document o Keep your personal | ||
carefully and keep it in a safe place – you can also find it in your document details up to date | ||
library. | ||
o Check your account | ||
If any of the details are wrong, please let us know using the contact details value regularly | ||
above. o Use our handy tools to | ||
Got any questions? see if you’re on track | ||
If you’ve got any questions about any of this, email us or give us a call. We’re | ||
always happy to help. We’re open Monday to Friday, 8.00 am to 5.30 pm. We will | ||
record or monitor your calls. | ||
We look forward to continuing to help you prepare for your future. | ||
The Customer Team | ||
Page 1 of 2 | ||
You have PURCHASED | ||
Investment Name: Vanguard US Equity Index I£ | ||
Account number: ############ | ||
Order reference: ############ | ||
Execution date/time: 02 Nov 2023 21:00:00.000 | ||
Settlement date: 06/11/2023 | ||
Exchange: London Stock Exchange | ||
Order type: VALUE | ||
Number of units: 1.5661 | ||
Price: £638.5200 | ||
ISIN: GB00B5B74S01 | ||
SEDOL: B5B74S0 | ||
Citicode: FPD4.LN | ||
Total Consideration £999.99 | ||
Visit aviva.co.uk/myworkplace to keep track of your money | ||
Aviva Pension Trustees UK Limited. Registered in England No. 2407799. Registered office: Aviva, Wellington Row, York, YO90 1WR. Authorised and regulated by the Financial Conduct Authority. Firm Reference | ||
Number 465132 Aviva Life & Pensions UK Limited. Registered in England No. 3253947. Registered office: Aviva, Wellington Row, York, YO90 1WR. Authorised by the Prudential Regulation Authority and regulated | ||
by the Financial Conduct Authority and the Prudential Regulation Authority. Firm Reference Number 185896 Aviva Investment Solutions UK Limited. Registered in England No. 6389025. Registered office: Aviva, | ||
Wellington Row, York, YO90 1WR. Authorised and regulated by the Financial Conduct Authority. Firm Reference Number 515334. | ||
Page 2 of 2 |
65 changes: 65 additions & 0 deletions
65
name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/avivaplc/Kauf02.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
PDFBox Version: 1.8.16 | ||
----------------------------------------- | ||
Your scheme helpline | ||
Mr XXXX XXXXX 0345 604 9915 | ||
## my address, email and phone here - irrelevant ## | ||
Visit your scheme website | ||
aviva.co.uk/ | ||
myworkplace | ||
Dear ######## | ||
Aviva | ||
Scheme name - ############ | ||
Scheme number - ########## | ||
Account number - ########## | ||
Contract note | ||
Flexible Retirement Account | ||
We’ve completed some trades for you Log in to your account | ||
The tables below outline the details of trade(s) we’ve recently completed on | ||
your behalf for your Flexible Retirement Account. Please read this document o Keep your personal | ||
carefully and keep it in a safe place – you can also find it in your document details up to date | ||
library. | ||
o Check your account | ||
If any of the details are wrong, please let us know using the contact details value regularly | ||
above. o Use our handy tools to | ||
Got any questions? see if you’re on track | ||
If you’ve got any questions about any of this, email us or give us a call. We’re | ||
always happy to help. We’re open Monday to Friday, 8.00 am to 5.30 pm. We will | ||
record or monitor your calls. | ||
We look forward to continuing to help you prepare for your future. | ||
The Customer Team | ||
Page 1 of 2 | ||
You have PURCHASED | ||
Investment Name: Vanguard US Equity Index I£ | ||
Account number: ########### | ||
Order reference: ########### | ||
Execution date/time: 30 Aug 2023 21:00:00.000 | ||
Settlement date: 01/09/2023 | ||
Exchange: London Stock Exchange | ||
Order type: VALUE | ||
Number of units: 1.5399 | ||
Price: £649.4200 | ||
ISIN: GB00B5B74S01 | ||
SEDOL: B5B74S0 | ||
Citicode: FPD4.LN | ||
Total Consideration £999.99 | ||
You have PURCHASED | ||
Investment Name: HSBC FTSE All World Index C | ||
Acc ##<---------- this "Acc" here is the continuation of investment name - in any case all except ISIN can be ignored I guess## | ||
Account number: ######### | ||
Order reference: ######### | ||
Execution date/time: 30 Aug 2023 12:00:00.000 | ||
Settlement date: 04/09/2023 | ||
Exchange: London Stock Exchange | ||
Order type: VALUE | ||
Number of units: 131.3900 | ||
Price: £2.5370 | ||
ISIN: GB00BMJJJF91 | ||
SEDOL: BMJJJF9 | ||
Citicode: KLDQ.LN | ||
Total Consideration £333.34 | ||
Visit aviva.co.uk/myworkplace to keep track of your money | ||
Aviva Pension Trustees UK Limited. Registered in England No. 2407799. Registered office: Aviva, Wellington Row, York, YO90 1WR. Authorised and regulated by the Financial Conduct Authority. Firm Reference | ||
Number 465132 Aviva Life & Pensions UK Limited. Registered in England No. 3253947. Registered office: Aviva, Wellington Row, York, YO90 1WR. Authorised by the Prudential Regulation Authority and regulated | ||
by the Financial Conduct Authority and the Prudential Regulation Authority. Firm Reference Number 185896 Aviva Investment Solutions UK Limited. Registered in England No. 6389025. Registered office: Aviva, | ||
Wellington Row, York, YO90 1WR. Authorised and regulated by the Financial Conduct Authority. Firm Reference Number 515334. | ||
Page 2 of 2 |
45 changes: 45 additions & 0 deletions
45
...buchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/avivaplc/Verkauf01.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
PDFBox Version: 1.8.16 | ||
----------------------------------------- | ||
Your scheme helpline | ||
Mr XXXX XXXXX 0345 604 9915 | ||
## my address, email and phone here - irrelevant ## | ||
Visit your scheme website | ||
aviva.co.uk/ | ||
myworkplace | ||
Dear ######## | ||
Aviva | ||
Scheme name - ############ | ||
Scheme number - ########## | ||
Account number - ########## | ||
Contract note | ||
Flexible Retirement Account | ||
We’ve completed some trades for you Log in to your account | ||
The tables below outline the details of trade(s) we’ve recently completed on | ||
your behalf for your Flexible Retirement Account. Please read this document o Keep your personal | ||
carefully and keep it in a safe place – you can also find it in your document details up to date | ||
library. | ||
o Check your account | ||
If any of the details are wrong, please let us know using the contact details value regularly | ||
above. o Use our handy tools to | ||
Got any questions? see if you’re on track | ||
If you’ve got any questions about any of this, email us or give us a call. We’re | ||
always happy to help. We’re open Monday to Friday, 8.00 am to 5.30 pm. We will | ||
record or monitor your calls. | ||
We look forward to continuing to help you prepare for your future. | ||
The Customer Team | ||
Page 1 of 2 | ||
You have SOLD: | ||
Investment Name: Av MyM My Future Growth | ||
Account number: ######### | ||
Order reference: ######### | ||
Execution date: 07 Mar 2023 23:59:00.000 | ||
Settlement date: 09/03/2023 | ||
Number of units: 792.2496 | ||
Price £2.2435 | ||
Consideration: £1,777.41 | ||
Visit aviva.co.uk/myworkplace to keep track of your money | ||
Aviva Pension Trustees UK Limited. Registered in England No. 2407799. Registered office: Aviva, Wellington Row, York, YO90 1WR. Authorised and regulated by the Financial Conduct Authority. Firm Reference | ||
Number 465132 Aviva Life & Pensions UK Limited. Registered in England No. 3253947. Registered office: Aviva, Wellington Row, York, YO90 1WR. Authorised by the Prudential Regulation Authority and regulated | ||
by the Financial Conduct Authority and the Prudential Regulation Authority. Firm Reference Number 185896 Aviva Investment Solutions UK Limited. Registered in England No. 6389025. Registered office: Aviva, | ||
Wellington Row, York, YO90 1WR. Authorised and regulated by the Financial Conduct Authority. Firm Reference Number 515334. | ||
Page 2 of 2 |
Oops, something went wrong.