Skip to content

j75689/bank-system-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bank-system-go

Infrastructure

infrastructure

Local Run

make docker-compose-build
make docker-compose-up
# shutdown
make docker-compose-down

Test

Create User

curl -X POST -H 'content-type: application/json' localhost:8080/api/v1/register -d '{"name": "test", "account": "test1", "password":"123456"}' -i

Login

curl -X POST -H 'content-type: application/json' localhost:8080/api/v1/login -d '{"account":"test1","password":"123456"}' -i

Create Wallet

JWT_TOEKN=...
curl -X POST -H 'content-type: application/json' -H "authentication: Bearer ${JWT_TOKEN}" localhost:8080/api/v1/wallet -d '{"type":1,"currency_id":1}' -i

List Wallet

JWT_TOEKN=...
curl -X GET -H 'content-type: application/json' -H "authentication: Bearer ${JWT_TOKEN}" localhost:8080/api/v1/wallets -d '{"pagination":{"page":0,"per_page":10},"sort":[{"sort_field":"id","sort_order":"DESC"}]}' -i

Update Wallet Balance

JWT_TOEKN=...
ACCOUNT=...
# deposit
curl -X POST -H 'content-type: application/json' -H "authentication: Bearer ${JWT_TOKEN}" localhost:8080/api/v1/wallet/balance -d "{\"type\":1,\"account_number\":\"${ACCOUNT}\",\"amount\":100}" -i
# withdraw
curl -X POST -H 'content-type: application/json' -H "authentication: Bearer ${JWT_TOKEN}" localhost:8080/api/v1/wallet/balance -d "{\"type\":2,\"account_number\":\"${ACCOUNT}\",\"amount\":100}" -i

Transfer

JWT_TOEKN=...
FROM=...
TO=...
curl -X POST -H 'content-type: application/json' -H "authentication: Bearer ${JWT_TOKEN}" localhost:8080/api/v1/transfer -d "{\"type\":3,\"from\":\"${FROM}\",\"to\":\"${TO}\",\"amount\":100}" -i

List Transaction

JWT_TOEKN=...
curl -X GET -H 'content-type: application/json' -H "authentication: Bearer ${JWT_TOKEN}" localhost:8080/api/v1/transactions -d "{\"account_number\":\"${ACCOUNT}\",\"pagination\":{\"page\":0,\"per_page\":50}}" -i

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages