- The application offers the possibility to have multiple accounts. For each account multiple operations.
- A bank account has a unique identifier. It's represented by a balance and a list of operations which could be a deposit or a withdrawal.
- An operation is categorised(deposit or a withdrawal), have an amount, occurence date and a unique ID. Each operation is linked to a specific account.
- Deposit of a given amount of money on an account
PUT /api/accounts/{accountId}/deposit
Payload is as:
{
"amount":2000
}
Response preview:
{
"balance": 18080000,
"latestOperations": [
{
"id": 967,
"date": "2018-03-06T13:48:07.776Z",
"type": "DEPOSIT",
"amount": 20000
}
]
}
- Withdrawal of a given amount of money from an account:
PUT /api/accounts/{accountId}/withdrawal
payload is as :
{
"amount":2000
}
Response preview :
{
"balance": 12080000,
"latestOperations": [
{
"id": 970,
"date": "2018-03-06T13:48:11.754Z",
"type": "WITHDRAWAL",
"amount": -2000000
},
]
- All operations (debit, credit) listing:
GET /api/accounts/{accountId}/history
Response preview:
[
{
"id": 962,
"date": "2018-03-06T13:46:59.722Z",
"type": "DEPOSIT",
"amount": 20000
},
{
"id": 963,
"date": "2018-03-06T13:47:01.414Z",
"type": "DEPOSIT",
"amount": 20000
}, ....
]
- Account balance and last operations (5 most recent ones):
GET /api/accounts/{accountId}
Response preview:
{
"balance": 12080000,
"latestOperations": [
{
"id": 970,
"date": "2018-03-06T13:48:11.754Z",
"type": "WITHDRAWAL",
"amount": -2000000
},
]
}
Application Endpoints could be accessed using Swagger2 Ui integrated into the Application with API documentation:
To do so, visit http://localhost:8080/swagger-ui.html once the application in launched.
Setup database name,username and password in the properties.yml file
The application is tested using Junit and assertJ.
- Unit tests mainly for the services
- Integration test for the restControllers allowing for lightweight end-to-end testing
Miration script(liquibase) allows the application to initialise with 4 bank accounts upon start(See changlog.xml file).