    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class atm.transaction.Transaction

    java.lang.Object
       |
       +----atm.transaction.Transaction

public abstract class Transaction
extends Object

Abstract base class for classes representing the various kinds of transaction the ATM can perform

##

ASKING_DO_ANOTHER_STATE
  Asking if customer wants to do another transaction
atm
  ATM to use for communication with the customer
balances
  Used to return account balances from the bank
card
  Customer card for the session this transaction is part of
COMPLETING_TRANSACTION_STATE
  Completing transaction
GETTING_SPECIFICS_STATE
  Getting specifics of the transaction from customer
INVALID_PIN_STATE
  Performing invalid PIN extension
message
  Message to bank describing this transaction
nextSerialNumber
  Next serial number - used to assign a unique serial number to each transaction
pin
  PIN entered or re-entered by customer
PRINTING_RECEIPT_STATE
  Printing receipt
SENDING_TO_BANK_STATE
  Sending transaction to bank
serialNumber
  Serial number of this transaction
session
  Session in which this transaction is being performed
state
  The current state of the transaction
TRANSACTION_TYPES_MENU
  List of available transaction types to display as a menu

##

Transaction(ATM, Session, Card, int)
  Constructor

##

completeTransaction()
  Complete an approved transaction - each subclass must implement this appropriately.
getSerialNumber()
  Get serial number of this transaction
getSpecificsFromCustomer()
  Get specifics for the transaction from the customer - each subclass must implement this appropriately.
makeTransaction(ATM, Session, Card, int)
  Create a transaction of an appropriate type by asking the customer what type of transaction is desired and then returning a newly-created member of the appropriate subclass
performInvalidPINExtension()
  Perform the Invalid PIN Extension - reset session pin to new value if successful
performTransaction()
  Peform a transaction.

##

atm

     protected ATM atm

  ATM to use for communication with the customer

session

     protected Session session

  Session in which this transaction is being performed

card

     protected Card card

  Customer card for the session this transaction is part of

pin

     protected int pin

  PIN entered or re-entered by customer

serialNumber

     protected int serialNumber

  Serial number of this transaction

message

     protected Message message

  Message to bank describing this transaction

balances

     protected Balances balances

  Used to return account balances from the bank

TRANSACTION_TYPES_MENU

     private static final String TRANSACTION_TYPES_MENU[]

  List of available transaction types to display as a menu

nextSerialNumber

     private static int nextSerialNumber

  Next serial number - used to assign a unique serial number to each transaction

state

     private int state

  The current state of the transaction

GETTING_SPECIFICS_STATE

     private static final int GETTING_SPECIFICS_STATE

  Getting specifics of the transaction from customer

SENDING_TO_BANK_STATE

     private static final int SENDING_TO_BANK_STATE

  Sending transaction to bank

INVALID_PIN_STATE

     private static final int INVALID_PIN_STATE

  Performing invalid PIN extension

COMPLETING_TRANSACTION_STATE

     private static final int COMPLETING_TRANSACTION_STATE

  Completing transaction

PRINTING_RECEIPT_STATE

     private static final int PRINTING_RECEIPT_STATE

  Printing receipt

ASKING_DO_ANOTHER_STATE

     private static final int ASKING_DO_ANOTHER_STATE

  Asking if customer wants to do another transaction

##

Transaction

     protected Transaction(ATM atm,
                           Session session,
                           Card card,
                           int pin)

  Constructor

  Parameters:
    atm - the ATM used to communicate with customer
    session - the session in which this transaction is being performed
    card - the customer's card
    pin - the PIN entered by the customer

##

makeTransaction

     public static Transaction makeTransaction(ATM atm,
                                               Session session,
                                               Card card,
                                               int pin) throws CustomerConsole. Cancelled

  Create a transaction of an appropriate type by asking the customer what type of transaction is desired and then returning a newly-created member of the appropriate subclass

  Parameters:
    atm - the ATM used to communicate with customer
    session - the session in which this transaction is being performed
    card - the customer's card
    pin - the PIN entered by the customer
  Returns:
    a newly created Transaction object of the appropriate type
  Throws: CustomerConsole. Cancelled
    if the customer presses cancel instead of choosing a transaction type

performTransaction

     public boolean performTransaction() throws Transaction. CardRetained

  Peform a transaction. This method depends on the three abstract methods that follow to perform the operations unique to each type of transaction in the appropriate way.

  Returns:
    true if customer indicates a desire to do another transaction; false if customer does not desire to do another transaction
  Throws: Transaction. CardRetained
    if card was retained due to too many invalid PIN's

performInvalidPINExtension

     public Status performInvalidPINExtension() throws CustomerConsole. Cancelled, Transaction. CardRetained

  Perform the Invalid PIN Extension - reset session pin to new value if successful

  Returns:
    status code returned by bank from most recent re-submission of transaction
  Throws: CustomerConsole. Cancelled
    if customer presses the CANCEL key instead of re-entering PIN
  Throws: Transaction. CardRetained
    if card was retained due to too many invalid PIN's

getSerialNumber

     public int getSerialNumber()

  Get serial number of this transaction

  Returns:
    serial number

getSpecificsFromCustomer

     protected abstract Message getSpecificsFromCustomer() throws CustomerConsole. Cancelled

  Get specifics for the transaction from the customer - each subclass must implement this appropriately.

  Returns:
    message to bank for initiating this transaction
  Throws: CustomerConsole. Cancelled
    if customer cancelled this transaction

completeTransaction

     protected abstract Receipt completeTransaction() throws CustomerConsole. Cancelled

  Complete an approved transaction - each subclass must implement this appropriately.

  Returns:
    receipt to be printed for this transaction
  Throws: CustomerConsole. Cancelled
    if customer cancelled this transaction

    All Packages  Class Hierarchy  This Package  Previous  Next  Index