Esempio n. 1
0
  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();
    }
  }
Esempio n. 2
0
 @Loggable(value = LogLevel.TRACE)
 public AccountDetail getAccountDetail(User user, DeviceInfo deviceInfo)
     throws AccountManagementException {
   int accountNumber = deviceInfo.getAccountNo();
   try {
     Account account = getAccount(accountNumber);
     AccountDetail accountDetail = new AccountDetail();
     accountDetail.setDeviceInfo(deviceInfo);
     accountDetail.setAccount(account);
     accountDetail.setTopUp(getTopUp(user, account).getTopupAmount());
     accountDetail.setUsageHistory(
         new UsageHistory(
             getChargeHistory(user, account.getAccountno()), user, account.getAccountno()));
     return accountDetail;
   } catch (AccountManagementException e) {
     throw e;
   }
 }