Ejemplo n.º 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);
  }
Ejemplo n.º 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);
    }
  }
Ejemplo n.º 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);
  }
Ejemplo n.º 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);
    }
  }
Ejemplo n.º 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);
    }
  }
Ejemplo n.º 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;
  }