This application must retrieve and aggregate accounts and transactions data as described below :
[
{
"acc_number": "0000001",
"amount": 25,
"transactions": [
{
"label": "Label 1",
"amount": 50,
"currency": "EUR"
},
{
"label": "Label 2",
"amount": -25,
"currency": "EUR"
}
]
},
{
"acc_number": "0000002",
"amount": 50,
"transactions": []
}
]
npm install
npm run build
Or you can use :
npm run watch
npm start
npm run test
Here is the server swagger : https://dsague.fr/swaggerui/
This server will simulate a bank API.
Get API health.
URL : https://dsague.fr/health
Method : GET
Code : 200 OK
Content
ok
Get all user's accounts.
URL : https://dsague.fr/accounts
Method : GET
Headers :
Content-Type: application/json
x-api-key: {api-key}
Code : 200 OK
Content example
{
"accounts": [
{
"acc_number": "000000001",
"amount": "3000",
"currency": "EUR"
}
],
"links": {
"self": "/accounts?page=1",
"next": "/accounts?page=2"
}
}
Condition : If API key is missing or wrong.
Code : 401 UNAUTHORIZED
Get an account's transactions, by account number
URL : https://dsague.fr/accounts/<acc_number>/transactions
Method : GET
Headers :
Content-Type: application/json
x-api-key: {api-key}
Code : 200 OK
Content example
{
"transactions": [
{
"id": 1,
"label": "label 1",
"sign": "DBT",
"amount": "30",
"currency": "EUR"
}
],
"links": {
"self": "/accounts/0000001/transactions?page=1",
"next": "/accounts/0000001/transactions?page=2"
}
}
Sign references
Sign label | Meaning |
---|---|
DBT | Debit transaction |
CDT | Credit transaction |
Condition : If API key is missing or wrong.
Code : 401 UNAUTHORIZED