예제 #1
0
  public void withdraw(long accountNumber, double amount) {

    Account account = accountDAO.loadAccount(accountNumber);
    account.withdraw(amount);
    accountDAO.updateAccount(account);
    logger.log("withdraw with parameters accountNumber= " + accountNumber + " , amount= " + amount);
  }
예제 #2
0
  public void transferFunds(
      long fromAccountNumber, long toAccountNumber, double amount, String description) {

    Account fromAccount = accountDAO.loadAccount(fromAccountNumber);
    Account toAccount = accountDAO.loadAccount(toAccountNumber);
    fromAccount.transferFunds(toAccount, amount, description);
    accountDAO.updateAccount(fromAccount);
    accountDAO.updateAccount(toAccount);
    logger.log(
        "transferFunds with parameters fromAccountNumber= "
            + fromAccountNumber
            + " , toAccountNumber= "
            + toAccountNumber
            + " , amount= "
            + amount
            + " , description= "
            + description);
    if (amount > 10000) {
      jmsSender.sendJMSMessage(
          "TransferFunds of $ "
              + amount
              + " from account with accountNumber= "
              + fromAccount
              + " to account with accountNumber= "
              + toAccount);
    }
  }
예제 #3
0
  public void withdrawEuros(long accountNumber, double amount) {

    Account account = accountDAO.loadAccount(accountNumber);
    double amountDollars = currencyConverter.euroToDollars(amount);
    account.withdraw(amountDollars);
    accountDAO.updateAccount(account);
    logger.log(
        "withdrawEuros with parameters accountNumber= " + accountNumber + " , amount= " + amount);
  }
예제 #4
0
  public void deposit(long accountNumber, double amount) {

    Account account = accountDAO.loadAccount(accountNumber);
    account.deposit(amount);
    accountDAO.updateAccount(account);
    logger.log("deposit with parameters accountNumber= " + accountNumber + " , amount= " + amount);
    if (amount > 10000) {
      jmsSender.sendJMSMessage(
          "Deposit of $ " + amount + " to account with accountNumber= " + accountNumber);
    }
  }
예제 #5
0
  public void depositEuros(long accountNumber, double amount) {

    Account account = accountDAO.loadAccount(accountNumber);
    double amountDollars = currencyConverter.euroToDollars(amount);
    account.deposit(amountDollars);
    accountDAO.updateAccount(account);
    logger.log(
        "depositEuros with parameters accountNumber= " + accountNumber + " , amount= " + amount);
    if (amountDollars > 10000) {
      jmsSender.sendJMSMessage(
          "Deposit of $ " + amount + " to account with accountNumber= " + accountNumber);
    }
  }
예제 #6
0
  public Account createAccount(long accountNumber, String customerName) {

    Account account = new Account(accountNumber);
    Customer customer = new Customer(customerName);
    account.setCustomer(customer);
    accountDAO.saveAccount(account);
    logger.log(
        "createAccount with parameters accountNumber= "
            + accountNumber
            + " , customerName= "
            + customerName);

    return account;
  }
예제 #7
0
  public Collection<Account> getAllAccounts() {

    Collection<Account> accounts = accountDAO.getAccounts();

    return accounts;
  }
예제 #8
0
  public Account getAccount(long accountNumber) {

    Account account = accountDAO.loadAccount(accountNumber);

    return account;
  }