wallet

package
v0.0.0-...-fb81480 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package wallet provides functionality related to user wallets, including balance retrieval, deposits, and withdrawals.

Index

Constants

This section is empty.

Variables

View Source
var SupportCurrency = map[string]struct{}{"USD": {}, "RUB": {}, "EUR": {}}

SupportCurrency defines a set of supported currencies for deposit and withdrawal operations.

Functions

This section is empty.

Types

type MainAPI

type MainAPI interface {
	// GetBalance retrieves the balance for a user in multiple currencies.
	GetBalance(userId int) (*model.Currency, error)

	// Deposit adds funds to the user's wallet.
	Deposit(dep *model.Operation) (float64, error)

	// Withdraw removes funds from the user's wallet.
	Withdraw(with *model.Operation) (float64, error)
}

MainAPI defines the core wallet operations: retrieving balance, depositing funds, and withdrawing funds.

type Wallet

type Wallet struct {
	MainAPI
}

Wallet represents a wallet service that implements the MainAPI interface.

func New

func New(db database.DataBase) *Wallet

New creates and returns a new instance of Wallet with the given database connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL