Wallets of the players of an online casino, getting and updating players account balances API's.
git clone github.com/mervanerdem/Wallet
After cloning if you don't have used library, install them.(It's not about using library but you can see in that link)
For building
go build ./
Or Runing
go run ./
In this project use the localhost.
baseURL: localhost:8080
In this case with wallet id get balance of the wallet.
GET {{baseURL}}/api/v1/wallets/{wallet_id}/balance
The place of {wallet_id} write in to which wallet balance do you need.
The responce be like
{
"Balance": "800",
"Wallet_ID": 42
}
In this case Send Credit from wallet
POST {{baseURL}}/api/v1/wallets/{wallet_id}/credit
The Body Type is JSON format:
{
"Amount": 10
}
The responce is like:
{
"Balance": "450",
"Credit": "10",
"Wallet_ID": 30
}
In this case Take Debit from another wallet
POST {{baseURL}}/api/v1/wallets/{wallet_id}/debit
The Body Type is JSON format:
{
"Amount": 10
}
The responce is like:
{
"Balance": "460",
"Credit": "10",
"Wallet_ID": 30
}
Used Library
HTTP : Gin is a web framework written in Go (Golang)
GORM : The fantastic ORM library for Golang, aims to be developer friendly.
Decimal :Arbitrary-precision fixed-point decimal numbers in go.
Apache-2.0 License