Curve Ldt. Development Challenge: a small project for payments via prepaid card.
This project simulates a payment via prepaid cards.
The user, after being created, can create one or more cards and deposit some money on them.
When the user decides to pay something with his card, a merchant (that has already been created) can make an authorization request to block some amount of money. If the card contains enough money, the request is accepted and the amount is blocked.
After that, the merchant can capture some or all of the amount requested before, creating a transaction and receiving the money.
The merchant can revert some of the authorization request amount, making him unable to capture this later.
After capturing it, the merchant can refund the user, creating a transaction sending the money back to him.
If the user wants to know how he's spending his money, he can request the transaction list of his prepaid card. These transactions are of two types: payment if they're result of a capture on an authorization request, refund if they're result of a refund of some amount already captured.
- Authentication for both user and merchant;
- Since authentication is missing, anyone can make any operation knowing the card IDs or the authorization request ones;
- Better logs;
- Better HTTP responses, both for HTTP codes and JSON Bodies.
- Go 1.11 with go mod to manage dependencies;
- gin-gonic/gin as HTTP web framework;
- golang/mock to mock interfaces, for Unit testing;
- PostgreSQL as DBMS;
- docker and docker-compose to deploy the project;
- Go 1.11, since this project uses
go mod
; - Docker and docker-compose;
- Install docker and docker-compose
- Make sure that your
docker.service
is active; - The application will be served in port 8080 and the db uses port 5432. Please make sure that these port are available;
- Make sure your are in the project's root folder;
- Run
docker-compose up
Here you can find the API Blueprint documentation. It can be served using aglio with the following command on project's root folder:
aglio -i api/api-blueprint/curve-prepaid-card-api.apib -s
you can find the documentation served on port 3000.
If you do not want to use aglio
, you can find this api here
A Postman documentation has been created in order to perform example calls. It is available here. To use it, download it, open Postman, click on import and follow the instructions.