Yimaru-BackEnd/internal/domain/virtual_game.go

194 lines
6.9 KiB
Go

package domain
import (
"time"
)
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 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, 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 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 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
}