- This is a Bank Account system implementation of the requirements described here;
- Live app is deployed on heroku here;
- Sample request/response and issue test calls to live app is on apiary here;
- Create accunt:
- PUT to https://bank-account-transfers.herokuapp.com/v1/account/ with json body:
{"sortCode":1,"accNumber":2, "currency":"GBP"}
- PUT to https://bank-account-transfers.herokuapp.com/v1/account/ with json body:
- Retrieve account:
- GET to https://bank-account-transfers.herokuapp.com/v1/account?sort-code=1&acc-no=2;
- this request can be tried in the browser as well;
- GET to https://bank-account-transfers.herokuapp.com/v1/account?sort-code=1&acc-no=2;
- Delete account:
- DELETE to https://bank-account-transfers.herokuapp.com/v1/account/ with json body:
{"sortCode":1,"accNumber":2, "currency":"GBP"}
- DELETE to https://bank-account-transfers.herokuapp.com/v1/account/ with json body:
- Deposit money:
- POST to https://bank-account-transfers.herokuapp.com/v1/account/deposit with json body:
to deposit money to the account with sort-code: 1 and account number: 2;
{"to":{"sortCode":1,"accNumber":2, "currency":"GBP"},"money":{"currency":"GBP","amount":20}}
- POST to https://bank-account-transfers.herokuapp.com/v1/account/deposit with json body:
- Withdraw money:
- POST to https://bank-account-transfers.herokuapp.com/v1/account/withdrawal with json body:
to withdraw money from the account with sort-code: 1 and account number: 2;
{"from":{"sortCode":1,"accNumber":2, "currency":"GBP"},"money":{"currency":"GBP","amount":20}}
- POST to https://bank-account-transfers.herokuapp.com/v1/account/withdrawal with json body:
- Transfer money:
- POST to https://bank-account-transfers.herokuapp.com/v1/account/transfer with json body:
to transfer money from the account with sort-code: 1 and account number: 2 to the account 2/3;
{"from":{"sortCode":1,"accNumber":2, "currency":"GBP"},"to":{"sortCode":2,"accNumber":-3, "currency":"GBP"},"money":{"currency":"GBP","amount":20}}
- POST to https://bank-account-transfers.herokuapp.com/v1/account/transfer with json body:
- Dependencies are defined here and plugins here;
- Rest API based on akka-http;
- For json (de)serialization jackson-scala is used;
- Testing layer uses: scala test for defining test cases, scala mock for mocking dependencies in unit tests and akka-http-test-kit for api tests;
- Plugins configured for the project are: s-coverage for code test coverage, scala-style for code style checking, scalafmt for code formatting and sbt-updates for keeping up the dependencies up to date;
It's behaviour is defined by the API Integration test found here.
[info] RestApiTest:
[info] restApi should
[info] - create a new account responding with HTTP-201
[info] - return an existing account
[info] - delete an existing account
[info] - deposit money to an existing account
[info] - withdraw money from an existing account
[info] - transfer money from an existing account to another existing account
[info] - respond with HTTP-404 Not Found for a non existing path
[info] - respond with HTTP-405 Method Not Allowed for a non supported HTTP method
[info] - respond with HTTP-400 Bad Request in case of an (pending)
[info] - respond with HTTP-502 Bad Gateway in case of a (pending)
[info] - respond with HTTP-404 Not Found in case of a (pending)
[info] - respond with HTTP-500 Internal Server Error in case of a generic Exception (pending)
To run application, call:
sbt run
If you wanna restart your application without reloading of sbt, use:
sbt re-start