Yimaru-BackEnd/internal/domain/virtual_game.go
2025-05-23 20:11:26 +03:00

115 lines
4.6 KiB
Go

package domain
import (
"time"
)
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"`
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
}
// 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
}
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 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"`
}
// // Extend VirtualGameTransaction for Alea compatibility
// type VirtualGameTransaction struct {
// ID string `json:"id"`
// SessionID string `json:"session_id"`
// UserID int64 `json:"user_id"`
// WalletID int64 `json:"wallet_id"`
// TransactionType string `json:"transaction_type"` // Matches Alea's types
// Amount int64 `json:"amount"` // In cents
// Currency string `json:"currency"`
// ExternalTransactionID string `json:"external_transaction_id"`
// Status string `json:"status"`
// GameID string `json:"game_id"` // Track which game this was for
// RoundID string `json:"round_id,omitempty"`
// CreatedAt time.Time `json:"created_at"`
// UpdatedAt time.Time `json:"updated_at"`
// }