Search in sources :

Example 6 with BankSLMPDFExtractor

use of name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor in project portfolio by buchen.

the class BankSLMPDFExtractorTest method testKauf_Inland1.

@Test
public void testKauf_Inland1() throws IOException {
    BankSLMPDFExtractor extractor = new BankSLMPDFExtractor(new Client());
    List<Exception> errors = new ArrayList<>();
    List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "BankSLM_Kauf_Inland1.txt"), errors);
    assertThat(errors, empty());
    assertThat(results.size(), is(2));
    new AssertImportActions().check(results, "CHF");
    // check security
    Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
    assertThat(security.getWkn(), is("135186"));
    assertThat(security.getName(), is("Bank SLM AG"));
    // check buy sell transaction
    Optional<Item> item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
    assertThat(item.isPresent(), is(true));
    assertThat(item.get().getSubject(), instanceOf(BuySellEntry.class));
    BuySellEntry entry = (BuySellEntry) item.get().getSubject();
    assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY));
    assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.BUY));
    assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of("CHF", Values.Amount.factorize(1481.10))));
    assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2016-06-21T00:00")));
    assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(1)));
    assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of("CHF", 1_10L)));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) PortfolioTransaction(name.abuchen.portfolio.model.PortfolioTransaction) Money(name.abuchen.portfolio.money.Money) Values(name.abuchen.portfolio.money.Values) Client(name.abuchen.portfolio.model.Client) Item(name.abuchen.portfolio.datatransfer.Extractor.Item) LocalDateTime(java.time.LocalDateTime) BankSLMPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor) IsEmptyCollection.empty(org.hamcrest.collection.IsEmptyCollection.empty) SecurityItem(name.abuchen.portfolio.datatransfer.Extractor.SecurityItem) ArrayList(java.util.ArrayList) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) Assert.assertThat(org.junit.Assert.assertThat) TransactionItem(name.abuchen.portfolio.datatransfer.Extractor.TransactionItem) BuySellEntry(name.abuchen.portfolio.model.BuySellEntry) BuySellEntryItem(name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem) PDFInputFile(name.abuchen.portfolio.datatransfer.pdf.PDFInputFile) AccountTransaction(name.abuchen.portfolio.model.AccountTransaction) IOException(java.io.IOException) Test(org.junit.Test) Security(name.abuchen.portfolio.model.Security) List(java.util.List) AssertImportActions(name.abuchen.portfolio.datatransfer.actions.AssertImportActions) Unit(name.abuchen.portfolio.model.Transaction.Unit) Optional(java.util.Optional) SecurityItem(name.abuchen.portfolio.datatransfer.Extractor.SecurityItem) BuySellEntry(name.abuchen.portfolio.model.BuySellEntry) ArrayList(java.util.ArrayList) Security(name.abuchen.portfolio.model.Security) IOException(java.io.IOException) AssertImportActions(name.abuchen.portfolio.datatransfer.actions.AssertImportActions) BankSLMPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor) Item(name.abuchen.portfolio.datatransfer.Extractor.Item) SecurityItem(name.abuchen.portfolio.datatransfer.Extractor.SecurityItem) TransactionItem(name.abuchen.portfolio.datatransfer.Extractor.TransactionItem) BuySellEntryItem(name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem) BuySellEntryItem(name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Example 7 with BankSLMPDFExtractor

use of name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor in project portfolio by buchen.

the class BankSLMPDFExtractorTest method testKauf_Inland2.

@Test
public void testKauf_Inland2() throws IOException {
    BankSLMPDFExtractor extractor = new BankSLMPDFExtractor(new Client());
    List<Exception> errors = new ArrayList<>();
    List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "BankSLM_Kauf_Inland2.txt"), errors);
    assertThat(errors, empty());
    assertThat(results.size(), is(2));
    new AssertImportActions().check(results, "CHF");
    // check security
    Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
    assertThat(security.getWkn(), is("24476758"));
    assertThat(security.getName(), is("UBS Group AG"));
    // check buy sell transaction
    Optional<Item> item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
    assertThat(item.isPresent(), is(true));
    assertThat(item.get().getSubject(), instanceOf(BuySellEntry.class));
    BuySellEntry entry = (BuySellEntry) item.get().getSubject();
    assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY));
    assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.BUY));
    assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of("CHF", Values.Amount.factorize(43412.10))));
    assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2016-02-10T00:00")));
    assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(3000)));
    assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of("CHF", 32_40L + 3_50 + 176_20)));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) PortfolioTransaction(name.abuchen.portfolio.model.PortfolioTransaction) Money(name.abuchen.portfolio.money.Money) Values(name.abuchen.portfolio.money.Values) Client(name.abuchen.portfolio.model.Client) Item(name.abuchen.portfolio.datatransfer.Extractor.Item) LocalDateTime(java.time.LocalDateTime) BankSLMPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor) IsEmptyCollection.empty(org.hamcrest.collection.IsEmptyCollection.empty) SecurityItem(name.abuchen.portfolio.datatransfer.Extractor.SecurityItem) ArrayList(java.util.ArrayList) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) Assert.assertThat(org.junit.Assert.assertThat) TransactionItem(name.abuchen.portfolio.datatransfer.Extractor.TransactionItem) BuySellEntry(name.abuchen.portfolio.model.BuySellEntry) BuySellEntryItem(name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem) PDFInputFile(name.abuchen.portfolio.datatransfer.pdf.PDFInputFile) AccountTransaction(name.abuchen.portfolio.model.AccountTransaction) IOException(java.io.IOException) Test(org.junit.Test) Security(name.abuchen.portfolio.model.Security) List(java.util.List) AssertImportActions(name.abuchen.portfolio.datatransfer.actions.AssertImportActions) Unit(name.abuchen.portfolio.model.Transaction.Unit) Optional(java.util.Optional) SecurityItem(name.abuchen.portfolio.datatransfer.Extractor.SecurityItem) BuySellEntry(name.abuchen.portfolio.model.BuySellEntry) ArrayList(java.util.ArrayList) Security(name.abuchen.portfolio.model.Security) IOException(java.io.IOException) AssertImportActions(name.abuchen.portfolio.datatransfer.actions.AssertImportActions) BankSLMPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor) Item(name.abuchen.portfolio.datatransfer.Extractor.Item) SecurityItem(name.abuchen.portfolio.datatransfer.Extractor.SecurityItem) TransactionItem(name.abuchen.portfolio.datatransfer.Extractor.TransactionItem) BuySellEntryItem(name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem) BuySellEntryItem(name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Example 8 with BankSLMPDFExtractor

use of name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor in project portfolio by buchen.

the class ImportExtractedItemsWizard method addDefaultExtractors.

private void addDefaultExtractors() throws IOException {
    extractors.add(new BaaderBankPDFExtractor(client));
    extractors.add(new BankSLMPDFExtractor(client));
    extractors.add(new ComdirectPDFExtractor(client));
    extractors.add(new CommerzbankPDFExtractor(client));
    extractors.add(new ConsorsbankPDFExtractor(client));
    extractors.add(new DABPDFExtractor(client));
    extractors.add(new DegiroPDFExtractor(client));
    extractors.add(new DeutscheBankPDFExtractor(client));
    extractors.add(new DkbPDFExtractor(client));
    extractors.add(new FinTechGroupBankPDFExtractor(client));
    extractors.add(new INGDiBaExtractor(client));
    extractors.add(new OnvistaPDFExtractor(client));
    extractors.add(new SBrokerPDFExtractor(client));
    extractors.add(new UnicreditPDFExtractor(client));
    extractors.add(new HelloBankPDFExtractor(client));
    Collections.sort(extractors, (r, l) -> r.getLabel().compareToIgnoreCase(l.getLabel()));
}
Also used : ConsorsbankPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.ConsorsbankPDFExtractor) FinTechGroupBankPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.FinTechGroupBankPDFExtractor) CommerzbankPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.CommerzbankPDFExtractor) DegiroPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.DegiroPDFExtractor) UnicreditPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.UnicreditPDFExtractor) BankSLMPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor) DABPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.DABPDFExtractor) DkbPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.DkbPDFExtractor) OnvistaPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.OnvistaPDFExtractor) BaaderBankPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.BaaderBankPDFExtractor) DeutscheBankPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.DeutscheBankPDFExtractor) ComdirectPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.ComdirectPDFExtractor) INGDiBaExtractor(name.abuchen.portfolio.datatransfer.pdf.INGDiBaExtractor) HelloBankPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.HelloBankPDFExtractor) SBrokerPDFExtractor(name.abuchen.portfolio.datatransfer.pdf.SBrokerPDFExtractor)

Aggregations

BankSLMPDFExtractor (name.abuchen.portfolio.datatransfer.pdf.BankSLMPDFExtractor)8 IOException (java.io.IOException)7 LocalDateTime (java.time.LocalDateTime)7 ArrayList (java.util.ArrayList)7 List (java.util.List)7 Optional (java.util.Optional)7 BuySellEntryItem (name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem)7 Item (name.abuchen.portfolio.datatransfer.Extractor.Item)7 SecurityItem (name.abuchen.portfolio.datatransfer.Extractor.SecurityItem)7 TransactionItem (name.abuchen.portfolio.datatransfer.Extractor.TransactionItem)7 AssertImportActions (name.abuchen.portfolio.datatransfer.actions.AssertImportActions)7 PDFInputFile (name.abuchen.portfolio.datatransfer.pdf.PDFInputFile)7 AccountTransaction (name.abuchen.portfolio.model.AccountTransaction)7 BuySellEntry (name.abuchen.portfolio.model.BuySellEntry)7 Client (name.abuchen.portfolio.model.Client)7 PortfolioTransaction (name.abuchen.portfolio.model.PortfolioTransaction)7 Security (name.abuchen.portfolio.model.Security)7 Unit (name.abuchen.portfolio.model.Transaction.Unit)7 Money (name.abuchen.portfolio.money.Money)7 Values (name.abuchen.portfolio.money.Values)7