Interface for class Bank
class Bank
{
/*
*PURPOSE: Manage dialogue between the ATM and the bank
*/
public:
Bank();
// The different types of account that can be linked to a card
enum AccountType
{ CHECKING, SAVINGS, MONEY_MARKET };
// When the bank is asked to approve a transaction, it returns one
// of these. Any value other than APPROVED denotes rejection
enum ApprovalCode
{ APPROVED,
UNKNOWN_CARD, INVALID_PIN, NO_SUCH_ACCOUNT,
CANT_WITHDRAW_FROM_ACCOUNT, INSUFFICIENT_AVAILABLE_BALANCE,
DAILY_WITHDRAWL_LIMIT_EXCEEDED
};
// Withdrawls and deposits are done in two stages - first the
// transaction is approved, then the bank is notified as to whether
// or not if was physically completed
ApprovalCode initiateWithdrawl(int cardNumber,
int PIN,
int ATMnumber,
int serialNumber,
AccountType from,
Money amount,
Money & newBalance,
Money & availableBalance);
void finishWithdrawl(int ATMnumber,
int serialNumber,
bool succeeded);
ApprovalCode initiateDeposit(int cardNumber,
int PIN,
int ATMnumber,
int serialNumber,
AccountType to,
Money amount,
Money & newBalance,
Money & availableBalance);
void finishDeposit(int ATMnumber,
int serialNumber,
bool succeeded);
// Each of these approves and does a transaction. No notice of
// physical completion is needed.
ApprovalCode doTransfer(int cardNumber,
int PIN,
int ATMnumber,
int serialNumber,
AccountType from,
AccountType to,
Money amount,
Money & newBalance,
Money & availableBalance);
ApprovalCode doInquiry(int cardNumber,
int PIN,
int ATMnumber,
int serialNumber,
AccountType from,
Money & newBalance,
Money & availableBalance);
const char * accountName(AccountType type) const;
const char * rejectionDescription(ApprovalCode code) const;
};
extern Bank theBank;
//