Rest API for simple prepaid card
It is simple just execute mvn spring-boot:run
No by default it uses in-memorry database but also it is easy just to change it in application.properties if you want the tables to created in real one.
curl -i -X POST \ -H "Content-Type:application/json" \ -d \ '{ "username":"[email protected]", "password":"password" }' \ 'http://localhost:8080/users'
curl -i -X POST \ -H "Content-Type:application/json" \ -d \ '{ "username":"[email protected]", "password":"password" }' \ 'http://localhost:8080/authorize'
curl -i -X POST \ -H "Content-Type:application/json" \ -H "Authorization:Bearer <TOKEN>" \ -d \ '{ "currency":"GBP", "amount":5.5, "description":"Coffee" }' \ 'http://localhost:8080/payments/'
curl -i -X POST \ -H "Content-Type:application/json" \ -H "Authorization:Bearer <TOKEN>" \ -d \ '{ "currency":"GBP", "amount":15 }' \ 'http://localhost:8080/cards/<CARD_UID>/topup'
curl -i -X GET \ -H "Authorization:Bearer <TOKEN>" \ 'http://localhost:8080/cards/<CARD_ID>/balance'
curl -i -X GET \ -H "Authorization:Bearer <TOKEN>" \ 'http://localhost:8080/cards'
curl -i -X POST \ -H "Content-Type:application/json" \ -H "Authorization:Bearer <TOKEN>" \ -d \ '{ "currency":"GBP", "amount":5.5, "description":"Coffee" }' \ 'http://localhost:8080/payments/'
curl -i -X POST \ -H "Content-Type:application/json" \ -H "Authorization:Bearer <TOKEN>" \ -d \ '{ "card":"<CARD_UID>" }' \ 'http://localhost:8080/payments/<PAYMENT_UID>/authorize'
curl -i -X POST \ -H "Content-Type:application/json" \ -H "Authorization:Bearer <TOKEN>" \ -d \ '{ "card":"<CARD_UID>", "amount":"2" }' \ 'http://localhost:8080/payments/<PAYMENT_UID>/capture'
curl -i -X POST \ -H "Content-Type:application/json" \ -H "Authorization:Bearer <TOKEN>" \ -d \ '{ "card":"<CARD_UID>", "amount":"1.5" }' \ 'http://localhost:8080/payments/<PAYMENT_UID>/reverse'
curl -i -X POST \ -H "Content-Type:application/json" \ -H "Authorization:Bearer <TOKEN>" \ -d \ '{ "card":"<CARD_UID>", "amount":"2.0" }' \ 'http://localhost:8080/payments/<PAYMENT_UID>/refund'