03. Withdrawing schmeckels
November 6, 2017 ยท View on GitHub
Not much fun depositing schmeckels with your bank if you can't retrieve them
again! The next task is simply extending the bank, teller and transaction log
with a withdraw command.
Solution to problem 02
// bank.js
// teller.js
Problem
Add a withdraw command, that .pushes this new entry to the transaction log
and handle the command type when calculating your balance. Remember to check for
sufficient funds (unless your government does bailouts). Also add a new command
to your teller client.
Testing
Restart your bank.js and try making a couple of deposits and withdrawals. You
should try and withdraw more money than is available in the bank, and have your
command be refused.