Esempio n. 1
0
  /**
   * Get specifics for the transaction from the customer
   *
   * @return message to bank for initiating this transaction
   * @exception Cancelled if customer cancelled this transaction
   */
  protected Message getSpecificsFromCustomer() throws Cancelled {
    to =
        ATMPanel.getInstance()
            .getConsole()
            .readMenuChoice("Account to deposit to", AccountInformation.ACCOUNT_NAMES);

    amount = ATMPanel.getInstance().getConsole().readAmount("Amount to deposit");

    return new Message(Message.INITIATE_DEPOSIT, card, pin, serialNumber, -1, to, amount);
  }
Esempio n. 2
0
  /**
   * Complete an approved transaction
   *
   * @return receipt to be printed for this transaction
   * @exception Cancelled if customer cancelled or transaction timed out
   */
  protected Receipt completeTransaction() throws Cancelled {
    ATMPanel.getInstance().getEnvelopeReceiver().acceptEnvelope();
    ATMPanel.getInstance()
        .getBankNetworkManager()
        .sendMessage(
            new Message(Message.COMPLETE_DEPOSIT, card, pin, serialNumber, -1, to, amount),
            balances);

    return new Receipt(this.atm, this.card, this, this.balances) {
      {
        detailsPortion = new String[2];
        detailsPortion[0] = "DEPOSIT TO: " + AccountInformation.ACCOUNT_ABBREVIATIONS[to];
        detailsPortion[1] = "AMOUNT: " + amount.toString();
      }
    };
  }