272 lines
9.7 KiB
Go
272 lines
9.7 KiB
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type Provider string
|
|
|
|
const (
|
|
PROVIDER_POPOK Provider = "PopOk"
|
|
PROVIDER_ALEA_PLAY Provider = "AleaPlay"
|
|
PROVIDER_VELI_GAMES Provider = "VeliGames"
|
|
)
|
|
|
|
type FavoriteGame struct {
|
|
ID int64 `json:"id"`
|
|
UserID int64 `json:"user_id"`
|
|
GameID int64 `json:"game_id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type FavoriteGameRequest struct {
|
|
GameID int64 `json:"game_id"`
|
|
}
|
|
|
|
type FavoriteGameResponse struct {
|
|
GameID int64 `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
}
|
|
|
|
type VirtualGame struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Provider string `json:"provider"`
|
|
Category string `json:"category"`
|
|
MinBet float64 `json:"min_bet"`
|
|
MaxBet float64 `json:"max_bet"`
|
|
Volatility string `json:"volatility"`
|
|
IsActive bool `json:"is_active"`
|
|
RTP float64 `json:"rtp"`
|
|
IsFeatured bool `json:"is_featured"`
|
|
PopularityScore int `json:"popularity_score"`
|
|
ThumbnailURL string `json:"thumbnail_url"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
type VirtualGameSession struct {
|
|
ID int64 `json:"id"`
|
|
UserID int64 `json:"user_id"`
|
|
GameID string `json:"game_id"`
|
|
SessionToken string `json:"session_token"`
|
|
Currency string `json:"currency"`
|
|
Status string `json:"status"` // ACTIVE, COMPLETED, FAILED
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
ExpiresAt time.Time `json:"expires_at"`
|
|
|
|
// Alea Play specific fields
|
|
ExternalSessionID string `json:"external_session_id"` // Alea's session reference
|
|
OperatorID string `json:"operator_id"` // Your operator ID with Alea
|
|
GameMode string `json:"game_mode"` // real, demo, tournament
|
|
}
|
|
|
|
type VirtualGameHistory struct {
|
|
ID int64 `json:"id"`
|
|
SessionID string `json:"session_id,omitempty"` // Optional, if session tracking is used
|
|
UserID int64 `json:"user_id"`
|
|
CompanyID int64 `json:"company_id"`
|
|
Provider string `json:"provider"`
|
|
WalletID *int64 `json:"wallet_id,omitempty"` // Optional if wallet detail is needed
|
|
GameID *int64 `json:"game_id,omitempty"` // Optional for game-level analysis
|
|
TransactionType string `json:"transaction_type"` // BET, WIN, CANCEL, etc.
|
|
Amount int64 `json:"amount"` // Stored in minor units (e.g. cents)
|
|
Currency string `json:"currency"` // e.g., ETB, USD
|
|
ExternalTransactionID string `json:"external_transaction_id"` // Provider transaction ID
|
|
ReferenceTransactionID string `json:"reference_transaction_id,omitempty"` // For CANCELs pointing to BETs
|
|
Status string `json:"status"` // COMPLETED, CANCELLED, FAILED, etc.
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type VirtualGameTransaction struct {
|
|
ID int64 `json:"id"`
|
|
SessionID int64 `json:"session_id"`
|
|
UserID int64 `json:"user_id"`
|
|
CompanyID int64 `json:"company_id"`
|
|
Provider string `json:"provider"`
|
|
GameID string `json:"game_id"`
|
|
WalletID int64 `json:"wallet_id"`
|
|
TransactionType string `json:"transaction_type"` // BET, WIN, REFUND, CASHOUT, etc.
|
|
Amount int64 `json:"amount"` // Always in cents
|
|
Currency string `json:"currency"`
|
|
ExternalTransactionID string `json:"external_transaction_id"`
|
|
ReferenceTransactionID string `json:"reference_transaction_id"`
|
|
Status string `json:"status"` // PENDING, COMPLETED, FAILED
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
// Alea Play specific fields
|
|
GameRoundID string `json:"game_round_id"` // Round identifier
|
|
Multiplier float64 `json:"multiplier"` // For games like Aviator
|
|
IsFreeRound bool `json:"is_free_round"` // For bonus play
|
|
OperatorID string `json:"operator_id"` // Your operator ID
|
|
|
|
// Veli specific fields
|
|
GameSpecificData GameSpecificData `json:"game_specific_data"`
|
|
}
|
|
|
|
// type VirtualGameTransaction struct {
|
|
// ID int64 `json:"id"`
|
|
// SessionID int64 `json:"session_id"`
|
|
// UserID int64 `json:"user_id"`
|
|
// WalletID int64 `json:"wallet_id"`
|
|
// TransactionType string `json:"transaction_type"` // BET, WIN, REFUND, JACKPOT_WIN
|
|
// Amount int64 `json:"amount"`
|
|
// Currency string `json:"currency"`
|
|
// ExternalTransactionID string `json:"external_transaction_id"`
|
|
// Status string `json:"status"` // PENDING, COMPLETED, FAILED
|
|
// CreatedAt time.Time `json:"created_at"`
|
|
// UpdatedAt time.Time `json:"updated_at"`
|
|
// }
|
|
|
|
type CreateVirtualGameSession struct {
|
|
UserID int64
|
|
GameID string
|
|
Currency string
|
|
Mode string // REAL, DEMO
|
|
}
|
|
|
|
type PopOKConfig struct {
|
|
ClientID string
|
|
SecretKey string
|
|
BaseURL string
|
|
CallbackURL string
|
|
Platform string
|
|
}
|
|
|
|
type PopOKCallback struct {
|
|
TransactionID string `json:"transaction_id"`
|
|
SessionID string `json:"session_id"`
|
|
Type string `json:"type"` // BET, WIN, REFUND, JACKPOT_WIN
|
|
Amount float64 `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
Timestamp int64 `json:"timestamp"`
|
|
Signature string `json:"signature"` // HMAC-SHA256 signature for verification
|
|
}
|
|
|
|
type PopOKPlayerInfoRequest struct {
|
|
ExternalToken string `json:"externalToken"`
|
|
}
|
|
|
|
type PopOKPlayerInfoResponse struct {
|
|
Country string `json:"country"`
|
|
Currency string `json:"currency"`
|
|
Balance float64 `json:"balance"`
|
|
PlayerID string `json:"playerId"`
|
|
}
|
|
|
|
type PopOKBetRequest struct {
|
|
ExternalToken string `json:"externalToken"`
|
|
PlayerID string `json:"playerId"`
|
|
GameID string `json:"gameId"`
|
|
TransactionID string `json:"transactionId"`
|
|
Amount float64 `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
}
|
|
|
|
type PopOKBetResponse struct {
|
|
TransactionID string `json:"transactionId"`
|
|
ExternalTrxID string `json:"externalTrxId"`
|
|
Balance float64 `json:"balance"`
|
|
}
|
|
|
|
// domain/popok.go
|
|
type PopOKWinRequest struct {
|
|
ExternalToken string `json:"externalToken"`
|
|
PlayerID string `json:"playerId"`
|
|
GameID string `json:"gameId"`
|
|
TransactionID string `json:"transactionId"`
|
|
Amount float64 `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
}
|
|
|
|
type PopOKWinResponse struct {
|
|
TransactionID string `json:"transactionId"`
|
|
ExternalTrxID string `json:"externalTrxId"`
|
|
Balance float64 `json:"balance"`
|
|
}
|
|
|
|
type PopOKGenerateTokenRequest struct {
|
|
GameID string `json:"newGameId"`
|
|
Token string `json:"token"`
|
|
}
|
|
|
|
type PopOKCancelRequest struct {
|
|
ExternalToken string `json:"externalToken"`
|
|
PlayerID string `json:"playerId"`
|
|
GameID string `json:"gameId"`
|
|
TransactionID string `json:"transactionId"`
|
|
}
|
|
|
|
type PopOKCancelResponse struct {
|
|
TransactionID string `json:"transactionId"`
|
|
ExternalTrxID string `json:"externalTrxId"`
|
|
Balance float64 `json:"balance"`
|
|
}
|
|
|
|
type PopOKGenerateTokenResponse struct {
|
|
NewToken string `json:"newToken"`
|
|
}
|
|
|
|
type AleaPlayCallback struct {
|
|
EventID string `json:"event_id"`
|
|
TransactionID string `json:"transaction_id"`
|
|
SessionID string `json:"session_id"`
|
|
UserID string `json:"user_id"`
|
|
GameID string `json:"game_id"`
|
|
Type string `json:"type"` // BET, WIN, CASHOUT, etc.
|
|
Amount float64 `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
RoundID string `json:"round_id"`
|
|
Multiplier float64 `json:"multiplier"`
|
|
IsFreeRound bool `json:"is_free_round"`
|
|
OperatorID string `json:"operator_id"`
|
|
Timestamp int64 `json:"timestamp"`
|
|
Signature string `json:"signature"`
|
|
}
|
|
|
|
type VeliCallback struct {
|
|
EventType string `json:"event_type"` // "bet_placed", "game_result", etc.
|
|
RoundID string `json:"round_id"` // Unique round identifier (replaces transaction_id)
|
|
SessionID string `json:"session_id"` // Matches VirtualGameSession.SessionToken
|
|
UserID string `json:"user_id"` // Veli's user identifier
|
|
GameID string `json:"game_id"` // e.g., "veli_aviator_v1"
|
|
Amount float64 `json:"amount"` // Transaction amount
|
|
Multiplier float64 `json:"multiplier"` // For games with multipliers (Aviator/Plinko)
|
|
Currency string `json:"currency"` // e.g., "USD"
|
|
Timestamp int64 `json:"timestamp"` // Unix timestamp
|
|
Signature string `json:"signature"` // HMAC-SHA256
|
|
}
|
|
|
|
type GameSpecificData struct {
|
|
Multiplier float64 `json:"multiplier,omitempty"`
|
|
RiskLevel string `json:"risk_level,omitempty"` // For Mines
|
|
BucketIndex int `json:"bucket_index,omitempty"` // For Plinko
|
|
}
|
|
|
|
type PopOKGame struct {
|
|
ID int `json:"id"`
|
|
GameName string `json:"gameName"`
|
|
Bets []float64 `json:"bets"`
|
|
Thumbnail string `json:"thumbnail"`
|
|
Status int `json:"status"`
|
|
}
|
|
|
|
type PopOKGameListResponse struct {
|
|
Code int `json:"code"`
|
|
Message string `json:"message"`
|
|
Data struct {
|
|
Slots []PopOKGame `json:"slots"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type GameRecommendation struct {
|
|
GameID int `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
Thumbnail string `json:"thumbnail"`
|
|
Bets []float64 `json:"bets"`
|
|
Reason string `json:"reason"` // e.g., "Based on your activity", "Popular", "Random pick"
|
|
}
|