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


Variable Index

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

Constructor Index

 o Transaction(ATM, Session, Card, int)
Constructor

Method Index

 o completeTransaction()
Complete an approved transaction - each subclass must implement this appropriately.
 o getSerialNumber()
Get serial number of this transaction
 o getSpecificsFromCustomer()
Get specifics for the transaction from the customer - each subclass must implement this appropriately.
 o 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
 o performInvalidPINExtension()
Perform the Invalid PIN Extension - reset session pin to new value if successful
 o performTransaction()
Peform a transaction.

Variables

 o atm
 protected ATM atm
ATM to use for communication with the customer

 o session
 protected Session session
Session in which this transaction is being performed

 o card
 protected Card card
Customer card for the session this transaction is part of

 o pin
 protected int pin
PIN entered or re-entered by customer

 o serialNumber
 protected int serialNumber
Serial number of this transaction

 o message
 protected Message message
Message to bank describing this transaction

 o balances
 protected Balances balances
Used to return account balances from the bank

 o TRANSACTION_TYPES_MENU
 private static final String TRANSACTION_TYPES_MENU[]
List of available transaction types to display as a menu

 o nextSerialNumber
 private static int nextSerialNumber
Next serial number - used to assign a unique serial number to each transaction

 o state
 private int state
The current state of the transaction

 o GETTING_SPECIFICS_STATE
 private static final int GETTING_SPECIFICS_STATE
Getting specifics of the transaction from customer

 o SENDING_TO_BANK_STATE
 private static final int SENDING_TO_BANK_STATE
Sending transaction to bank

 o INVALID_PIN_STATE
 private static final int INVALID_PIN_STATE
Performing invalid PIN extension

 o COMPLETING_TRANSACTION_STATE
 private static final int COMPLETING_TRANSACTION_STATE
Completing transaction

 o PRINTING_RECEIPT_STATE
 private static final int PRINTING_RECEIPT_STATE
Printing receipt

 o ASKING_DO_ANOTHER_STATE
 private static final int ASKING_DO_ANOTHER_STATE
Asking if customer wants to do another transaction

Constructors

 o 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

Methods

 o 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
 o 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
 o 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
 o getSerialNumber
 public int getSerialNumber()
Get serial number of this transaction

Returns:
serial number
 o 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
 o 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