    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class banking.Message

    java.lang.Object
       |
       +----banking.Message

public class Message
extends Object

Representations of a message from the ATM to the bank. Messages to the bank use a fixed format with fixed slots, not all of which pertain to any given type of transaction. Each type of transaction creates one or more subclasses using the slots that it needs, and supplying appropriate "not needed" values for the rest.

##

amount
  Transaction amount specified by customer - if needed (else $0.00)
card
  The customer's card
COMPLETE_DEPOSIT
  messageCode value for a message completing a deposit (envelope received).
fromAccount
  "From" account specified by customer - if needed (else - 1)
INITIATE_DEPOSIT
  messageCode value for a message initiating a deposit
INQUIRY
  messageCode value for an inquiry message
messageCode
  Code identifying the type of message - one of the above values
pin
  PIN entered by customer
serialNumber
  Serial number of the transaction
toAccount
  "To" account specified by customer - if needed (else - 1)
TRANSFER
  messageCode value for a transfer between accounts message
WITHDRAWAL
  messageCode value for a cash withdrawal message

##

Message(int, Card, int, int, int, int, Money)
  Constructor

##

getAmount()
  Accessor for acmount
getCard()
  Accessor for customer's card
getFromAccount()
  Accessor for "from" account
getMessageCode()
  Accessor for message code
getPIN()
  Accessor for PIN
getSerialNumber()
  Accessor for transaction serial number
getToAccount()
  Accessor for "to" account
setPIN(int)
  Set PIN to a new value (if original pin was invalid and customer is asked to re-enter PIN)
toString()
  Create a printable string representing this message

##

WITHDRAWAL

     public static final int WITHDRAWAL

  messageCode value for a cash withdrawal message

INITIATE_DEPOSIT

     public static final int INITIATE_DEPOSIT

  messageCode value for a message initiating a deposit

COMPLETE_DEPOSIT

     public static final int COMPLETE_DEPOSIT

  messageCode value for a message completing a deposit (envelope received).

TRANSFER

     public static final int TRANSFER

  messageCode value for a transfer between accounts message

INQUIRY

     public static final int INQUIRY

  messageCode value for an inquiry message

messageCode

     private int messageCode

  Code identifying the type of message - one of the above values

card

     private Card card

  The customer's card

pin

     private int pin

  PIN entered by customer

serialNumber

     private int serialNumber

  Serial number of the transaction

fromAccount

     private int fromAccount

  "From" account specified by customer - if needed (else - 1)

toAccount

     private int toAccount

  "To" account specified by customer - if needed (else - 1)

amount

     private Money amount

  Transaction amount specified by customer - if needed (else $0.00)

##

Message

     public Message(int messageCode,
                    Card card,
                    int pin,
                    int serialNumber,
                    int fromAccount,
                    int toAccount,
                    Money amount)

  Constructor

  Parameters:
    messageCode - identifying the type of message
    card - the customer's card
    pin - the PIN entered by the customer
    serialNumber - serial number of the transaction
    fromAccount - the type of the "from" account of the transaction - can be -1 if the particular type of transaction does not have a "from" account (e.g. a deposit)
    toAccount - the type of the "to" account of the transaction - can be -1 if the particular type of transaction does not have a "to" account (e.g. a withdrawal)
    amount - the amount of the transaction - can be null if the particular type of transaction does not have an amount (e.g. an inquiry)

##

toString

     public String toString()

  Create a printable string representing this message

  Returns:
    string representation
  Overrides:
    toString in class Object

setPIN

     public void setPIN(int pin)

  Set PIN to a new value (if original pin was invalid and customer is asked to re-enter PIN)

  Parameters:
    pin - the new pin to set

getMessageCode

     public int getMessageCode()

  Accessor for message code

  Returns:
    the code identifying the type of message

getCard

     public Card getCard()

  Accessor for customer's card

  Returns:
    the customer's card

getPIN

     public int getPIN()

  Accessor for PIN

  Returns:
    the PIN entered by the customer

getSerialNumber

     public int getSerialNumber()

  Accessor for transaction serial number

  Returns:
    the serial number of the transaction

getFromAccount

     public int getFromAccount()

  Accessor for "from" account

  Returns:
    the type of the "from" account

getToAccount

     public int getToAccount()

  Accessor for "to" account

  Returns:
    the type of the "to" account

getAmount

     public Money getAmount()

  Accessor for acmount

  Returns:
    the transaction amount

    All Packages  Class Hierarchy  This Package  Previous  Next  Index