Swagger api : http://localhost:8080/swagger-ui/index.html
I did not use any database implementations, but made a simple storage based on ConcurrentHashMap.
mvn clean package
- Run the app, default port 8080:
java -jar target/TakeawayPay-0.0.1-SNAPSHOT.jar
- Run the app, specify the port:
java -jar target/TakeawayPay-0.0.1-SNAPSHOT.jar -p 6666
- Run Test Cases:
mvn test
HTTP METHOD | PATH | USAGE |
---|---|---|
GET | /transfers/ | get all transfers |
GET | /accounts/ | get all acounts information |
POST | /transfer/create/ | perform transfer between 2 accounts |
With the Web server started and running, perform the following requests to consume the API:
Example request:
- GET (/transfers)
GET /transfers
Example response:
[
{
"id": 1,
"sourceAccount": 1,
"destAccount": 2,
"amount": 4,
"lastUpdate": "2023-04-23T01:31:14.672742"
}
]
Example request:
- GET (/accounts/)
GET /accounts
Example response:
[
{
"id": 1,
"balance": 36,
"lastUpdate": "2023-04-23T01:31:12.006365",
"customer": true
},
{
"id": 2,
"balance": 14,
"lastUpdate": "2023-04-23T01:31:12.087122",
"customer": false
}
]
Example request:
- POST (/transfer/create)
Example request:
POST /transfer/create
{
"sourceAccount": 1,
"destAccount": 2,
"amount": 4,
"lastUpdate": "2023-04-24T18:54:35.487Z"
}
Example response:
3