Example #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();
    }
  }
Example #2
0
 private Account getAccountFromCache(int accountNumber) {
   List<Account> accountList = getAccountListFromCache();
   if (accountList != null) {
     for (Account account : accountList) {
       if (account.getAccountno() == accountNumber) {
         return account;
       }
     }
   }
   return null;
 }
Example #3
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;
   }
 }
Example #4
0
 @Loggable(value = LogLevel.TRACE)
 public ContactInfo getDefaultContactInfo(User user)
     throws AccountManagementException, AddressManagementException {
   List<Account> accountList;
   try {
     accountList = getAccounts(user);
     Account account = accountList.get(0);
     Address address = addressManager.getDefaultAddress(user);
     ContactInfo contactInfo = new ContactInfo();
     contactInfo.setAddress(address);
     contactInfo.setFirstName(account.getFirstname());
     contactInfo.setLastName(account.getLastname());
     contactInfo.setPhoneNumber(account.getContactNumber());
     return contactInfo;
   } catch (AccountManagementException e) {
     throw e;
   } catch (AddressManagementException e) {
     throw e;
   }
 }
Example #5
0
 @Loggable(value = LogLevel.TRACE)
 public XMLGregorianCalendar getLastAccessFeeDate(User user, Account account) {
   XMLGregorianCalendar accessFeeDate = null;
   List<UsageDetail> usageDetails;
   try {
     usageDetails = getChargeHistory(user, account.getAccountno());
   } catch (AccountManagementException e) {
     usageDetails = new ArrayList<UsageDetail>();
   }
   for (UsageDetail usageDetail : usageDetails) {
     if (accessFeeDate == null && usageDetail.getUsageType().equals("Access Fee")) {
       accessFeeDate = usageDetail.getEndTime();
       break;
     }
   }
   return accessFeeDate;
 }
Example #6
0
 public List<User> searchByAccountNo(int accountNo) {
   Account account = port.getAccountInfo(accountNo);
   return searchByEmail(account.getContactEmail());
 }