Ejemplo n.º 1
0
  public String doTx() {
    String message = null;
    TxController txctl = beanManager.getTxController();

    operationString = messages.getString("WithdrewString");
    prepString = messages.getString("FromString");
    Debug.print(accountId);

    beanManager.setAccount(accountId);
    selectedAccount = beanManager.getAccountDetails();

    boolean isCreditAcct = false;
    if (selectedAccount.getType().equals("Credit")) isCreditAcct = true;

    if (isCreditAcct) {
      if (operation == 0) {
        try {
          txctl.makeCharge(amount, "ATM Withdrawal", accountId);
        } catch (RemoteException e) {
          Debug.print(message);
          return e.getMessage();
        } catch (InvalidParameterException e) {
          // Not possible
        } catch (AccountNotFoundException e) {
          // Not possible
        } catch (InsufficientCreditException e) {
          message = messages.getString("InsufficientCreditError");
          Debug.print(message);
        } catch (IllegalAccountTypeException e) {
          // Not possible
        }
      } else {
        operationString = messages.getString("DepositedString");
        prepString = messages.getString("ToString");
        try {
          txctl.makePayment(amount, "ATM Deposit", accountId);
        } catch (RemoteException e) {
          Debug.print(message);
          return e.getMessage();
        } catch (InvalidParameterException e) {
          // Not possible
        } catch (AccountNotFoundException e) {
          // Not possible
        } catch (IllegalAccountTypeException e) {
          // Not possible
        }
      }
    } else {
      if (operation == 0) {
        try {
          txctl.withdraw(amount, "ATM Withdrawal", accountId);
        } catch (RemoteException e) {
          Debug.print(message);
          return e.getMessage();
        } catch (InvalidParameterException e) {
          // Not possible
        } catch (AccountNotFoundException e) {
          // Not possible
        } catch (IllegalAccountTypeException e) {
          // Not possible
        } catch (InsufficientFundsException e) {
          message = messages.getString("InsufficientFundsError");
          Debug.print(message);
        }
      } else {
        operationString = messages.getString("DepositedString");
        prepString = messages.getString("ToString");
        try {
          txctl.deposit(amount, "ATM Deposit", accountId);
        } catch (RemoteException e) {
          Debug.print(message);
          return e.getMessage();
        } catch (InvalidParameterException e) {
          // Not possible
        } catch (AccountNotFoundException e) {
          // Not possible
        } catch (IllegalAccountTypeException e) {
          // Not possible
        }
      }
    }
    selectedAccount = beanManager.getAccountDetails();
    return message;
  }
Ejemplo n.º 2
0
 public void setOperation(int operation) {
   this.operation = operation;
   Debug.print("Setting operation to: " + operation);
 }
Ejemplo n.º 3
0
 public void setAccountId(String accountId) {
   this.accountId = accountId;
   Debug.print("Setting account id to: " + accountId);
 }
Ejemplo n.º 4
0
 public void setAmount(BigDecimal amount) {
   this.amount = amount;
   Debug.print("Setting amount to: " + amount);
 }