pam

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 pam provides interfaces for communicating with different PAM implementations.

Package pam provides primitives to interact with the openapi HTTP API.

Code generated by github.com/four-fingers/oapi-codegen version v0.0.0-20221219135408-9237c9743c67 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes = "bearerAuth.Scopes"
)

Variables

View Source
var UnsupportedOperation = errors.New("operation not supported by PAM")

UnsupportedOperation Used in implementations when it doesn't support specific PamClient method

View Source
var ZeroAmount = Amount(decimal.Zero)

Functions

func ClientFactory

func ClientFactory() *clientFactory

ClientFactory returns a single instance to the pam client factory

func ErrorWrapper

func ErrorWrapper(msg string, valkErrCode ValkErrorCode, err error) error

ErrorWrapper wrap err in a ValkyrieError if it not already is one

func GetConfig

func GetConfig[T any](c configs.PamConf) (*T, error)

func GetName

func GetName(c configs.PamConf) (string, error)

func ToValkyrieError

func ToValkyrieError(err *PamError) error

ToValkyrieError map PamError to ValkyrieError

Types

type AddTransactionJSONRequestBody

type AddTransactionJSONRequestBody = Transaction

AddTransactionJSONRequestBody defines body for AddTransaction for application/json ContentType.

type AddTransactionParams

type AddTransactionParams struct {
	// Provider Name of the game provider associated with the session
	Provider Provider `form:"provider" json:"provider"`

	// XPlayerToken Player game session identifier
	XPlayerToken SessionToken `json:"X-Player-Token"`

	// XCorrelationID Header for correlating requests between the services for debugging purposes and request tracing. The value will originate from the game providers that support request identification. Otherwise Valkyrie will generate a value.
	XCorrelationID CorrelationId `json:"X-Correlation-ID"`

	// Traceparent Describes the position of the incoming request in its trace graph. Further specified in https://www.w3.org/TR/trace-context
	Traceparent *Traceparent `json:"traceparent,omitempty"`

	// Tracestate Extends traceparent with vendor-specific data represented by a set of name/value pairs. Further specified in https://www.w3.org/TR/trace-context
	Tracestate *Tracestate `json:"tracestate,omitempty"`
}

AddTransactionParams defines parameters for AddTransaction.

type AddTransactionRequest

type AddTransactionRequest struct {
	Params   AddTransactionParams
	Body     AddTransactionJSONRequestBody
	PlayerID PlayerId
}

AddTransactionRequest bundles everything needed to make a request

func (AddTransactionRequest) Traceparent added in v0.5.0

func (r AddTransactionRequest) Traceparent() *Traceparent

func (AddTransactionRequest) Tracestate added in v0.5.0

func (r AddTransactionRequest) Tracestate() *Tracestate

type AddTransactionRequestMapper

type AddTransactionRequestMapper func(AmountRounder) (context.Context, *AddTransactionRequest, error)

AddTransactionRequestMapper Returns context and request used by PAM

type AddTransactionResponse

type AddTransactionResponse struct {
	// Error Error details describing why PAM rejected the request
	Error             *PamError          `json:"error,omitempty"`
	Status            StatusCode         `json:"status"`
	TransactionResult *TransactionResult `json:"transactionResult,omitempty"`
}

AddTransactionResponse defines model for AddTransactionResponse.

type Amount

type Amount Amt

Amount Amount in some currency, rounded to 6 decimal places

func (*Amount) Add

func (m *Amount) Add(v Amount) Amount

func (*Amount) Copy

func (m *Amount) Copy() Amount

func (*Amount) GobDecode

func (m *Amount) GobDecode(bs []byte) error

GobDecode provides custom decoding since gob halts on type aliases

func (Amount) GobEncode

func (m Amount) GobEncode() ([]byte, error)

GobDecode provides custom encoding since gob halts on type aliases

func (Amount) MarshalJSON

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

MarshalJSON provides custom marshall of the Amount type

func (*Amount) Sub added in v0.5.0

func (m *Amount) Sub(v Amount) Amount

func (*Amount) ToAmt

func (m *Amount) ToAmt() Amt

func (*Amount) UnmarshalJSON

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

UnmarshalJSON provides custom unmarshal of the Amount

type AmountRounder

type AmountRounder func(amt Amt) (*Amount, error)

AmountRounder provides rounding requirements and is used for verifying that amounts passed to PAM clients are within acceptable precision.

CheckPrecision rounds the supplied amount to the acceptable precision. If precision will be lost in the process a RoundingError will be returned instead.

var SixDecimalRounder AmountRounder = func(amt Amt) (*Amount, error) {
	orig := decimal.Decimal(amt)
	b := orig.Round(6)
	if !orig.Sub(b).Equal(decimal.Zero) {
		return nil, fmt.Errorf("rounding will result in lost precision %s -> %s", amt, b)
	}
	res := Amount(b)
	return &res, nil
}

type Amt

type Amt decimal.Decimal

Amt is then internal alias for the Decimal type and it is injected into generated model for the Generic PAM. NB: use `Amt` internally instead of the generated pam.Amount

var Zero Amt = Amt(decimal.Zero)

func (Amt) Equal

func (a Amt) Equal(b Amt) bool

func (Amt) String

func (a Amt) String() string

type Balance

type Balance struct {
	// BonusAmount Amount in some currency, rounded to 6 decimal places
	BonusAmount Amount `json:"bonusAmount"`

	// CashAmount Amount in some currency, rounded to 6 decimal places
	CashAmount Amount `json:"cashAmount"`

	// PromoAmount Amount in some currency, rounded to 6 decimal places
	PromoAmount Amount `json:"promoAmount"`
}

Balance player account balance

type BalanceResponse

type BalanceResponse struct {
	// Balance player account balance
	Balance *Balance `json:"balance,omitempty"`

	// Error Error details describing why PAM rejected the request
	Error  *PamError  `json:"error,omitempty"`
	Status StatusCode `json:"status"`
}

BalanceResponse defines model for BalanceResponse.

type BaseResponse

type BaseResponse struct {
	// Error Error details describing why PAM rejected the request
	Error  *PamError  `json:"error,omitempty"`
	Status StatusCode `json:"status"`
}

BaseResponse defines model for BaseResponse.

type BetCode added in v0.5.0

type BetCode = string

BetCode metadata about what kind of bet/transaction it is

type BucketReference

type BucketReference = string

BucketReference Jackpot bucket reference, arbitrary use

type BucketType

type BucketType = string

BucketType Type of jackpot bucket, if any. Arbitrary use

type ClientArgs

type ClientArgs struct {
	Context     context.Context
	Client      rest.HTTPClientJSONInterface
	Config      configs.PamConf
	TraceConfig configs.TraceConfig
	LogConfig   configs.LogConfig
}

ClientArgs composes all arguments required to build a pam client

type CorrelationId

type CorrelationId = string

CorrelationId defines model for correlationId.

type Country

type Country = string

Country ISO 3166-1 alpha-2 two letter country code

type Currency

type Currency = string

Currency ISO 4217 three letter currency code

type ErrorCode

type ErrorCode string

ErrorCode - `PAM_ERR_UNDEFINED` - When you need a generic error. - `PAM_ERR_ACC_NOT_FOUND` - When account of `playerId` is not found. - `PAM_ERR_GAME_NOT_FOUND` - When specified `providerGameId` is not found. - `PAM_ERR_ROUND_NOT_FOUND` - In getGameRound, when there is no game round with id `providerGameRoundId`. - `PAM_ERR_TRANS_NOT_FOUND` - In DEPOSIT transaction if the game round with id `providerRoundId` is not found. - `PAM_ERR_CASH_OVERDRAFT` - When user does not have enough funds on their account for a withdraw transactions. - `PAM_ERR_BONUS_OVERDRAFT` - When user does not have enough funds on their bonus account for a withdraw transaction. - `PAM_ERR_SESSION_NOT_FOUND` - When no session is found for provided `X-Player-Token`. - `PAM_ERR_SESSION_EXPIRED` - When session related to `X-Player-Token` has expired. - `PAM_ERR_MISSING_PROVIDER` - When specified query parameter `provider` is not found. - `PAM_ERR_TRANS_CURRENCY` - When specified `Currency` does not match that of the session. - `PAM_ERR_NEGATIVE_STAKE` - When transaction amount is negative. - `PAM_ERR_CANCEL_NOT_FOUND` - When the transaction trying to cancel doesn't exist. - `PAM_ERR_TRANS_ALREADY_CANCELLED` - When trying to cancel an already cancelled transaction, or when a Deposit is made toward a cancelled withdraw. - `PAM_ERR_CANCEL_NON_WITHDRAW` - When trying to cancel a transaction that is not a Withdraw transaction. - `PAM_ERR_BET_NOT_ALLOWED` - When a bet cannot be done, eg when the user is blocked. - `PAM_ERR_PLAYER_NOT_FOUND` - When `playerId` is not found. - `PAM_ERR_API_TOKEN` - When `Authorization` header api token does not match the PAM api token. - `PAM_ERR_TRANS_ALREADY_SETTLED` - When trying to cancel an already Deposited bet or when trying to Deposit on an already finished gameRound, finished bet. - `PAM_ERR_DUPLICATE_TRANS` - When a Deposit is made with an already existing `providerTransactionId` but with different `playerId`/`providerGameId`/`providerRoundId`. - `PAM_ERR_PROMO_OVERDRAFT` - When user does not have enough funds on their promo account for a withdraw transaction. - `PAM_ERR_TIMEOUT` - A timeout occurred

const (
	PAMERRACCNOTFOUND           ErrorCode = "PAM_ERR_ACC_NOT_FOUND"
	PAMERRAPITOKEN              ErrorCode = "PAM_ERR_API_TOKEN"
	PAMERRBETNOTALLOWED         ErrorCode = "PAM_ERR_BET_NOT_ALLOWED"
	PAMERRBONUSOVERDRAFT        ErrorCode = "PAM_ERR_BONUS_OVERDRAFT"
	PAMERRCANCELNONWITHDRAW     ErrorCode = "PAM_ERR_CANCEL_NON_WITHDRAW"
	PAMERRCANCELNOTFOUND        ErrorCode = "PAM_ERR_CANCEL_NOT_FOUND"
	PAMERRCASHOVERDRAFT         ErrorCode = "PAM_ERR_CASH_OVERDRAFT"
	PAMERRDUPLICATETRANS        ErrorCode = "PAM_ERR_DUPLICATE_TRANS"
	PAMERRGAMENOTFOUND          ErrorCode = "PAM_ERR_GAME_NOT_FOUND"
	PAMERRMISSINGPROVIDER       ErrorCode = "PAM_ERR_MISSING_PROVIDER"
	PAMERRNEGATIVESTAKE         ErrorCode = "PAM_ERR_NEGATIVE_STAKE"
	PAMERRPLAYERNOTFOUND        ErrorCode = "PAM_ERR_PLAYER_NOT_FOUND"
	PAMERRPROMOOVERDRAFT        ErrorCode = "PAM_ERR_PROMO_OVERDRAFT"
	PAMERRROUNDNOTFOUND         ErrorCode = "PAM_ERR_ROUND_NOT_FOUND"
	PAMERRSESSIONEXPIRED        ErrorCode = "PAM_ERR_SESSION_EXPIRED"
	PAMERRSESSIONNOTFOUND       ErrorCode = "PAM_ERR_SESSION_NOT_FOUND"
	PAMERRTIMEOUT               ErrorCode = "PAM_ERR_TIMEOUT"
	PAMERRTRANSALREADYCANCELLED ErrorCode = "PAM_ERR_TRANS_ALREADY_CANCELLED"
	PAMERRTRANSALREADYSETTLED   ErrorCode = "PAM_ERR_TRANS_ALREADY_SETTLED"
	PAMERRTRANSCURRENCY         ErrorCode = "PAM_ERR_TRANS_CURRENCY"
	PAMERRTRANSNOTFOUND         ErrorCode = "PAM_ERR_TRANS_NOT_FOUND"
	PAMERRUNDEFINED             ErrorCode = "PAM_ERR_UNDEFINED"
)

Defines values for ErrorCode.

type GameRound

type GameRound struct {
	// EndTime A date and time in IS0 8601 format
	EndTime *Timestamp `json:"endTime,omitempty"`

	// ProviderGameId The game identifier unique for the RGS(provider)
	ProviderGameId ProviderGameId `json:"providerGameId"`

	// ProviderRoundId The unique game round identifier for the provider
	ProviderRoundId ProviderRoundId `json:"providerRoundId"`

	// StartTime A date and time in IS0 8601 format
	StartTime Timestamp `json:"startTime"`
}

GameRound Game round object

type GameRoundResponse

type GameRoundResponse struct {
	// Error Error details describing why PAM rejected the request
	Error *PamError `json:"error,omitempty"`

	// Gameround Game round object
	Gameround *GameRound `json:"gameround,omitempty"`
	Status    StatusCode `json:"status"`
}

GameRoundResponse defines model for GameRoundResponse.

type GetBalanceParams

type GetBalanceParams struct {
	// Provider Name of the game provider associated with the session
	Provider Provider `form:"provider" json:"provider"`

	// XPlayerToken Player game session identifier
	XPlayerToken SessionToken `json:"X-Player-Token"`

	// XCorrelationID Header for correlating requests between the services for debugging purposes and request tracing. The value will originate from the game providers that support request identification. Otherwise Valkyrie will generate a value.
	XCorrelationID CorrelationId `json:"X-Correlation-ID"`

	// Traceparent Describes the position of the incoming request in its trace graph. Further specified in https://www.w3.org/TR/trace-context
	Traceparent *Traceparent `json:"traceparent,omitempty"`

	// Tracestate Extends traceparent with vendor-specific data represented by a set of name/value pairs. Further specified in https://www.w3.org/TR/trace-context
	Tracestate *Tracestate `json:"tracestate,omitempty"`
}

GetBalanceParams defines parameters for GetBalance.

type GetBalanceRequest

type GetBalanceRequest struct {
	Params   GetBalanceParams
	PlayerID PlayerId
}

GetBalanceRequest bundles everything needed to make a request

func (GetBalanceRequest) Traceparent added in v0.5.0

func (r GetBalanceRequest) Traceparent() *Traceparent

func (GetBalanceRequest) Tracestate added in v0.5.0

func (r GetBalanceRequest) Tracestate() *Tracestate

type GetBalanceRequestMapper

type GetBalanceRequestMapper func() (context.Context, GetBalanceRequest, error)

GetBalanceRequestMapper Returns context and request used by PAM

type GetGameRoundParams

type GetGameRoundParams struct {
	// Provider Name of the game provider associated with the session
	Provider Provider `form:"provider" json:"provider"`

	// XPlayerToken Player game session identifier
	XPlayerToken SessionToken `json:"X-Player-Token"`

	// XCorrelationID Header for correlating requests between the services for debugging purposes and request tracing. The value will originate from the game providers that support request identification. Otherwise Valkyrie will generate a value.
	XCorrelationID CorrelationId `json:"X-Correlation-ID"`

	// Traceparent Describes the position of the incoming request in its trace graph. Further specified in https://www.w3.org/TR/trace-context
	Traceparent *Traceparent `json:"traceparent,omitempty"`

	// Tracestate Extends traceparent with vendor-specific data represented by a set of name/value pairs. Further specified in https://www.w3.org/TR/trace-context
	Tracestate *Tracestate `json:"tracestate,omitempty"`
}

GetGameRoundParams defines parameters for GetGameRound.

type GetGameRoundRequest

type GetGameRoundRequest struct {
	ProviderRoundID ProviderRoundId
	Params          GetGameRoundParams
	PlayerID        PlayerId
}

GetGameRoundRequest bundles everything needed to make a request

func (GetGameRoundRequest) Traceparent added in v0.5.0

func (r GetGameRoundRequest) Traceparent() *Traceparent

func (GetGameRoundRequest) Tracestate added in v0.5.0

func (r GetGameRoundRequest) Tracestate() *Tracestate

type GetGameRoundRequestMapper

type GetGameRoundRequestMapper func() (context.Context, GetGameRoundRequest, error)

GetGameRoundRequestMapper Returns context and request used by PAM

type GetSessionParams

type GetSessionParams struct {
	// Provider Name of the game provider associated with the session
	Provider Provider `form:"provider" json:"provider"`

	// XPlayerToken Player game session identifier
	XPlayerToken SessionToken `json:"X-Player-Token"`

	// XCorrelationID Header for correlating requests between the services for debugging purposes and request tracing. The value will originate from the game providers that support request identification. Otherwise Valkyrie will generate a value.
	XCorrelationID CorrelationId `json:"X-Correlation-ID"`

	// Traceparent Describes the position of the incoming request in its trace graph. Further specified in https://www.w3.org/TR/trace-context
	Traceparent *Traceparent `json:"traceparent,omitempty"`

	// Tracestate Extends traceparent with vendor-specific data represented by a set of name/value pairs. Further specified in https://www.w3.org/TR/trace-context
	Tracestate *Tracestate `json:"tracestate,omitempty"`
}

GetSessionParams defines parameters for GetSession.

type GetSessionRequest

type GetSessionRequest struct {
	Params GetSessionParams
}

GetSessionRequest bundles everything needed to make a get session request

func (GetSessionRequest) Traceparent added in v0.5.0

func (r GetSessionRequest) Traceparent() *Traceparent

func (GetSessionRequest) Tracestate added in v0.5.0

func (r GetSessionRequest) Tracestate() *Tracestate

type GetSessionRequestMapper

type GetSessionRequestMapper func() (context.Context, GetSessionRequest, error)

GetSessionRequestMapper Returns context and request used by PAM

type GetTransactionsParams

type GetTransactionsParams struct {
	// Provider Name of the game provider associated with the session
	Provider              Provider               `form:"provider" json:"provider"`
	ProviderTransactionId *ProviderTransactionId `form:"providerTransactionId,omitempty" json:"providerTransactionId,omitempty"`
	ProviderBetRef        *ProviderBetRef        `form:"providerBetRef,omitempty" json:"providerBetRef,omitempty"`

	// XPlayerToken Player game session identifier
	XPlayerToken SessionToken `json:"X-Player-Token"`

	// XCorrelationID Header for correlating requests between the services for debugging purposes and request tracing. The value will originate from the game providers that support request identification. Otherwise Valkyrie will generate a value.
	XCorrelationID CorrelationId `json:"X-Correlation-ID"`

	// Traceparent Describes the position of the incoming request in its trace graph. Further specified in https://www.w3.org/TR/trace-context
	Traceparent *Traceparent `json:"traceparent,omitempty"`

	// Tracestate Extends traceparent with vendor-specific data represented by a set of name/value pairs. Further specified in https://www.w3.org/TR/trace-context
	Tracestate *Tracestate `json:"tracestate,omitempty"`
}

GetTransactionsParams defines parameters for GetTransactions.

type GetTransactionsRequest

type GetTransactionsRequest struct {
	Params   GetTransactionsParams
	PlayerID PlayerId
}

GetTransactionsRequest bundles everything needed to make a request

func (GetTransactionsRequest) Traceparent added in v0.5.0

func (r GetTransactionsRequest) Traceparent() *Traceparent

func (GetTransactionsRequest) Tracestate added in v0.5.0

func (r GetTransactionsRequest) Tracestate() *Tracestate

type GetTransactionsRequestMapper

type GetTransactionsRequestMapper func() (context.Context, GetTransactionsRequest, error)

GetTransactionsRequestMapper Returns context and request used by PAM

type GetTransactionsResponse

type GetTransactionsResponse struct {
	// Error Error details describing why PAM rejected the request
	Error        *PamError      `json:"error,omitempty"`
	Status       StatusCode     `json:"status"`
	Transactions *[]Transaction `json:"transactions,omitempty"`
}

GetTransactionsResponse defines model for GetTransactionsResponse.

type Jackpot

type Jackpot struct {
	// JackpotAmount Amount in some currency, rounded to 6 decimal places
	JackpotAmount  *Amount          `json:"jackpotAmount,omitempty"`
	JackpotBuckets *[]JackpotBucket `json:"jackpotBuckets,omitempty"`

	// JackpotId Jackpot identifier
	JackpotId *JackpotId `json:"jackpotId,omitempty"`

	// JackpotReference Jackpot reference, arbitrary use
	JackpotReference *JackpotReference `json:"jackpotReference,omitempty"`
}

Jackpot defines model for Jackpot.

type JackpotBucket

type JackpotBucket struct {
	// BucketAmount Amount in some currency, rounded to 6 decimal places
	BucketAmount *Amount `json:"bucketAmount,omitempty"`

	// BucketReference Jackpot bucket reference, arbitrary use
	BucketReference *BucketReference `json:"bucketReference,omitempty"`

	// BucketType Type of jackpot bucket, if any. Arbitrary use
	BucketType *BucketType `json:"bucketType,omitempty"`

	// Currency ISO 4217 three letter currency code
	Currency *Currency `json:"currency,omitempty"`
}

JackpotBucket defines model for JackpotBucket.

type JackpotId

type JackpotId = string

JackpotId Jackpot identifier

type JackpotReference

type JackpotReference = string

JackpotReference Jackpot reference, arbitrary use

type Language

type Language = string

Language ISO 639-1 two letter language code

type PamClient

type PamClient interface {
	// GetSession Return session
	GetSession(GetSessionRequestMapper) (*Session, error)
	// RefreshSession returns a new session token
	RefreshSession(RefreshSessionRequestMapper) (*Session, error)
	// GetBalance get balance from PAM
	GetBalance(GetBalanceRequestMapper) (*Balance, error)
	// GetTransactions get transactions from pam
	GetTransactions(GetTransactionsRequestMapper) ([]Transaction, error)
	// AddTransaction returns transactionId and balance. When transaction fails balance can still be returned. On failure error will be returned
	AddTransaction(AddTransactionRequestMapper) (*TransactionResult, error)
	// GetGameRound gets gameRound from PAM
	GetGameRound(GetGameRoundRequestMapper) (*GameRound, error)
	// GetTransactionSupplier return the type of transaction supplier the PAM supports
	GetTransactionSupplier() TransactionSupplier
}

PamClient Interface describing available PAM operations. The Mapper methods are indicating that explicit conversion is required for Provider data to work with the PAM.

func GetPamClient

func GetPamClient(args ClientArgs) (PamClient, error)

type PamError

type PamError struct {
	// Code - `PAM_ERR_UNDEFINED` - When you need a generic error.
	// - `PAM_ERR_ACC_NOT_FOUND` - When account of `playerId` is not found.
	// - `PAM_ERR_GAME_NOT_FOUND` - When specified `providerGameId` is not found.
	// - `PAM_ERR_ROUND_NOT_FOUND` - In getGameRound, when there is no game round with id `providerGameRoundId`.
	// - `PAM_ERR_TRANS_NOT_FOUND` - In DEPOSIT transaction if the game round with id `providerRoundId` is not found.
	// - `PAM_ERR_CASH_OVERDRAFT` - When user does not have enough funds on their account for a withdraw transactions.
	// - `PAM_ERR_BONUS_OVERDRAFT` - When user does not have enough funds on their bonus account for a withdraw transaction.
	// - `PAM_ERR_SESSION_NOT_FOUND` - When no session is found for provided `X-Player-Token`.
	// - `PAM_ERR_SESSION_EXPIRED` - When session related to `X-Player-Token` has expired.
	// - `PAM_ERR_MISSING_PROVIDER` - When specified query parameter `provider` is not found.
	// - `PAM_ERR_TRANS_CURRENCY` - When specified `Currency` does not match that of the session.
	// - `PAM_ERR_NEGATIVE_STAKE` - When transaction amount is negative.
	// - `PAM_ERR_CANCEL_NOT_FOUND` - When the transaction trying to cancel doesn't exist.
	// - `PAM_ERR_TRANS_ALREADY_CANCELLED` - When trying to cancel an already cancelled transaction, or when a Deposit is made toward a cancelled withdraw.
	// - `PAM_ERR_CANCEL_NON_WITHDRAW` - When trying to cancel a transaction that is not a Withdraw transaction.
	// - `PAM_ERR_BET_NOT_ALLOWED` - When a bet cannot be done, eg when the user is blocked.
	// - `PAM_ERR_PLAYER_NOT_FOUND` - When `playerId` is not found.
	// - `PAM_ERR_API_TOKEN` - When `Authorization` header api token does not match the PAM api token.
	// - `PAM_ERR_TRANS_ALREADY_SETTLED` - When trying to cancel an already Deposited bet or when trying to Deposit on an already finished gameRound, finished bet.
	// - `PAM_ERR_DUPLICATE_TRANS` - When a Deposit is made with an already existing `providerTransactionId` but with different `playerId`/`providerGameId`/`providerRoundId`.
	// - `PAM_ERR_PROMO_OVERDRAFT` - When user does not have enough funds on their promo account for a withdraw transaction.
	// - `PAM_ERR_TIMEOUT` - A timeout occurred
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
}

PamError Error details describing why PAM rejected the request

func (PamError) Error

func (e PamError) Error() string

type PlayerId

type PlayerId = string

PlayerId id of player

type Promo

type Promo struct {
	// Currency ISO 4217 three letter currency code
	Currency *Currency `json:"currency,omitempty"`

	// PromoAmount Amount in some currency, rounded to 6 decimal places
	PromoAmount *Amount `json:"promoAmount,omitempty"`

	// PromoAmountTotal Amount in some currency, rounded to 6 decimal places
	PromoAmountTotal *Amount `json:"promoAmountTotal,omitempty"`

	// PromoAwardRef Offering award reference, if any
	PromoAwardRef *PromoAwardRef `json:"promoAwardRef,omitempty"`

	// PromoCode Offering code, if any
	PromoCode *PromoCode `json:"promoCode,omitempty"`

	// PromoConfigRef Offering configuration reference, if any
	PromoConfigRef *PromoConfigRef `json:"promoConfigRef,omitempty"`

	// PromoName Name of offering, if any
	PromoName *PromoName `json:"promoName,omitempty"`

	// PromoReference Reference to the offering, if any
	PromoReference *PromoReference `json:"promoReference,omitempty"`

	// PromoStatus Offering status, if any
	PromoStatus *PromoStatus `json:"promoStatus,omitempty"`

	// PromoType Promo types according to:
	// * `PROMOBONUS` - bonus promotion
	// * `PROMOTOURNAMENT` - tournament related promotion
	// * `PROMOFROMGAME` - promotion awarded from a game
	// * `PROMOCAP` - capped promotion
	// * `PROMOLIMIT` - limited promotion
	// * `PROMOMONEYREWARD` - real money promotion award
	// * `FREEROUNDS` - extra game rounds for free
	// * `FREESPINS` - extra spins for free
	PromoType *PromoType `json:"promoType,omitempty"`
}

Promo defines model for Promo.

type PromoAwardRef

type PromoAwardRef = string

PromoAwardRef Offering award reference, if any

type PromoCode

type PromoCode = string

PromoCode Offering code, if any

type PromoConfigRef

type PromoConfigRef = string

PromoConfigRef Offering configuration reference, if any

type PromoName

type PromoName = string

PromoName Name of offering, if any

type PromoReference

type PromoReference = string

PromoReference Reference to the offering, if any

type PromoStatus

type PromoStatus = string

PromoStatus Offering status, if any

type PromoType

type PromoType string

PromoType Promo types according to: * `PROMOBONUS` - bonus promotion * `PROMOTOURNAMENT` - tournament related promotion * `PROMOFROMGAME` - promotion awarded from a game * `PROMOCAP` - capped promotion * `PROMOLIMIT` - limited promotion * `PROMOMONEYREWARD` - real money promotion award * `FREEROUNDS` - extra game rounds for free * `FREESPINS` - extra spins for free

const (
	FREEROUNDS       PromoType = "FREEROUNDS"
	FREESPINS        PromoType = "FREESPINS"
	PROMOBONUS       PromoType = "PROMOBONUS"
	PROMOCAP         PromoType = "PROMOCAP"
	PROMOFROMGAME    PromoType = "PROMOFROMGAME"
	PROMOLIMIT       PromoType = "PROMOLIMIT"
	PROMOMONEYREWARD PromoType = "PROMOMONEYREWARD"
	PROMOTOURNAMENT  PromoType = "PROMOTOURNAMENT"
)

Defines values for PromoType.

type Provider

type Provider = string

Provider Game provider identity known by the PAM and Valkyrie

type ProviderBetRef

type ProviderBetRef = string

ProviderBetRef Provider bet reference for grouping or matching transactions. Either this or `providerTransactionId` is required. This one is prioritized if both are present. It is used for RGS:s that encapsulate many transactions in a wrapper transaction.

type ProviderGameId

type ProviderGameId = string

ProviderGameId The game identifier unique for the RGS(provider)

type ProviderRoundId

type ProviderRoundId = string

ProviderRoundId The unique game round identifier for the provider

type ProviderTransactionId

type ProviderTransactionId = string

ProviderTransactionId The RGS transaction identifier. Unique for each provider. Either this or `providerBetRef` is required. `providerBetRef` will be prioritized if both are present.

type RefreshSessionParams

type RefreshSessionParams struct {
	// Provider Name of the game provider associated with the session
	Provider Provider `form:"provider" json:"provider"`

	// XPlayerToken Player game session identifier
	XPlayerToken SessionToken `json:"X-Player-Token"`

	// XCorrelationID Header for correlating requests between the services for debugging purposes and request tracing. The value will originate from the game providers that support request identification. Otherwise Valkyrie will generate a value.
	XCorrelationID CorrelationId `json:"X-Correlation-ID"`

	// Traceparent Describes the position of the incoming request in its trace graph. Further specified in https://www.w3.org/TR/trace-context
	Traceparent *Traceparent `json:"traceparent,omitempty"`

	// Tracestate Extends traceparent with vendor-specific data represented by a set of name/value pairs. Further specified in https://www.w3.org/TR/trace-context
	Tracestate *Tracestate `json:"tracestate,omitempty"`
}

RefreshSessionParams defines parameters for RefreshSession.

type RefreshSessionRequest

type RefreshSessionRequest struct {
	Params RefreshSessionParams
}

RefreshSessionRequest bundles everything needed to make a request

func (RefreshSessionRequest) Traceparent added in v0.5.0

func (r RefreshSessionRequest) Traceparent() *Traceparent

func (RefreshSessionRequest) Tracestate added in v0.5.0

func (r RefreshSessionRequest) Tracestate() *Tracestate

type RefreshSessionRequestMapper

type RefreshSessionRequestMapper func() (context.Context, RefreshSessionRequest, error)

RefreshSessionRequestMapper Returns context and request used by PAM

type RoundTransaction added in v0.6.0

type RoundTransaction struct {
	// BetCode metadata about what kind of bet/transaction it is
	BetCode *BetCode `json:"betCode,omitempty"`

	// CashAmount Amount in some currency, rounded to 6 decimal places
	CashAmount *Amount `json:"cashAmount,omitempty"`
	IsGameOver *bool   `json:"isGameOver,omitempty"`

	// JackpotContribution Amount in some currency, rounded to 6 decimal places
	JackpotContribution *Amount `json:"jackpotContribution,omitempty"`

	// ProviderBetRef Provider bet reference for grouping or matching transactions. Either this or `providerTransactionId` is required. This one is prioritized if both are present. It is used for RGS:s that encapsulate many transactions in a wrapper transaction.
	ProviderBetRef *ProviderBetRef `json:"providerBetRef,omitempty"`

	// ProviderTransactionId The RGS transaction identifier. Unique for each provider. Either this or `providerBetRef` is required. `providerBetRef` will be prioritized if both are present.
	ProviderTransactionId *ProviderTransactionId `json:"providerTransactionId,omitempty"`

	// TransactionDateTime A date and time in IS0 8601 format
	TransactionDateTime *Timestamp `json:"transactionDateTime,omitempty"`

	// TransactionType Transaction types according to:
	// * `DEPOSIT` - for adding funds
	// * `WITHDRAW` - subtract funds from an account balance. Generally for placing bets
	// * `CANCEL` - reverting a previous transaction
	// * `PROMODEPOSIT` - payout from promo and similar offerings programs
	// * `PROMOWITHDRAW` - buyin to promo and similar offerings programs
	// * `PROMOCANCEL` - reverting a previous promo transaction
	TransactionType TransactionType `json:"transactionType"`
}

RoundTransaction A transaction that's part of a game round. It has a limited set of fields as its intended use is when doing gamewise settlement.

type Session

type Session struct {
	// Country ISO 3166-1 alpha-2 two letter country code
	Country Country `json:"country"`

	// Currency ISO 4217 three letter currency code
	Currency Currency `json:"currency"`

	// GameId The game identifier unique for the RGS(provider)
	GameId *ProviderGameId `json:"gameId,omitempty"`

	// Language ISO 639-1 two letter language code
	Language Language `json:"language"`

	// PlayerId id of player
	PlayerId PlayerId `json:"playerId"`

	// Token Player game session identifier
	Token SessionToken `json:"token"`
}

Session defines model for Session.

type SessionResponse

type SessionResponse struct {
	// Error Error details describing why PAM rejected the request
	Error   *PamError  `json:"error,omitempty"`
	Session *Session   `json:"session,omitempty"`
	Status  StatusCode `json:"status"`
}

SessionResponse defines model for SessionResponse.

type SessionToken

type SessionToken = string

SessionToken Player game session identifier

type StatusCode

type StatusCode string

StatusCode defines model for StatusCode.

const (
	ERROR StatusCode = "ERROR"
	OK    StatusCode = "OK"
)

Defines values for StatusCode.

type Timestamp

type Timestamp = time.Time

Timestamp A date and time in IS0 8601 format

type Tip

type Tip struct {
	// TipAmount Amount in some currency, rounded to 6 decimal places
	TipAmount *Amount `json:"tipAmount,omitempty"`
}

Tip defines model for Tip.

type Traceparent added in v0.5.0

type Traceparent = string

Traceparent defines model for traceparent.

type Tracestate added in v0.5.0

type Tracestate = string

Tracestate defines model for tracestate.

type TracingRequest added in v0.5.0

TracingRequest interface simplifies working with Tracing from *Request objects using generics.

type Transaction

type Transaction struct {
	// BetCode metadata about what kind of bet/transaction it is
	BetCode *BetCode `json:"betCode,omitempty"`

	// BonusAmount Amount in some currency, rounded to 6 decimal places
	BonusAmount Amount `json:"bonusAmount"`

	// CashAmount Amount in some currency, rounded to 6 decimal places
	CashAmount Amount `json:"cashAmount"`

	// Currency ISO 4217 three letter currency code
	Currency   Currency   `json:"currency"`
	IsGameOver *bool      `json:"isGameOver,omitempty"`
	Jackpots   *[]Jackpot `json:"jackpots,omitempty"`

	// PromoAmount Amount in some currency, rounded to 6 decimal places
	PromoAmount Amount   `json:"promoAmount"`
	Promos      *[]Promo `json:"promos,omitempty"`

	// Provider Game provider identity known by the PAM and Valkyrie
	Provider Provider `json:"provider"`

	// ProviderBetRef Provider bet reference for grouping or matching transactions. Either this or `providerTransactionId` is required. This one is prioritized if both are present. It is used for RGS:s that encapsulate many transactions in a wrapper transaction.
	ProviderBetRef *ProviderBetRef `json:"providerBetRef,omitempty"`

	// ProviderGameId The game identifier unique for the RGS(provider)
	ProviderGameId *ProviderGameId `json:"providerGameId,omitempty"`

	// ProviderRoundId The unique game round identifier for the provider
	ProviderRoundId *ProviderRoundId `json:"providerRoundId,omitempty"`

	// ProviderTransactionId The RGS transaction identifier. Unique for each provider. Either this or `providerBetRef` is required. `providerBetRef` will be prioritized if both are present.
	ProviderTransactionId ProviderTransactionId `json:"providerTransactionId"`

	// RoundTransactions Optional. In case the PAM does not handle grouping of transaction by itself, Valkyrie needs to provide
	// transactions related to the round.
	RoundTransactions *[]RoundTransaction `json:"roundTransactions,omitempty"`
	Tip               *Tip                `json:"tip,omitempty"`

	// TransactionDateTime A date and time in IS0 8601 format
	TransactionDateTime Timestamp `json:"transactionDateTime"`

	// TransactionType Transaction types according to:
	// * `DEPOSIT` - for adding funds
	// * `WITHDRAW` - subtract funds from an account balance. Generally for placing bets
	// * `CANCEL` - reverting a previous transaction
	// * `PROMODEPOSIT` - payout from promo and similar offerings programs
	// * `PROMOWITHDRAW` - buyin to promo and similar offerings programs
	// * `PROMOCANCEL` - reverting a previous promo transaction
	TransactionType TransactionType `json:"transactionType"`
}

Transaction defines model for Transaction.

type TransactionId

type TransactionId = string

TransactionId Unique transaction identifier from the PAM system

type TransactionResult

type TransactionResult struct {
	// Balance player account balance
	Balance *Balance `json:"balance,omitempty"`

	// TransactionId Unique transaction identifier from the PAM system
	TransactionId *TransactionId `json:"transactionId,omitempty"`
}

TransactionResult defines model for TransactionResult.

type TransactionSupplier added in v0.6.0

type TransactionSupplier string

TransactionSupplier How the PAM expect the transaction handling to be done.

Either the PAM keeps track of transactions that should be grouped together or the PAM expects relevant transactions be included in transaction.RoundTransactions field.

const (
	// OPERATOR Expects the operator to keep track of what transactions need to be grouped together
	OPERATOR TransactionSupplier = "OPERATOR"
	// PROVIDER Expects the provider to supply all transactions needed grouped together.
	// Make use of transaction.RoundTransactions to provide the PAM with relevant data
	PROVIDER TransactionSupplier = "PROVIDER"
)

type TransactionType

type TransactionType string

TransactionType Transaction types according to: * `DEPOSIT` - for adding funds * `WITHDRAW` - subtract funds from an account balance. Generally for placing bets * `CANCEL` - reverting a previous transaction * `PROMODEPOSIT` - payout from promo and similar offerings programs * `PROMOWITHDRAW` - buyin to promo and similar offerings programs * `PROMOCANCEL` - reverting a previous promo transaction

const (
	CANCEL        TransactionType = "CANCEL"
	DEPOSIT       TransactionType = "DEPOSIT"
	PROMOCANCEL   TransactionType = "PROMOCANCEL"
	PROMODEPOSIT  TransactionType = "PROMODEPOSIT"
	PROMOWITHDRAW TransactionType = "PROMOWITHDRAW"
	WITHDRAW      TransactionType = "WITHDRAW"
)

Defines values for TransactionType.

type Unauthorized

type Unauthorized struct {
	// Error Error details describing why PAM rejected the request
	Error struct {
		// Code Pam Error code "PAM_ERR_SESSION_NOT_FOUND" or "PAM_ERR_UNDEFINED"
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"error"`

	// Status Status is Error
	Status string `json:"status"`
}

Unauthorized defines model for Unauthorized.

type ValkErrorCode

type ValkErrorCode int

ValkErrorCode Error codes in valkyrie

const (
	ValkErrUndefined ValkErrorCode = iota
	ValkErrAPISession
	ValkErrAuth
	ValkErrGetBalance
	ValkErrStakeValue
	ValkErrPromoValue
	ValkErrWithdraw
	ValkErrWithdrawCurrency
	ValkErrInterpretBalance
	ValkErrPayoutValue
	ValkErrPayoutPromoValue
	ValkErrDeposit
	ValkErrRefundValue
	ValkErrRefundPromoValue
	ValkErrCancel
	ValkErrPayoutNegativeStake
	ValkErrPayoutZero
	ValkErrOpUserNotFound
	ValkErrOpGameNotFound
	ValkErrOpTransNotFound
	ValkErrOpCashOverdraft
	ValkErrOpBonusOverdraft
	ValkErrOpSessionNotFound
	ValkErrOpSessionExpired
	ValkErrOpMissingProvider
	ValkErrOpTransCurrency
	ValkErrOpNegativeStake
	ValkErrOpZeroStake
	ValkErrOpRoundExists
	ValkErrOpCancelNotFound
	ValkErrOpCancelExists
	ValkErrOpCancelNonWithdraw
	ValkErrOpBetNotAllowed
	ValkErrAlreadySettled
	ValkErrBetNotFound
	ValkErrOpAccountNotFound
	ValkErrOpAPIToken
	ValkErrReqInput
	ValkErrOpRoundNotFound
	ValkErrDuplicateTrans
	ValkErrOpPromoOverdraft
	ValkErrTimeout
)

func GetErrUndefined

func GetErrUndefined() ValkErrorCode

GetErrUndefined Return ValkErrUndefined error code

type ValkyrieError

type ValkyrieError struct {
	OrigError error
	ErrMsg    string
	ValkErrorCode
}

func (ValkyrieError) Error

func (e ValkyrieError) Error() string

func (ValkyrieError) GetErrorCode

func (e ValkyrieError) GetErrorCode(valkError ValkyrieError) int

func (ValkyrieError) Unwrap

func (e ValkyrieError) Unwrap() error

Directories

Path Synopsis
Package genericpam provides a client for the reference PAM implementation
Package genericpam provides a client for the reference PAM implementation
Package vplugin contains the generic and externalized plugin interface for PAM.
Package vplugin contains the generic and externalized plugin interface for PAM.

Jump to

Keyboard shortcuts

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