Search in sources :

Example 51 with AccountTransaction

use of name.abuchen.portfolio.model.AccountTransaction in project portfolio by buchen.

the class IBFlexStatementExtractorTest method assertFeeRefund.

private void assertFeeRefund(Optional<Item> item) {
    assertThat(item.isPresent(), is(true));
    assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
    AccountTransaction entry = (AccountTransaction) item.get().getSubject();
    assertThat(entry.getType(), is(Type.FEES_REFUND));
    assertThat(entry.getMonetaryAmount(), is(Money.of("USD", 9_18L)));
    assertThat(entry.getDateTime(), is(LocalDateTime.parse("2017-05-03T00:00")));
}
Also used : AccountTransaction(name.abuchen.portfolio.model.AccountTransaction)

Example 52 with AccountTransaction

use of name.abuchen.portfolio.model.AccountTransaction in project portfolio by buchen.

the class IBFlexStatementExtractorTest method assertTax.

private void assertTax(Optional<Item> item) {
    assertThat(item.isPresent(), is(true));
    assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
    AccountTransaction entry = (AccountTransaction) item.get().getSubject();
    assertThat(entry.getType(), is(Type.TAXES));
    assertThat(entry.getMonetaryAmount(), is(Money.of("USD", 2_07L)));
    assertThat(entry.getDateTime(), is(LocalDateTime.parse("2017-09-15T00:00")));
}
Also used : AccountTransaction(name.abuchen.portfolio.model.AccountTransaction)

Example 53 with AccountTransaction

use of name.abuchen.portfolio.model.AccountTransaction in project portfolio by buchen.

the class IBFlexStatementExtractorTest method assertInterestCharge.

private void assertInterestCharge(Optional<Item> item) {
    assertThat(item.isPresent(), is(true));
    assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
    AccountTransaction entry = (AccountTransaction) item.get().getSubject();
    assertThat(entry.getType(), is(Type.INTEREST_CHARGE));
    assertThat(entry.getMonetaryAmount(), is(Money.of("CAD", 15_17L)));
    assertThat(entry.getDateTime(), is(LocalDateTime.parse("2013-02-05T00:00")));
}
Also used : AccountTransaction(name.abuchen.portfolio.model.AccountTransaction)

Example 54 with AccountTransaction

use of name.abuchen.portfolio.model.AccountTransaction in project portfolio by buchen.

the class IBFlexStatementExtractorTest method assertFee.

private void assertFee(Optional<Item> item) {
    assertThat(item.isPresent(), is(true));
    assertThat(item.get().getSubject(), instanceOf(AccountTransaction.class));
    AccountTransaction entry = (AccountTransaction) item.get().getSubject();
    assertThat(entry.getType(), is(Type.FEES));
    assertThat(entry.getMonetaryAmount(), is(Money.of("USD", 9_18L)));
    assertThat(entry.getDateTime(), is(LocalDateTime.parse("2017-05-03T00:00")));
}
Also used : AccountTransaction(name.abuchen.portfolio.model.AccountTransaction)

Example 55 with AccountTransaction

use of name.abuchen.portfolio.model.AccountTransaction in project portfolio by buchen.

the class CheckCurrenciesAccountTransactionTest method testTransactionCurrencyMatchesAccount.

@Test
public void testTransactionCurrencyMatchesAccount() {
    Account account = new Account();
    account.setCurrencyCode("EUR");
    AccountTransaction t = new AccountTransaction();
    t.setMonetaryAmount(Money.of("EUR", 1_00));
    assertThat(action.process(t, account).getCode(), is(Status.Code.OK));
    t.setMonetaryAmount(Money.of("USD", 1_00));
    assertThat(action.process(t, account).getCode(), is(Status.Code.ERROR));
}
Also used : Account(name.abuchen.portfolio.model.Account) AccountTransaction(name.abuchen.portfolio.model.AccountTransaction) Test(org.junit.Test)

Aggregations

AccountTransaction (name.abuchen.portfolio.model.AccountTransaction)218 Client (name.abuchen.portfolio.model.Client)169 PortfolioTransaction (name.abuchen.portfolio.model.PortfolioTransaction)152 Money (name.abuchen.portfolio.money.Money)148 IOException (java.io.IOException)141 Unit (name.abuchen.portfolio.model.Transaction.Unit)135 Test (org.junit.Test)133 BuySellEntry (name.abuchen.portfolio.model.BuySellEntry)131 Security (name.abuchen.portfolio.model.Security)129 ArrayList (java.util.ArrayList)125 Values (name.abuchen.portfolio.money.Values)117 List (java.util.List)110 LocalDateTime (java.time.LocalDateTime)109 CurrencyUnit (name.abuchen.portfolio.money.CurrencyUnit)103 CoreMatchers.is (org.hamcrest.CoreMatchers.is)102 Assert.assertThat (org.junit.Assert.assertThat)102 Item (name.abuchen.portfolio.datatransfer.Extractor.Item)99 SecurityItem (name.abuchen.portfolio.datatransfer.Extractor.SecurityItem)99 TransactionItem (name.abuchen.portfolio.datatransfer.Extractor.TransactionItem)99 Optional (java.util.Optional)87