evolution

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: 19 Imported by: 0

Documentation

Overview

Package evolution contains the provider implementation for Evolution games with wallet api and user authentication.

Index

Constants

View Source
const (
	G0  = "G.0"  // Could not authenticate, please review sent data and try again. If problem persists, contact customer support 	System error, should be retried, in case of constant occurrences should be reported to Evolution.
	G1  = "G.1"  // Unknown casino $casinoKey will be provided by Evolution.
	G2  = "G.2"  // Provided $apiToken for casino $casinoKey is incorrect $apiToken will be provided by Evolution.
	G3  = "G.3"  // Player session creation is not configured for casino $casinoKey $apiToken have not been configured on Evolution side.
	G4  = "G.4"  // Unable to issue token System error, should be retried, in case of constant occurrences should be reported to Evolution.
	G5  = "G.5"  // Unable to authenticate user System error, should be retried, in case of constant occurrences should be reported to Evolution.
	G6  = "G.6"  // Unable to create user System error, should be retried, in case of constant occurrences should be reported to Evolution.
	G7  = "G.7"  // Unable to save player data System error, should be retried, in case of constant occurrences should be reported to Evolution.
	G8  = "G.8"  // Unable to authenticate user due to: $status Most likely client system returned invalid $status.
	G9  = "G.9"  // Clients IP address have been rejected Provided to evolution client IP address for white listing is incorrect.
	G10 = "G.10" // Only http:// or https:// or native:// or app:// URL schemes are supported if 'config.channel.wrapped' is false Custom URL schemes are only supported for wrapped requests.
	G11 = "G.11" // Misconfiguration Can't launch the game with table id $tableId due to a misconfiguration. Please, contact customer support. Reference No - $refNumber
)

Generic error codes

View Source
const (
	ProviderName = "evolution"
)

Variables

View Source
var (
	StatusOK                 = statusCode{"OK", http.StatusOK}                         // Success
	StatusTemporaryError     = statusCode{"TEMPORARY_ERROR", http.StatusOK}            // There is a temporary problem with the game server.
	StatusUnknownError       = statusCode{"UNKNOWN_ERROR", http.StatusOK}              // Please contact Customer Support for assistance.
	StatusInvalidSID         = statusCode{"INVALID_SID", http.StatusOK}                // There has been a problem with the Live Casino. User authentication failed or your session may be expired, please close the browser and try again. Error Code: EV01
	StatusInsufficientFunds  = statusCode{"INSUFFICIENT_FUNDS", http.StatusOK}         // You do not have sufficient funds to place this bet.
	StatusInvalidTokenID     = statusCode{"INVALID_TOKEN_ID", http.StatusUnauthorized} // There has been a problem with the Live Casino. User authentication failed or your session may be expired, please close the browser and try again. Error Code: EV01
	StatusInvalidParameter   = statusCode{"INVALID_PARAMETER", http.StatusOK}          // Please contact Customer Support for assistance.
	StatusBetAlreadySettled  = statusCode{"BET_ALREADY_SETTLED", http.StatusOK}        // Success 	Bet has been already settled in third party system.
	StatusBetDoesNotExist    = statusCode{"BET_DOES_NOT_EXIST", http.StatusOK}         // Please contact Customer Support for assistance.
	StatusOperationInProcess = statusCode{"OPERATION_IN_PROCESS", 200}                 // Retryable Error 	Transaction is being process and no result is currently available.
)

Functions

func NewAPITokenValidator

func NewAPITokenValidator(apiTokenParamName, apiToken string) fiber.Handler

func NewOperatorRouter

func NewOperatorRouter(config configs.ProviderConf, httpClient rest.HTTPClientJSONInterface) (*provider.Router, error)

func NewProviderRouter

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

Types

type Amount

type Amount pam.Amt

Amount alias for use in evolution integration providing primarily custom wire format

var ZeroAmount Amount = Amount(pam.Zero)

func (Amount) Equal

func (a Amount) Equal(b Amount) bool

func (*Amount) MarshalJSON

func (m *Amount) MarshalJSON() ([]byte, error)

func (*Amount) UnmarshalJSON

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

type AuthConf

type AuthConf struct {
	APIKey      string `mapstructure:"api_key"`
	CasinoToken string `mapstructure:"casino_token"`
	CasinoKey   string `mapstructure:"casino_key,omitempty"`
}

AuthConf Evolution specific Auth configuration from valkyrie config file

func GetAuthConf

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

GetAuthConf parse provider specific auth configuration

type BalanceRequest

type BalanceRequest struct {
	RequestBase
	Game     interface{} `json:"game"`
	Currency string      `json:"currency" validate:"required,len=3"`
}

type CancelRequest

type CancelRequest struct {
	RequestBase
	Transaction Transaction `json:"transaction"`
	Currency    string      `json:"currency" validate:"required,len=3"`
	Game        Game        `json:"game" validate:"required"`
}

type CheckRequest

type CheckRequest struct {
	RequestBase
	Channel struct {
		Type string `json:"type"`
	} `json:"channel"`
}

type CheckResponse

type CheckResponse struct {
	Status string `json:"status"`
	SID    string `json:"sid"`
	UUID   string `json:"uuid"`
}

type Config

type Config struct {
	Urls    ConfigUrls    `json:"urls"`
	Brand   ConfigBrand   `json:"brand"`
	Game    ConfigGame    `json:"game,omitempty"`
	Channel ConfigChannel `json:"channel" validate:"required"`
}

type ConfigBrand

type ConfigBrand struct {
	ID   string `json:"id"`
	Skin string `json:"skin"`
}

type ConfigChannel

type ConfigChannel struct {
	Wrapped bool `json:"wrapped" validate:"required"`
	Mobile  bool `json:"mobile,omitempty"`
}

type ConfigGame

type ConfigGame struct {
	Category  string      `json:"category,omitempty"`
	Interface string      `json:"interface,omitempty"`
	PlayMode  string      `json:"playMode,omitempty"`
	Table     ConfigTable `json:"table"`
}

type ConfigTable

type ConfigTable struct {
	ID   string `json:"id" validate:"required"`
	Seat int    `json:"seat,omitempty"`
}

type ConfigUrls

type ConfigUrls struct {
	Cashier            string `json:"cashier,omitempty"`
	ResponsibleGaming  string `json:"responsibleGaming,omitempty"`
	Lobby              string `json:"lobby,omitempty"`
	SessionTimeout     string `json:"sessionTimeout,omitempty"`
	GameHistory        string `json:"gameHistory,omitempty"`
	RealityCheckURL    string `json:"realityCheckURL,omitempty"`
	RngGoLiveURL       string `json:"rngGoLiveURL,omitempty"`
	RngGoLiveURLMobile string `json:"rngGoLiveURLMobile,omitempty"`
	RngLobbyButton     string `json:"rngLobbyButton,omitempty"`
	RngCloseButton     string `json:"rngCloseButton,omitempty"`
	RngHomeButton      string `json:"rngHomeButton,omitempty"`
	RngSessionTimeout  string `json:"rngSessionTimeout,omitempty"`
	RngErrorHandling   string `json:"rngErrorHandling,omitempty"`
	SweSelfTest        string `json:"sweSelfTest,omitempty"`
	SweGameLimits      string `json:"sweSelfGameLimits,omitempty"`
	SweSelfExclusion   string `json:"sweSelfExclusion,omitempty"`
}

type Controller

type Controller interface {
	Check(c *fiber.Ctx) error
	Balance(c *fiber.Ctx) error
	Debit(c *fiber.Ctx) error
	Credit(c *fiber.Ctx) error
	Cancel(c *fiber.Ctx) error
	PromoPayout(c *fiber.Ctx) error
}

type CreditRequest

type CreditRequest struct {
	RequestBase
	Currency    string      `json:"currency" validate:"required,len=3"`
	Game        Game        `json:"game" validate:"required"`
	Transaction Transaction `json:"transaction" validate:"required"`
}

type DebitRequest

type DebitRequest struct {
	RequestBase
	Currency    string      `json:"currency" validate:"required,len=3"`
	Game        Game        `json:"game" validate:"required"`
	Transaction Transaction `json:"transaction" validate:"required"`
}

type Error

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

type EvoService added in v0.6.0

type EvoService struct {
	Client rest.HTTPClientJSONInterface
	Conf   *configs.ProviderConf
	Auth   AuthConf
}

func (EvoService) GameLaunch added in v0.6.0

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

func (EvoService) GetGameRoundRender added in v0.6.0

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

type Game

type Game struct {
	ID      string `json:"id"`
	Type    string `json:"type"`
	Details GameDetails
}

type GameDetails

type GameDetails struct {
	Table GameTable `json:"table"`
}

type GameTable

type GameTable struct {
	ID  string `json:"id"`
	Vid string `json:"vid"`
}

type Group

type Group struct {
	ID     string `json:"id"`
	Action string `json:"action" validate:"required"`
}

type Player

type Player struct {
	Group     *Group  `json:"group,omitempty"`
	Session   Session `json:"session" validate:"required"`
	ID        string  `json:"id" validate:"required"`
	FirstName string  `json:"firstName"`
	LastName  string  `json:"lastName"`
	Nickname  string  `json:"nickname,omitempty"`
	Country   string  `json:"country" validate:"required,len=2"`
	Language  string  `json:"language" validate:"required,len=2"`
	Currency  string  `json:"currency" validate:"required,len=3"`
	Update    bool    `json:"update" validate:"required"`
}

type PromoPayoutRequest

type PromoPayoutRequest struct {
	RequestBase
	Currency         string           `json:"currency" validate:"required,len=3"`
	Game             Game             `json:"game" validate:"required"`
	PromoTransaction PromoTransaction `json:"promoTransaction"`
}

type PromoTransaction

type PromoTransaction struct {
	Type            string `json:"type"`
	ID              string `json:"id"`
	Amount          Amount `json:"amount"`
	VoucherID       string `json:"voucherId"`
	RemainingRounds int    `json:"remainingRounds"`
}

type ProviderController

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

func NewProviderController

func NewProviderController(service Service) *ProviderController

func (ProviderController) Balance

func (controller ProviderController) Balance(c *fiber.Ctx) error

func (ProviderController) Cancel

func (controller ProviderController) Cancel(c *fiber.Ctx) error

func (ProviderController) Check

func (controller ProviderController) Check(c *fiber.Ctx) error

func (ProviderController) Credit

func (controller ProviderController) Credit(c *fiber.Ctx) error

func (ProviderController) Debit

func (controller ProviderController) Debit(c *fiber.Ctx) error

func (ProviderController) PromoPayout

func (controller ProviderController) PromoPayout(c *fiber.Ctx) error

type ProviderError

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

func (ProviderError) Error

func (e ProviderError) Error() string

type RequestBase

type RequestBase struct {
	SID    string `json:"sid" validate:"required"`
	UserID string `json:"userId" validate:"required"`
	UUID   string `json:"uuid,omitempty"`
}

type Service

type Service interface {
	Check(req CheckRequest) (*CheckResponse, error)
	Balance(req BalanceRequest) (*StandardResponse, error)
	Debit(req DebitRequest) (*StandardResponse, error)
	Credit(req CreditRequest) (*StandardResponse, error)
	Cancel(req CancelRequest) (*StandardResponse, error)
	PromoPayout(req PromoPayoutRequest) (*StandardResponse, error)
	WithContext(ctx context.Context) Service
}

type Session

type Session struct {
	ID string `json:"id" validate:"required"`
	IP string `json:"ip" validate:"required"`
}

type StandardResponse

type StandardResponse struct {
	Status         string `json:"status" validate:"required"`
	Balance        Amount `json:"balance" validate:"required"`
	Bonus          Amount `json:"bonus"`
	UUID           string `json:"uuid,omitempty"`
	Retransmission bool   `json:"retransmission,omitempty"`
}

type Transaction

type Transaction struct {
	ID     string `json:"id"`
	RefID  string `json:"refId"`
	Amount Amount `json:"amount"`
}

type UserAuthenticationErrorResponse

type UserAuthenticationErrorResponse struct {
	Errors []Error `json:"errors"`
}

type UserAuthenticationRequest

type UserAuthenticationRequest struct {
	UUID   string `json:"uuid" validate:"required"`
	Player Player `json:"player" validate:"required"`
	Config Config `json:"config" validate:"required"`
}

UserAuthenticationRequest Evo user authentication

type UserAuthenticationResponse

type UserAuthenticationResponse struct {
	Entry         string `json:"entry,omitempty"`
	EntryEmbedded string `json:"entryEmbedded,omitempty"`
}

type WalletService added in v0.6.0

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

func NewService

func NewService(pamClient pam.PamClient) *WalletService

func (*WalletService) Balance added in v0.6.0

func (service *WalletService) Balance(req BalanceRequest) (*StandardResponse, error)

@Id EvoBalance @Summary Balance @Description Used to get user’s balance. @Tags Evolution @Accept json @Produce json @Param req body BalanceRequest true "Request body" @Param authToken query string true "Api token" @Success 200 {object} StandardResponse @Failure 400 {object} StandardResponse @Failure 500 {object} StandardResponse @Router /providers/evolution/balance [post]

func (*WalletService) Cancel added in v0.6.0

func (service *WalletService) Cancel(req CancelRequest) (*StandardResponse, error)

@Id EvoCancel @Summary Cancel @Description Used to cancel user’s bet. @Tags Evolution @Accept json @Produce json @Param req body CancelRequest true "Request body" @Param authToken query string true "Api token" @Success 200 {object} StandardResponse @Failure 400 {object} StandardResponse @Failure 500 {object} StandardResponse @Router /providers/evolution/cancel [post]

func (*WalletService) Check added in v0.6.0

func (service *WalletService) Check(req CheckRequest) (*CheckResponse, error)

@Id EvoCheck @Summary Check @Description Should be used for additional validation of redirected user and sid. @Tags Evolution @Accept json @Produce json @Param req body CheckRequest true "Request body" @Param authToken query string true "Api token" @Success 200 {object} CheckResponse @Failure 400 {object} StandardResponse @Failure 500 {object} StandardResponse @Router /providers/evolution/check [post]

func (*WalletService) Credit added in v0.6.0

func (service *WalletService) Credit(req CreditRequest) (*StandardResponse, error)

@Id EvoCredit @Summary Credit @Description Used to credit user’s account (settle bets). @Tags Evolution @Accept json @Produce json @Param req body CreditRequest true "Request body" @Param authToken query string true "Api token" @Success 200 {object} StandardResponse @Failure 400 {object} StandardResponse @Failure 500 {object} StandardResponse @Router /providers/evolution/credit [post]

func (*WalletService) Debit added in v0.6.0

func (service *WalletService) Debit(req DebitRequest) (*StandardResponse, error)

@Id EvoDebit @Summary Debit @Description Used to debit from account (place bets). @Tags Evolution @Accept json @Produce json @Param req body DebitRequest true "Request body" @Param authToken query string true "Api token" @Success 200 {object} StandardResponse @Failure 400 {object} StandardResponse @Failure 500 {object} StandardResponse @Router /providers/evolution/debit [post]

func (*WalletService) PromoPayout added in v0.6.0

func (service *WalletService) PromoPayout(req PromoPayoutRequest) (*StandardResponse, error)

@Id EvoPromoPayout @Summary PromoPayout @Description Used to communicate promotional payout transactions. @Tags Evolution @Accept json @Produce json @Param req body PromoPayoutRequest true "Request body" @Param authToken query string true "Api token" @Success 200 {object} StandardResponse @Failure 400 {object} StandardResponse @Failure 500 {object} StandardResponse @Router /providers/evolution/promo_payout [post]

func (*WalletService) WithContext added in v0.6.0

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

Jump to

Keyboard shortcuts

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