Package com.wesabe.api.accounts.analytics

Examples of com.wesabe.api.accounts.analytics.TxactionListBuilder


      assertEquals(1, list.getTotalCount());
    }
   
    @Test
    public void itDoesNotCalculateARunningTotalBalance() throws Exception {
      assertNull(new TxactionListBuilder()
                .setMerchantNames(ImmutableSet.of("Whole Foods"))
                .setAccounts(new AccountList(checking, savings))
                .setCurrency(USD)
                .setCurrencyExchangeRateMap(exchangeRates)
                .build(txactions)
View Full Code Here


      txactions = ImmutableList.of(untaggedStarbucks, interestEarned, taggedWholeFoods, transferToSavings, transferFromChecking);
    }

    @Test
    public void itIncludesAllTxactionsIfUneditedIsFalse() {
      final TxactionList list = new TxactionListBuilder()
                      .setAccounts(new AccountList(checking, savings))
                      .setUnedited(false)
                      .setCurrency(USD)
                      .setCurrencyExchangeRateMap(exchangeRates)
                      .build(txactions);
View Full Code Here

    }

    @Test
    public void itIncludesNonTransferTxactionsWithNoMerchantOrNoTagsIfUneditedIsTrue() {
      expectedTxactions = Lists.newArrayList(transferFromChecking, interestEarned, untaggedStarbucks);
      final TxactionList list = new TxactionListBuilder()
                      .setAccounts(new AccountList(checking, savings))
                      .setUnedited(true)
                      .setCurrency(USD)
                      .setCurrencyExchangeRateMap(exchangeRates)
                      .build(txactions);
View Full Code Here

      txactions = ImmutableList.of(interestEarned, starbucks, wholeFoods);
    }

    @Test
    public void itReturnsTxactionsExcludingTheOffsetOnes() {
      assertEquals(Lists.newArrayList(starbucks, wholeFoods), new TxactionListBuilder()
                        .setOffset(1)
                        .setAccounts(new AccountList(checking, savings))
                        .setCurrency(USD)
                        .setCurrencyExchangeRateMap(exchangeRates)
                        .build(txactions)
View Full Code Here

                        .getTxactions());
    }
   
    @Test
    public void itIncludesTheOffsetTransactionsInTheTotalCount() throws Exception {
      final TxactionList list = new TxactionListBuilder()
                    .setOffset(1)
                    .setAccounts(new AccountList(checking, savings))
                    .setCurrency(USD)
                    .setCurrencyExchangeRateMap(exchangeRates)
                    .build(txactions);
View Full Code Here

      txactions = ImmutableList.of(interestEarned, starbucks, wholeFoods);
    }

    @Test
    public void itReturnsTxactionsExcludingTheOffsetOnes() {
      assertEquals(Lists.newArrayList(interestEarned, starbucks), new TxactionListBuilder()
                        .setLimit(2)
                        .setAccounts(new AccountList(checking, savings))
                        .setCurrency(USD)
                        .setCurrencyExchangeRateMap(exchangeRates)
                        .build(txactions)
View Full Code Here

                        .getTxactions());
    }
   
    @Test
    public void itIncludesTheLimitedTransactionsInTheTotalCount() throws Exception {
      final TxactionList list = new TxactionListBuilder()
                      .setOffset(1)
                      .setAccounts(new AccountList(checking, savings))
                      .setCurrency(USD)
                      .setCurrencyExchangeRateMap(exchangeRates)
                      .build(txactions);
View Full Code Here

      txactions = ImmutableList.of(interestEarned, starbucks, wholeFoods);
    }

    @Test
    public void itReturnsTxactionsWithTheCorrectAmount() {
      final TxactionList list = new TxactionListBuilder()
                      .setAmount(decimal("-3.00"))
                      .setCurrency(USD)
                      .setCurrencyExchangeRateMap(exchangeRates)
                      .build(txactions);
      assertEquals(ImmutableList.of(starbucks), list.getTxactions());
View Full Code Here

     
      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

  private TxactionList filterTxactions(List<Account> accounts,
      List<Txaction> txactions, CurrencyParam currency, BooleanParam uneditedOnly,
      IntegerParam limit, IntegerParam offset, Set<String> tagUris,
      Set<String> merchantNames, BigDecimal amount, String query) {
    final TxactionListBuilder txactionListBuilder = builderProvider.get();
    txactionListBuilder.setAccounts(accounts);
    txactionListBuilder.setUnedited(uneditedOnly.getValue());
    txactionListBuilder.setTags(getTags(tagUris));
    txactionListBuilder.setCurrency(currency.getValue());

    if (!merchantNames.isEmpty()) {
      txactionListBuilder.setMerchantNames(merchantNames);
    }
    if (limit != null) {
      txactionListBuilder.setLimit(limit.getValue());
    }
    if (offset != null) {
      txactionListBuilder.setOffset(offset.getValue());
    }
    if (amount != null) {
      txactionListBuilder.setAmount(amount);
    }
    if (query != null) {
      txactionListBuilder.setQuery(query);
    }
   
    final TxactionList filteredTxactions = txactionListBuilder.build(txactions);
    return filteredTxactions;
  }
View Full Code Here

TOP

Related Classes of com.wesabe.api.accounts.analytics.TxactionListBuilder

Copyright © 2018 www.massapicom. 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.