Create API for wallet that provides below service
- Debit Transaction
- Credit Transaction
- Transaction History
- Account balance
There are several ways to run a Spring Boot application on your local machine. One way is to execute the main
method in the VegasApplication.class
class from your IDE.
Alternatively you can use the Spring Boot Gradle plugin like so:
gradle bootRun
application have default user that is [email protected] and user id id mandatory.
GET /account/{userId}
{"userId":"[email protected]","amount":500.00,"lastUpdate":"2020-05-19T14:10:12.835"}
GET /transaction/{userId}
[{"transactionId":"188232sa70","transactionAmount":100.00,"transactionStatus":"COMPLETED","transactionType":"CREDIT"},{"transactionId":"18823wsa70","transactionAmount":100.00,"transactionStatus":"COMPLETED","transactionType":"CREDIT"},{"transactionId":"1823wsa70","transactionAmount":100.00,"transactionStatus":"COMPLETED","transactionType":"CREDIT"},{"transactionId":"1823ws11a70","transactionAmount":100.00,"transactionStatus":"COMPLETED","transactionType":"CREDIT"},{"transactionId":"1823wsa7099","transactionAmount":100.00,"transactionStatus":"COMPLETED","transactionType":"CREDIT"}]
POST /debit/
curl -X POST http://localhost:8080/credit -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{ "amount": 100, "userId": "[email protected]", "transactionId": "1823wsa70" }'
{"transactionId":"1823wsa7099","transactionAmount":100,"transactionStatus":"COMPLETED","transactionType":"DEBIT"}
POST /credit/
curl -X POST http://localhost:8080/credit -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{ "amount": 100, "userId": "[email protected]", "transactionId": "1823wsa70" }'
{"transactionId":"158298sa70","transactionAmount":100,"transactionStatus":"COMPLETED","transactionType":"CREDIT"}