47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
package domain
|
|
|
|
import (
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
var MongoDBLogger *zap.Logger
|
|
|
|
type ResponseWDataFactory[T any] struct {
|
|
Data T `json:"data"`
|
|
Response
|
|
}
|
|
|
|
type Response struct {
|
|
Message string `json:"message"`
|
|
Data interface{} `json:"data,omitempty"`
|
|
Success bool `json:"success"`
|
|
StatusCode int `json:"status_code"`
|
|
MetaData interface{} `json:"metadata"`
|
|
}
|
|
|
|
// type CallbackErrorResponse struct {
|
|
// ErrorData interface
|
|
// Error string `json:"error,omitempty"`
|
|
// }
|
|
|
|
func CalculateWinnings(amount Currency, totalOdds float32) Currency {
|
|
|
|
vat := amount.Float32() * 0.15
|
|
stakeAfterVat := amount.Float32() - vat
|
|
possibleWin := stakeAfterVat * totalOdds
|
|
incomeTax := possibleWin * 0.15
|
|
|
|
return ToCurrency(possibleWin - incomeTax)
|
|
|
|
}
|
|
|
|
type Pagination struct {
|
|
Total int `json:"total"`
|
|
TotalPages int `json:"total_pages"`
|
|
CurrentPage int `json:"current_page"`
|
|
Limit int `json:"limit"`
|
|
}
|
|
|
|
func PtrFloat64(v float64) *float64 { return &v }
|
|
func PtrInt64(v int64) *int64 { return &v }
|