public Overview(AccountManager accountManager, List<DeviceInfo> devices, User user) { this.accountDetails = new ArrayList<AccountDetail>(); AccountDetail accountDetail; Account account; try { // devices = accountManager.getDeviceList(user); this.paymentHistory = new PaymentHistory(accountManager.getPaymentRecords(user), user); for (DeviceInfo deviceInfo : devices) { account = accountManager.getAccount(deviceInfo.getAccountNo()); accountDetail = new AccountDetail(); accountDetail.setAccount(account); accountDetail.setDeviceInfo(deviceInfo); accountDetail.setTopUp(accountManager.getTopUp(user, account).getTopupAmount()); accountDetail.setUsageHistory( new UsageHistory( accountManager.getChargeHistory(user, account.getAccountno()), user, account.getAccountno())); this.accountDetails.add(accountDetail); } } catch (AccountManagementException e) { e.printStackTrace(); } }
public AccountDetail getAccountDetail(int accountNum) { for (AccountDetail accountDetail : accountDetails) { if (accountDetail.getAccount().getAccountno() == accountNum) { return accountDetail; } } return null; }
public void testAccountDetailCashUS() throws Exception { AccountDetail detail = gls.getAccountDetail( tj, cashUS, Util.parseDate("20050101"), Util.parseDate("20050131"), new short[] {0}); assertEquals(3, detail.size()); assertEquals(new BigDecimal("0.00"), detail.getInitialBalance()); assertEquals(new BigDecimal("25000.00"), detail.getFinalBalance()); }