controllers

package
v0.0.0-...-7b078d6 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DepositRequest

type DepositRequest struct {
	Currency string          `json:"currency" binding:"required,currency"`
	Amount   decimal.Decimal `json:"amount" binding:"required,positive_decimal"`
}

DepositRequest represents the incoming request body for deposit operations

type GetBalancesQuery

type GetBalancesQuery struct {
	Currencies []string `form:"currency" binding:"required,currency_limit"` // List of currencies to filter by
}

GetBalancesQuery represents the incoming request body for balance retrieval

type GetTransactionHistoryQuery

type GetTransactionHistoryQuery struct {
	Type   string `form:"type,omitempty" binding:"omitempty,oneof=deposit withdrawal transfer_out transfer_in"` // Filter by transaction type (e.g., "deposit", "withdrawal")
	Cursor string `form:"cursor,omitempty"`                                                                     // Encoded cursor for keyset pagination
	Limit  int    `form:"limit,omitempty" binding:"min=0,max=50"`                                               // Number of records to fetch
	Order  string `form:"order,omitempty" binding:"omitempty,oneof=asc desc"`                                   // Sort order (e.g., "asc", "desc")
}

GetTransactionHistoryRequest represents the request for retrieving paginated transaction history with filters

type GetTransactionHistoryResponse

type GetTransactionHistoryResponse struct {
	Transactions []models.Transaction `json:"transactions"` // Array of transaction objects
	NextCursor   string               `json:"next_cursor"`  // Encoded cursor for next page
}

GetTransactionHistoryResponse represents the response for paginated transaction history

type TransferRequest

type TransferRequest struct {
	Recipient string          `json:"recipient" binding:"required"`
	Currency  string          `json:"currency" binding:"required,currency"`
	Amount    decimal.Decimal `json:"amount" binding:"required,positive_decimal"`
	Memo      string          `json:"memo,omitempty"`
}

TransferRequest represents the incoming request body for transfer operations

type WalletController

type WalletController struct {
	WalletService services.IWalletService
	UserService   services.IUserService
}

func NewWalletController

func NewWalletController(wallet services.IWalletService, user services.IUserService) *WalletController

func (*WalletController) Deposit

func (ctrl *WalletController) Deposit(c *gin.Context)

POST /deposit

func (*WalletController) GetBalances

func (ctrl *WalletController) GetBalances(c *gin.Context)

GET /balances

func (*WalletController) GetTransactionHistory

func (ctrl *WalletController) GetTransactionHistory(c *gin.Context)

GET /transactions

func (*WalletController) Transfer

func (ctrl *WalletController) Transfer(c *gin.Context)

POST /transfer

func (*WalletController) Withdraw

func (ctrl *WalletController) Withdraw(c *gin.Context)

POST /withdraw

type WithdrawRequest

type WithdrawRequest DepositRequest

WithdrawRequest represents the incoming request body for withdrawal operations

Jump to

Keyboard shortcuts

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