In this example an automatic teller machine (ATM) is modelled. The ATM is online with the bank, that is, each transaction will be authorised by the bank on-demand and directly debited from the account's owner. The ATM works as follows. First, the client will insert his/her client card in the ATM and then the ATM will ask for a Personal Identification Number (PIN). Once the correct PIN is given, the ATM will ask for the amount of money to be withdrawn. If the amount is available and if the client has enough money on his credit then the said amount of money will be paid. Whether the amount of money is payable or not, i.e. the ATM has enough cash but could be the case the ATM has no change for that amount, will be also checked. Once the money is offered to the client a countdown is started, i.e. the client has a determined amount of time to pick up the money. If this timeout is over, the money will be collected by the ATM and the transaction will be rolled back.
The static aspects of this model are described using a YAON diagram in figure 5.2. The whole work is being ``monitored'' by the Controller class. In principle this is not necessarily so, but for working with a secure model the Controller class is working as a dispatcher of actions and it would have a log file with the trace of every transaction carried out with the ATM.
The class Card_input has the methods for reading the code of the client's card and for ejecting the card from the ATM. The class Card_input will interact through the Controller with the class Terminal, where the methods Req_PIN and Req_amount are defined, in order to get the PIN of the user and to verify if the given PIN is correct or not. The class Card will have the information of the cardholder, that is, the Card_number, PIN, and Account_number. The Controller will interact with Bank using the information of the cardholder in order to get the authorization to pay (or not) the requested amount. The bank_interface will send the request to the Accounting class, which belongs to the Bank package, in order to call the Debit method of the accounting class3. The Accounting class has the methods Rollback, Authorization and Debit which directly interact with the Accounts class. Rollback is for roll back a transaction (for the case anything is wrong) and should leave the account and the teller machine in the original state; Authorization will authorize or not an operation and Debit will extract the requested amount of money from the account in the case the operation is authorized.
|
|