- Git
- Golang 1.18
- PostgreSQL
-
Install Git See Git Installation
-
Install Golang
-
Install Docker See [docker-compose](https://docs.docker.com/compose/install/
-
Setup PostgreSQL with docker-compose. Adjust the configuration as needed, by default PostgreSQL will be exposed via port 15432. Also adjust PostgreSQL env as needed in database.env. After that, run docker-compose up.
cd dev && docker-compose up
-
Clone this repository
git clone git@github.com:herwando/mini-wallet.git cd mini-wallet
-
Install dependencies
make dep
-
Copy env.sample and if necessary, modify the env value(s)
cp env.sample .env
-
Download database migration tools
make tool-migrate
-
Run migration for each module.
make migrate-up
-
Run golang main on cmd
make run
- POST Initialize my account for wallet
curl --location --request POST 'http://localhost/api/v1/init' \
--form 'customer_xid="ea0212d3-abd6-406f-8c67-868e814a2436"'
- POST Enable my wallet
curl --location --request POST 'http://localhost/api/v1/wallet' \
--header 'Authorization: Token 6b3f7dc70abe8aed3e56658b86fa508b472bf238'
- GET View my wallet balance
curl --location --request GET 'http://localhost/api/v1/wallet' \
--header 'Authorization: Token 6b3f7dc70abe8aed3e56658b86fa508b472bf238'
- POST Add virtual money to my wallet
curl --location --request POST 'http://localhost/api/v1/wallet/deposits' \
--header 'Authorization: Token 6b3f7dc70abe8aed3e56658b86fa508b472bf238' \
--form 'amount="100000"' \
--form 'reference_id="50535246-dcb2-4929-8cc9-004ea06f5241"'
- POST Use virtual money from my wallet
curl --location --request POST 'http://localhost/api/v1/wallet/withdrawals' \
--header 'Authorization: Token 6b3f7dc70abe8aed3e56658b86fa508b472bf238' \
--form 'amount="60000"' \
--form 'reference_id="4b01c9bb-3acd-47dc-87db-d9ac483d20b2"'
- PATCH Disable my wallet
curl --location --request PATCH 'http://localhost/api/v1/wallet' \
--header 'Authorization: Token 6b3f7dc70abe8aed3e56658b86fa508b472bf238' \
--form 'is_disabled="true"'