Simple ATM Controller for Coding Assessment
-
Order of function call does matter in this scenario.
(Insert Card) > Validate PIN > Get Account List > (Select Account as index) > See Balance/Deposit/Withdraw
I strictly followed above flow, so that if you do not validate PIN, cannot go any further. -
Introduced token, which is managed by bank service and required to access bank API.
-
Though I added defense logic, may have missed at some points. My apologies for that.
$ git clone https://github.com/HyunjoonCho/ATMcontroller.git
$ cd ATMcontroller
When you install this repo using maven, automatically runs unit tests that I wrote
$ ./mvnw install
Mapped controller methods to simple REST API
Check behavior via accessing localhost:8080 via web browser
$ java -jar ./target/atm-controller-0.0.1-SNAPSHOT.jar
Every result is logged at your console
http://localhost:8080/atmController/validatePIN?pin=0123456789
http://localhost:8080/atmController/accountList?pin=0123456789
http://localhost:8080/atmController/balance?index=1
http://localhost:8080/atmController/withdraw?index=1&amount=1000
May modify default constructor of Bank.java and CashBin.java to change the initial state.
Thanks!