Examples of TxactionList


Examples of com.wesabe.api.accounts.entities.TxactionList

     
      txactions = ImmutableList.of(interestEarned, starbucks, wholeFoods);
    }
       
    private TxactionList buildTxactionList(String query) {
      final TxactionList list = new TxactionListBuilder()
                      .setQuery(query)
                      .setCurrency(USD)
                      .setCurrencyExchangeRateMap(exchangeRates)
                      .build(txactions);
      return list;
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

   
    @Test
    public void itReturnsTxactionsWithFilteredNamesContainingTheQuery() throws Exception {
      inject(Txaction.class, starbucks, "filteredName", "Starbucks San Francis");
     
      final TxactionList list = buildTxactionList("Starbucks");
      assertEquals(ImmutableList.of(starbucks), list.getTxactions());
    }
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

    @Test
    public void itReturnsTxactionsWithMerchantNamesContainingTheQuery() throws Exception {
      starbucks.setMerchant(new Merchant("Starbucks"));
     
      final TxactionList list = buildTxactionList("Starbucks");
      assertEquals(ImmutableList.of(starbucks), list.getTxactions());
    }
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

   
    @Test
    public void itReturnsTxactionsWithTagNamesContainingTheQuery() throws Exception {
      inject(Txaction.class, starbucks, "taggedAmounts", ImmutableList.of(new TaggedAmount(starbucks, new Tag("snack"), null)));
     
      final TxactionList list = buildTxactionList("Snack");
      assertEquals(ImmutableList.of(starbucks), list.getTxactions());
    }
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

   
    @Test
    public void itReturnsTxactionsWithNotesContainingTheQuery() throws Exception {
      inject(Txaction.class, starbucks, "note", "MUFFINS OH JOY");
     
      final TxactionList list = buildTxactionList("muffins");
      assertEquals(ImmutableList.of(starbucks), list.getTxactions());
    }
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

      when(tx2.getDatePosted()).thenReturn(date(2008, 10, 16));
      this.item2 = mock(TxactionListItem.class);
      when(item2.getBalance()).thenReturn(money("300.00", USD));
      when(item2.getTxaction()).thenReturn(tx2);
     
      this.txactionList = new TxactionList(item1, item2);
      when(listBuilder.build(Mockito.anyCollection())).thenReturn(txactionList);
     
      this.summarizer = new NetWorthSummarizer(listBuilderProvider);
    }
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

      @QueryParam("merchant") Set<String> merchantNames,
      @QueryParam("amount") BigDecimal amount,
      @QueryParam("query") String query) {
   
    final List<Account> accounts = getAccounts(user, accountUris);
    final TxactionList txactions = filterTxactions(
        accounts,
        getTxactions(accounts, startDate, endDate),
        currency, uneditedOnly, limit, offset,
        tagUris, merchantNames, amount, query
    );
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

    }
    if (query != null) {
      txactionListBuilder.setQuery(query);
    }
   
    final TxactionList filteredTxactions = txactionListBuilder.build(txactions);
    return filteredTxactions;
  }
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

  private CurrencyExchangeRateMap exchangeRateMap;
  private BigDecimal amount;
  private String query;
 
  public TxactionList build(Collection<Txaction> txactions) {
    TxactionList txactionList = new TxactionList();
   
    // remove disabled, deleted, etc, sort them in reverse chronological order
    final List<Txaction> resultTxactions = sort(filter(txactions));
   
    // set the total count to all the ones that could ever be shown
    txactionList.setTotalCount(resultTxactions.size());
   
    if (resultTxactions.isEmpty()) {
      return txactionList;
    }
   
    // hack of the end of the list since they are not useful in balance calculation
    applyLimit(resultTxactions);

    for (Txaction txaction : resultTxactions) {
      txactionList.add(new TxactionListItem(txaction));
    }
   
    if (tags.isEmpty() && merchantNames.isEmpty() && calculateBalances) {
      // calculate balances before removing the offset as those Txactions may affect the balances
      txactionList.calculateRunningTotalBalances(accounts, currency, exchangeRateMap);
    }
   
    // hack off the front of the list we were asked to hide
    applyOffset(txactionList);
   
View Full Code Here

Examples of com.wesabe.api.accounts.entities.TxactionList

    final TxactionListBuilder txactionListBuilder = listBuilderProvider.get();
    txactionListBuilder.setAccounts(accounts);
    txactionListBuilder.setCurrency(currency);
    txactionListBuilder.setCalculateBalances(true);
   
    final TxactionList txactionList = txactionListBuilder.build(txactions);
    final NavigableMap<DateTime, Money> balancesByDate = Maps.newTreeMap();
    for (TxactionListItem listItem : txactionList) {
      balancesByDate.put(listItem.getTxaction().getDatePosted(), listItem.getBalance());
    }
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.