Interface for class Transaction
class Transaction
{
/*
* PURPOSE: Serve as base class for specific types of transactions
*/
public:
Transaction(Session & session);
// This value is returned by the keyboard to specify the particular
// type of transaction the customer chose
enum TransactionType
{ WITHDRAWL, DEPOSIT, TRANSFER, INQUIRY };
// Create a transaction object of a specified type, acting on behalf
// of the specified session
static Transaction * makeTransaction(TransactionType type,
Session & session);
// Perform a particular transaction use case. The card number and
// PIN are obtained from the session; other information is obtained
// from the customer
void doTransactionUseCase();
// Individual steps in carrying out a transaction. Each must be
// implemented individually for each type of transaction. If
// either of the first two steps returns in failure, the transaction
// is aborted.
virtual bool getTransactionSpecificsFromCustomer() = 0;
virtual Bank::ApprovalCode sendToBank() = 0;
virtual void finishApprovedTransaction() = 0;
protected:
Session & _session;
// Every transaction is assigned a unique serial number that is used
// to identify it in communications with the bank and on the receipt.
int _serialNumber;
// Every transaction gets both the updated balance and available
// balance for printing on the receipt.
Money _newBalance,
_availableBalance;
private:
static int _lastSerialNumberAssigned;
};
//