Skip to content

Latest commit

 

History

History
96 lines (81 loc) · 1.75 KB

README.md

File metadata and controls

96 lines (81 loc) · 1.75 KB

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

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)

Build or Run it

For building

go build ./

Or Runing

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

{
    "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:

{
    "Amount": 10
}

The responce is like:

{
    "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:

{
    "Amount": 10
}

The responce is like:

{
    "Balance": "460",
    "Credit": "10",
    "Wallet_ID": 30
}

Library

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.

Licanse

Apache-2.0 License