Wallet
所属分类:微服务
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2022-08-08 17:27:42
上 传 者:
sh-1993
说明: no intro
(Wallets of the players of an online casino, getting and updating players account balances API s.)
文件列表:
LICENSE (11346, 2022-08-08)
go.mod (1329, 2022-08-08)
go.sum (10160, 2022-08-08)
main.go (296, 2022-08-08)
mysql_storage.go (1207, 2022-08-08)
mysql_storage_test.go (983, 2022-08-08)
server.go (3520, 2022-08-08)
server_test.go (3193, 2022-08-08)
wallet.exe (16497152, 2022-08-08)
wallet.go (958, 2022-08-08)
wallet_test.go (2136, 2022-08-08)
# Wallet
## Context
Wallets of the players of an online casino, getting and updating players account balances API's.
## How to Install
### Firstly Clone the repository
```go
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](https://pkg.go.dev/cmd/go/internal/get))
### Build or Run it
For building
```go
go build ./
```
Or Runing
```Go
go run ./
```
## How to Use
In this project use the localhost.
```
baseURL: localhost:8080
```
### Get wallet balance
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
```JSON
{
"Balance": "800",
"Wallet_ID": 42
}
```
### Update Balance With Credit
In this case Send Credit from wallet
```
POST {{baseURL}}/api/v1/wallets/{wallet_id}/credit
```
The Body Type is JSON format:
```JSON
{
"Amount": 10
}
```
The responce is like:
```JSON
{
"Balance": "450",
"Credit": "10",
"Wallet_ID": 30
}
```
### Update Balance With Debit
In this case Take Debit from another wallet
```
POST {{baseURL}}/api/v1/wallets/{wallet_id}/debit
```
The Body Type is JSON format:
```JSON
{
"Amount": 10
}
```
The responce is like:
```JSON
{
"Balance": "460",
"Credit": "10",
"Wallet_ID": 30
}
```
## Library
Used Library
[HTTP](https://github.com/gin-gonic/gin) : Gin is a web framework written in Go (Golang)
[GORM](https://github.com/go-gorm/gorm) : The fantastic ORM library for Golang, aims to be developer friendly.
[Decimal](https://github.com/shopspring/decimal) :Arbitrary-precision fixed-point decimal numbers in go.
## Licanse
Apache-2.0 License
近期下载者:
相关文件:
收藏者: