webhook

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ErrUnknown                 = 1000
	ErrInvalidRequest          = 1034
	ErrTenantFailed            = 1035
	ErrInternalServerError     = 1200
	ErrInvalidTenantID         = 1204
	ErrInvalidTenantApiKey     = 1205
	ErrInvalidPlayerSession    = 1300
	ErrEmptyPlayerSession      = 1301
	ErrServerErrorOccurs       = 1303
	ErrInvalidPlayer           = 1305
	ErrPlayerBlocked           = 1306
	ErrExpiredPlayerSession    = 1308
	ErrPlayerInactive          = 1309
	ErrVerifyFailed            = 1310
	ErrPlayerInProgress        = 1315
	ErrGameIsUnderMaintenance  = 1400
	ErrGameIsInactive          = 1401
	ErrInvalidGameID           = 1402
	ErrValueCannotBeNull       = 3001
	ErrPlayerDoesNotExist      = 3004
	ErrNoBetExists             = 3021
	ErrBetAlreadyPayout        = 3022
	ErrBetAlreadyExisted       = 3032
	ErrBetFailed               = 3033
	ErrPayoutFailed            = 3034
	ErrTransactionDoesNotExist = 3040
	ErrInvalidCurrency         = 3206
	ErrInsufficient            = 3202
)
View Source
const (
	Authorization      = "Authorization"
	XApiKey            = "x-api-key"
	XTenantId          = "x-tenant-id"
	XTenantPlayerToken = "x-tenant-player-token"
	XTenantPlayerId    = "x-tenant-player-id"
	XGameId            = "x-game-id"
	XRequestId         = "x-request-id"
)

Variables

This section is empty.

Functions

func HandleBet

func HandleBet(mux *mux.Router, handler Bet)

func HandleCancel added in v0.0.20

func HandleCancel(mux *mux.Router, handler Cancel)

func HandleGetWallet

func HandleGetWallet(mux *mux.Router, handler GetWallet)

func HandlePayout

func HandlePayout(mux *mux.Router, handler Payout)

func HandleRefund

func HandleRefund(mux *mux.Router, handler Refund)

func HandleRollback

func HandleRollback(mux *mux.Router, handler Rollback)

func HandleVerifyPlayer

func HandleVerifyPlayer(mux *mux.Router, handler VerifyPlayer)

Types

type Bet

type Bet func(ctx context.Context, request *BetRequest) (*TransactionReply, error)

type BetRequest added in v0.0.14

type BetRequest struct {
	Header *HookRequestHeader `json:"header,omitempty"`

	TxId      string  `json:"tx_id"`
	RefTxId   string  `json:"ref_tx_id"`
	SessionId string  `json:"session_id"`
	Currency  string  `json:"currency"`
	Amount    float64 `json:"amount"`
}

type Cancel added in v0.0.20

type Cancel func(ctx context.Context, request *CancelRequest) (*TransactionReply, error)

type CancelRequest added in v0.0.20

type CancelRequest struct {
	Header *HookRequestHeader `json:"header,omitempty"`

	TxId      string `json:"tx_id"`
	RefTxId   string `json:"ref_tx_id"`
	SessionId string `json:"session_id"`
	Currency  string `json:"currency"`
}

type Error

type Error struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

type GetWallet

type GetWallet func(ctx context.Context, request *GetWalletRequest) (*GetWalletReply, error)

wallet

type GetWalletReply

type GetWalletReply struct {
	Data  *PlayerWallet `json:"data"`
	Error *Error        `json:"error"`
}

type GetWalletRequest

type GetWalletRequest struct {
	Header *HookRequestHeader `json:"header"`

	Currency string `json:"currency"`
}

type HTTPError

type HTTPError struct {
	StatusCode int
	Message    string
}

func NewHTTPError

func NewHTTPError(statusCode int, message string) *HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

type HookRequestHeader

type HookRequestHeader struct {
	XApiKey            string `json:"x_api_key,omitempty"`             // x-api-key
	XTenantId          string `json:"x_tenant_id,omitempty"`           // x-tenant-id
	XTenantPlayerToken string `json:"x_tenant_player_token,omitempty"` // x-tenant-player-token
	XTenantPlayerId    string `json:"x_tenant_player_id,omitempty"`    // x-tenant-player-id
	XGameId            string `json:"x_game_id,omitempty"`             // x-game-id
	XRequestId         string `json:"x_request_id,omitempty"`          // x-request-id
}

type Payout

type Payout func(ctx context.Context, request *PayoutRequest) (*TransactionReply, error)

type PayoutRequest added in v0.0.14

type PayoutRequest struct {
	Header *HookRequestHeader `json:"header,omitempty"`

	TxId      string  `json:"tx_id"`
	RefTxId   string  `json:"ref_tx_id"`
	SessionId string  `json:"session_id"`
	Currency  string  `json:"currency"`
	Amount    float64 `json:"amount"`
	// Possible values: [SETTLE, FEATURE, JACKPOT, BONUS_WITHDRAWAL, FREE_WITHDRAWAL]
	PayoutType   string `json:"payout_type"`
	IsEndSession bool   `json:"is_end_session"`
}

type PlayerInfo

type PlayerInfo struct {
	Id       string            `json:"id"`
	Nickname string            `json:"nickname"`
	Avatar   string            `json:"avatar"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

type PlayerWallet

type PlayerWallet struct {
	Currency  string  `json:"currency"`
	Balance   float64 `json:"balance"`
	UpdatedAt int64   `json:"updated_at"`
}

type Refund

type Refund func(ctx context.Context, request *RefundRequest) (*TransactionReply, error)

type RefundRequest added in v0.0.14

type RefundRequest struct {
	Header *HookRequestHeader `json:"header,omitempty"`

	TxId      string  `json:"tx_id"`
	RefTxId   string  `json:"ref_tx_id"`
	SessionId string  `json:"session_id"`
	Currency  string  `json:"currency"`
	Amount    float64 `json:"amount"`
}

type Rollback

type Rollback func(ctx context.Context, request *RollbackRequest) (*TransactionReply, error)

type RollbackRequest added in v0.0.14

type RollbackRequest struct {
	Header *HookRequestHeader `json:"header,omitempty"`

	TxId      string  `json:"tx_id"`
	RefTxId   string  `json:"ref_tx_id"`
	BetTxId   string  `json:"bet_tx_id"`
	SessionId string  `json:"session_id"`
	Currency  string  `json:"currency"`
	Amount    float64 `json:"amount"`
}

type TransactionData

type TransactionData struct {
	TenantTxId      string  `json:"tenant_tx_id"`
	TenantSessionId string  `json:"tenant_session_id"`
	Currency        string  `json:"currency"`
	Amount          float64 `json:"amount"`
	NewBalance      float64 `json:"new_balance"`
	CreatedAt       int64   `json:"created_at"`
}

type TransactionReply

type TransactionReply struct {
	Data  *TransactionData `json:"data"`
	Error *Error           `json:"error"`
}

type VerifyPlayer

type VerifyPlayer func(ctx context.Context, request *VerifyPlayerRequest) (*VerifyPlayerReply, error)

player

type VerifyPlayerReply

type VerifyPlayerReply struct {
	Data  *PlayerInfo `json:"data"`
	Error *Error      `json:"error"`
}

type VerifyPlayerRequest

type VerifyPlayerRequest struct {
	Header *HookRequestHeader `json:"header"`
}

Jump to

Keyboard shortcuts

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