redtiger

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package redtiger contains the provider implementation for Red Tiger games with wallet api and user authentication.

Index

Constants

View Source
const (
	ProviderName = "redtiger"
)

Variables

This section is empty.

Functions

func NewOperatorRouter

func NewOperatorRouter(config configs.ProviderConf) *provider.Router

NewOperatorRouter Routes operator calls to execute actions toward the provider

func NewProviderRouter

func NewProviderRouter(config configs.ProviderConf, controller Controller) (*provider.Router, error)

Types

type AuthConf

type AuthConf struct {
	APIKey     string `mapstructure:"api_key"`
	ReconToken string `mapstructure:"recon_token,omitempty"`
}

AuthConf Redtiger specific Auth configuration from valkyrie config file

func GetAuthConf

func GetAuthConf(c configs.ProviderConf) (AuthConf, error)

GetAuthConf parse provider specific auth configuration

type AuthRequest

type AuthRequest struct {
	BaseRequest
	Channel   string `json:"channel,omitempty" validate:"max=8"`
	Affiliate string `json:"affiliate,omitempty" validate:"max=255"`
	Extras    string `json:"extras,omitempty"`
}

RT auth request

type AuthResponse

type AuthResponse struct {
	BaseResponse
	UserID   string  `json:"userId" validate:"max=32"`
	Casino   string  `json:"casino" validate:"max=50"`
	Country  string  `json:"country" validate:"len=2"`
	Language string  `json:"language" validate:"max=6" `
	Balance  Balance `json:"balance"`
}

RT auth result object

type AuthResponseWrapper

type AuthResponseWrapper struct {
	Error   *Error       `json:"error,omitempty"`
	Result  AuthResponse `json:"result,omitempty"`
	Success bool         `json:"success"`
}

RT auth response

type Balance

type Balance struct {
	Cash  Money `json:"cash"`
	Bonus Money `json:"bonus"`
}

RT balance object

type BaseRequest

type BaseRequest struct {
	Token    string `json:"token" validate:"required,min=32,max=128"`
	UserID   string `json:"userId" validate:"max=36"`
	Casino   string `json:"casino" validate:"max=50"`
	Currency string `json:"currency" validate:"max=8"`
	IP       string `json:"ip"`
}

RT base request and response

type BaseResponse

type BaseResponse struct {
	Token    string `json:"token" validate:"min=32,max=128"`
	Currency string `json:"currency" validate:"max=8"`
}

type Controller

type Controller interface {
	Auth(c *fiber.Ctx) error
	Stake(c *fiber.Ctx) error
	Payout(c *fiber.Ctx) error
	Refund(c *fiber.Ctx) error
	PromoBuyin(c *fiber.Ctx) error
	PromoSettle(c *fiber.Ctx) error
	PromoRefund(c *fiber.Ctx) error
}

type Error

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

type ErrorResponse

type ErrorResponse struct {
	Error   Error `json:"error"`
	Success bool  `json:"success"`
}

RT error response

type Game

type Game struct {
	Type    string `json:"type"`
	Key     string `json:"key" validate:"max=128"`
	Version string `json:"version" validate:"max=128"`
}

type GameLaunchRequest

type GameLaunchRequest struct {
	Token      string `url:"token"`
	Currency   string `url:"currency,omitempty"`
	UserID     string `url:"userId,omitempty"`
	LobbyURL   string `url:"lobbyUrl,omitempty"`
	DepositURL string `url:"depositUrl,omitempty"`
	Affiliate  string `url:"affiliate,omitempty"`
	Channel    string `url:"channel,omitempty"`
	Casino     string `url:"casino,omitempty"`
}

type Jackpot

type Jackpot struct {
	Group        string   `json:"group" validate:"max=100"`
	Contribution string   `json:"contribution"`
	Pots         []string `json:"pots"`
}

type JackpotMoney

type JackpotMoney pam.Amt

func (JackpotMoney) Equal

func (m JackpotMoney) Equal(b JackpotMoney) bool

func (JackpotMoney) MarshalJSON

func (m JackpotMoney) MarshalJSON() ([]byte, error)

func (*JackpotMoney) UnmarshalJSON

func (m *JackpotMoney) UnmarshalJSON(data []byte) error

type Money

type Money pam.Amt

func (Money) Equal

func (m Money) Equal(b Money) bool

func (Money) MarshalJSON

func (m Money) MarshalJSON() ([]byte, error)

func (*Money) UnmarshalJSON

func (m *Money) UnmarshalJSON(data []byte) error

type PayoutDetails

type PayoutDetails struct {
	Game    Money        `json:"game"`
	Jackpot JackpotMoney `json:"jackpot"`
}

type PayoutRequest

type PayoutRequest struct {
	BaseRequest
	Transaction TransactionPayout `json:"transaction"`
	Game        Game              `json:"game"`
	Jackpot     Jackpot           `json:"jackpot"`
	Round       Round             `json:"round"`
	Promo       Promo             `json:"promo"`
	Retry       bool              `json:"retry"`
}

RT payout stuff

type PayoutResponse

type PayoutResponse struct {
	BaseResponse
	ID      string  `json:"id"`
	Payout  Balance `json:"payout"`
	Balance Balance `json:"balance"`
}

type PayoutResponseWrapper

type PayoutResponseWrapper struct {
	Error  *Error         `json:"error,omitempty"`
	Result PayoutResponse `json:"result,omitempty"`
	Response
}

type Promo

type Promo struct {
	Type         string `json:"type"`
	InstanceCode string `json:"instanceCode" validate:"max=64"`
	CampaignCode string `json:"campaignCode" validate:"max=64"`
	InstanceID   int    `json:"instanceId"`
	CampaignID   int    `json:"campaignId"`
}

type ProviderController

type ProviderController struct {
	// contains filtered or unexported fields
}

func NewProviderController

func NewProviderController(service Service) *ProviderController

func (*ProviderController) Auth

func (ctrl *ProviderController) Auth(c *fiber.Ctx) error

Auth handler function

func (*ProviderController) Payout

func (ctrl *ProviderController) Payout(c *fiber.Ctx) error

Payout handler function

func (*ProviderController) PromoBuyin

func (ctrl *ProviderController) PromoBuyin(c *fiber.Ctx) error

PromoBuyin handler function

func (*ProviderController) PromoRefund

func (ctrl *ProviderController) PromoRefund(c *fiber.Ctx) error

PromoRefund handler function

func (*ProviderController) PromoSettle

func (ctrl *ProviderController) PromoSettle(c *fiber.Ctx) error

PromoSettle handler function

func (*ProviderController) Refund

func (ctrl *ProviderController) Refund(c *fiber.Ctx) error

Refund handler function

func (*ProviderController) Stake

func (ctrl *ProviderController) Stake(c *fiber.Ctx) error

Stake handler function

type RTErrorCode

type RTErrorCode int
const (
	APIAuthError         RTErrorCode = 100
	InvalidInput         RTErrorCode = 200
	GenericError         RTErrorCode = 201
	NotAuthorized        RTErrorCode = 301
	UserNotFound         RTErrorCode = 302
	BannedUser           RTErrorCode = 303
	InsufficientFunds    RTErrorCode = 304
	InvalidUserCurrency  RTErrorCode = 305
	UserLimitedPlaying   RTErrorCode = 306
	TransactionNotFound  RTErrorCode = 400
	DuplicateTransaction RTErrorCode = 401
	InternalServerError  RTErrorCode = 500
	UnderMaintenanceMode RTErrorCode = 501
)

type RedTigerService added in v0.6.0

type RedTigerService struct {
	Conf *configs.ProviderConf
}

func (RedTigerService) GameLaunch added in v0.6.0

func (service RedTigerService) GameLaunch(_ *fiber.Ctx, g *provider.GameLaunchRequest,
	h *provider.GameLaunchHeaders) (string, error)

func (RedTigerService) GetGameRoundRender added in v0.6.0

func (service RedTigerService) GetGameRoundRender(*fiber.Ctx, provider.GameRoundRenderRequest) (string, error)

type RefundRequest

type RefundRequest struct {
	BaseRequest
	Transaction TransactionStake `json:"transaction"`
	Game        Game             `json:"game"`
	Round       Round            `json:"round"`
	Promo       Promo            `json:"promo"`
}

RT refund stuff

type RefundResponseWrapper

type RefundResponseWrapper struct {
	Error    *Error       `json:"error,omitempty"`
	Result   RefundResult `json:"result,omitempty"`
	Balance  Balance      `json:"balance"`
	Currency string       `json:"currency"`
	Response
}

type RefundResult

type RefundResult struct {
	Token string  `json:"token"`
	ID    string  `json:"id"`
	Stake Balance `json:"stake"`
}

type Response

type Response struct {
	Success bool `json:"success"`
}

type Round

type Round struct {
	ID     string `json:"id" validate:"max=32"`
	Starts bool   `json:"starts"`
	Ends   bool   `json:"ends"`
}

type Sources

type Sources struct {
	Jackpot  map[string]JackpotMoney `json:"jackpot"`
	Lines    Money                   `json:"lines"`
	Features Money                   `json:"features"`
}

type StakeDetails

type StakeDetails struct {
	Game    Money `json:"game"`
	Jackpot Money `json:"jackpot"`
}

type StakeRequest

type StakeRequest struct {
	BaseRequest
	Transaction TransactionStake `json:"transaction"`
	Game        Game             `json:"game"`
	Round       Round            `json:"round"`
	Promo       Promo            `json:"promo,omitempty"`
}

type StakeResponse

type StakeResponse struct {
	BaseResponse
	ID      string  `json:"id"`
	Stake   Balance `json:"stake"`
	Balance Balance `json:"balance"`
}

type StakeResponseWrapper

type StakeResponseWrapper struct {
	Error  *Error        `json:"error,omitempty"`
	Result StakeResponse `json:"result,omitempty"`
	Response
}

type TransactionPayout

type TransactionPayout struct {
	Sources     Sources       `json:"sources"`
	Details     PayoutDetails `json:"details"`
	ID          string        `json:"id" validate:"max=32"`
	Payout      Money         `json:"payout" validate:"min=0"`
	PayoutPromo Money         `json:"payoutPromo" validate:"min=0"`
}

type TransactionStake

type TransactionStake struct {
	ID         string       `json:"id" validate:"max=32"`
	Stake      Money        `json:"stake"`
	StakePromo Money        `json:"stakePromo"`
	Details    StakeDetails `json:"details"`
}

type WalletService added in v0.6.0

type WalletService struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(pamClient pam.PamClient) *WalletService

NewService Create new red tiger provider service

func (*WalletService) Auth added in v0.6.0

Auth implements Service @Id RTAuth @Summary Auth @Description Authenticate toward Red tiger. @Tags Red Tiger @Accept json @Produce json @Param req body AuthRequest true "Request body" @Param Authorization header string true "API Key" @Success 200 {object} AuthResponseWrapper @Failure 400 {object} ErrorResponse @Router /providers/redtiger/auth [post]

func (*WalletService) Payout added in v0.6.0

Payout implements Service @Id RTPayout @Summary Payout @Description When a bet settles with a payout (credit). @Tags Red Tiger @Accept json @Produce json @Param req body PayoutRequest true "Request body" @Param Authorization header string true "API Key" @Success 200 {object} PayoutResponseWrapper @Failure 400 {object} ErrorResponse @Router /providers/redtiger/payout [post]

func (*WalletService) PromoBuyin added in v0.6.0

PromoBuyin implements Service @Id RTPromoBuyin @Summary PromoBuyin @Description Promotion buyin, request the same as stake/bet. @Tags Red Tiger @Accept json @Produce json @Param req body StakeRequest true "Request body" @Param Authorization header string true "API Key" @Success 200 {object} StakeResponseWrapper @Failure 400 {object} ErrorResponse @Router /providers/redtiger/promo/buyin [post]

func (*WalletService) PromoRefund added in v0.6.0

PromoRefund implements Service @Id RTPromoRefund @Summary PromoRefund @Description Refund promotion buyin. @Tags Red Tiger @Accept json @Produce json @Param req body RefundRequest true "Request body" @Param Authorization header string true "API Key" @Success 200 {object} RefundResponseWrapper @Failure 400 {object} ErrorResponse @Router /providers/redtiger/promo/refund [post]

func (*WalletService) PromoSettle added in v0.6.0

PromoSettle implements Service @Id RTPromoSettle @Summary PromoSettle @Description Promotion settlement for a placed buyin. @Tags Red Tiger @Accept json @Produce json @Param req body PayoutRequest true "Request body" @Param Authorization header string true "API Key" @Success 200 {object} PayoutResponseWrapper @Failure 400 {object} ErrorResponse @Router /providers/redtiger/promo/settle [post]

func (*WalletService) Refund added in v0.6.0

Refund implements Service @Id RTRefund @Summary Refund @Description Used to refund a placed bet. @Tags Red Tiger @Accept json @Produce json @Param req body RefundRequest true "Request body" @Param Authorization header string true "API Key" @Success 200 {object} RefundResponseWrapper @Failure 400 {object} ErrorResponse @Router /providers/redtiger/refund [post]

func (*WalletService) Stake added in v0.6.0

Stake implements Service @Id RTStake @Summary Stake @Description When a bet has been placed (debit). @Tags Red Tiger @Accept json @Produce json @Param req body StakeRequest true "Request body" @Param Authorization header string true "API Key" @Success 200 {object} StakeResponseWrapper @Failure 400 {object} ErrorResponse @Router /providers/redtiger/stake [post]

func (*WalletService) WithContext added in v0.6.0

func (s *WalletService) WithContext(ctx context.Context) Service

Jump to

Keyboard shortcuts

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