Package org.openbankdata.core

Examples of org.openbankdata.core.Account


    assertTrue("First account's transactions should have been added to the cache",
        mockedCache.exists(getTransactionsRequest()));
  }

  private Account getExpectedAccount() {
    Account account = new Account();
    account.setAccountNumber("1234567");
    account.setCurrency(Currency.getInstance("SEK"));
    account.setName("Sparkonto");
    BigDecimal balance = new BigDecimal(12345);
    account.setAvailable(balance);
    account.setBalance(balance);
    account.setAccountType(AccountType.SAVINGS);
    account.setId("_idcl:0:_id15");
    return account;
  }
View Full Code Here


    String response = vAccountsRequest.body();
    Document doc = Jsoup.parse(response);
    Element el = doc.getElementById("summaryImageHeaderRow");

    if (el != null) {
      Account account = new Account();
      account.setName(el.getElementById("headerSectionLeft").select("span.cardTitle a").text());
      account.setAccountType(AccountType.LIABILITY);
      Element link = el.select("div.summaryTitles a").first();
      account.setAccountNumber(link.text());
      account.setCurrency(Currency.getInstance("SEK"));
      account.setId(parseAccountId(link));

      String balance = doc.getElementById("colOSBalance").select("div.summaryValues").text();
      balance = balance.replaceAll("[^\\d-,]", "").replace(",", ".");
      account.setBalance(new BigDecimal(balance));
      account.setAvailable(account.getBalance());
      vAccounts.add(account);
    }
    return vAccounts;
  }
View Full Code Here

    Document doc = Jsoup.parse(response.body());
    List<Account> accounts = parseAccounts(doc);

    if (!accounts.isEmpty()) {
      Account firstAccount = accounts.get(0);
      // Get account details for first account
      addAccountDetails(firstAccount, doc);

      mBankClient.getCache().put(mTransactionService.createTransactionRequest(firstAccount),
          response);
    }

    // Fetch additional accounts transaction pages to get their balance.
    for (int i = 1; i < accounts.size(); i++) {
      Account account = accounts.get(i);
      String transactionResponse = mTransactionService
          .fetchTransactionData(account).body();
      addAccountDetails(account, Jsoup.parse(transactionResponse));
    }
    return accounts;
View Full Code Here

    List<Account> accountList = new ArrayList<Account>();
    Element element = pDocument.getElementById("balanceForm:accountsList");
    Elements accounts = element.select("td a[href=#]");
    Matcher vMatcher;
    for (Element rawAccount : accounts) {
      Account account = new Account();
      account.setAccountNumber(rawAccount.text());
      vMatcher = PATTERN_ACCOUNT_ID.matcher(rawAccount.attr("onclick"));
      if (vMatcher.find()) {
        account.setId(vMatcher.group(1) + ":" + vMatcher.group(2));
      }
      accountList.add(account);
    }
    return accountList;
  }
View Full Code Here

    // Then
    assertTrue("The returned list should be empty", actual.isEmpty());
  }

  private Account expectedAccount() {
    Account account = new Account();
    account.setAccountNumber("XXX-12345");
    account.setCurrency(Currency.getInstance("SEK"));
    account.setName("American Express Corporate Card");
    account.setId("0");
    account.setBalance(BigDecimal.valueOf(1234.56));
    account.setAvailable(BigDecimal.valueOf(1234.56));
    account.setAccountType(AccountType.LIABILITY);
    return account;
  }
View Full Code Here

    EasyMock.replay(mockedBankClient);

    // When
    // Getting all available transactions for Account 0
    Account account = new Account();
    account.setId(ACCOUNT_ID);
    List<Transaction> actual = mTransactionService.getTransactions(account);

    // Then
    assertEquals("All available transactions should have been returned", 2, actual.size());
    assertEquals("The transactions should have been correctly mapped.",
View Full Code Here

  @Test
  public void testGetTransactions()
      throws ParseException {
    // Given
    // An account with three different transactions
    Account account = new Account();
    account.setId("_idcl:0:_id15");

    EasyMock.expect(mockedBankClient.post(getTransactionRequest())).andReturn(
        getTransactionResponse());
    EasyMock.replay(mockedBankClient);
    // When
View Full Code Here

TOP

Related Classes of org.openbankdata.core.Account

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.