129 lines
4.7 KiB
Go
129 lines
4.7 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type ShopBet struct {
|
|
ID int64
|
|
ShopTransactionID int64
|
|
CashoutID string
|
|
CashedOut bool
|
|
BetID int64
|
|
NumberOfOutcomes int64
|
|
}
|
|
|
|
type ShopBetFilter struct {
|
|
CompanyID ValidInt64
|
|
BranchID ValidInt64
|
|
Query ValidString
|
|
CreatedBefore ValidTime
|
|
CreatedAfter ValidTime
|
|
}
|
|
|
|
type CreateShopBet struct {
|
|
ShopTransactionID int64
|
|
CashoutID string
|
|
BetID int64
|
|
NumberOfOutcomes int64
|
|
}
|
|
|
|
type ShopBetDetail struct {
|
|
ID int64
|
|
ShopTransactionID int64
|
|
TotalOdds float32
|
|
BranchID int64
|
|
CompanyID int64
|
|
FullName string
|
|
PhoneNumber string
|
|
FastCode string
|
|
CashoutID string
|
|
CashedOut bool
|
|
BetID int64
|
|
NumberOfOutcomes int64
|
|
Status OutcomeStatus
|
|
Amount Currency
|
|
Outcomes []BetOutcome
|
|
TransactionVerified bool
|
|
UpdatedAt time.Time
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type ShopBetReq struct {
|
|
Outcomes []CreateBetOutcomeReq `json:"outcomes"`
|
|
Amount float32 `json:"amount" example:"100.0"`
|
|
BetID int64 `json:"bet_id" example:"1"`
|
|
PaymentOption PaymentOption `json:"payment_option" example:"1"`
|
|
FullName string `json:"full_name" example:"John Smith"`
|
|
PhoneNumber string `json:"phone_number" example:"0911111111"`
|
|
BankCode string `json:"bank_code"`
|
|
BeneficiaryName string `json:"beneficiary_name"`
|
|
AccountName string `json:"account_name"`
|
|
AccountNumber string `json:"account_number"`
|
|
ReferenceNumber string `json:"reference_number"`
|
|
BranchID *int64 `json:"branch_id,omitempty" example:"1"`
|
|
}
|
|
|
|
type CashoutReq struct {
|
|
CashoutID string `json:"cashout_id" example:"1234"`
|
|
PaymentOption PaymentOption `json:"payment_option" example:"1"`
|
|
BankCode string `json:"bank_code"`
|
|
BeneficiaryName string `json:"beneficiary_name"`
|
|
AccountName string `json:"account_name"`
|
|
AccountNumber string `json:"account_number"`
|
|
ReferenceNumber string `json:"reference_number"`
|
|
BranchID *int64 `json:"branch_id,omitempty" example:"1"`
|
|
}
|
|
|
|
type ShopBetRes struct {
|
|
ID int64 `json:"id"`
|
|
ShopTransactionID int64 `json:"shop_transaction_id"`
|
|
TotalOdds float32 `json:"total_odds" example:"4.22"`
|
|
BranchID int64 `json:"branch_id" example:"2"`
|
|
CompanyID int64 `json:"company_id" example:"2"`
|
|
FullName string `json:"full_name" example:"John"`
|
|
PhoneNumber string `json:"phone_number" example:"1234567890"`
|
|
FastCode string `json:"fast_code" example:"12SD1"`
|
|
CashoutID string `json:"cashout_id" example:"21234"`
|
|
CashedOut bool `json:"cashed_out" example:"false"`
|
|
BetID int64 `json:"bet_id" example:"1"`
|
|
NumberOfOutcomes int64 `json:"number_of_outcomes" example:"1"`
|
|
Status OutcomeStatus `json:"status" example:"1"`
|
|
Amount float32 `json:"amount"`
|
|
Outcomes []BetOutcome `json:"outcomes"`
|
|
TransactionVerified bool `json:"transaction_verified" example:"true"`
|
|
UpdatedAt time.Time `json:"updated_at" example:"2025-04-08T12:00:00Z"`
|
|
CreatedAt time.Time `json:"created_at" example:"2025-04-08T12:00:00Z"`
|
|
}
|
|
|
|
func ConvertShopBet(shopBet ShopBet) ShopBetRes {
|
|
return ShopBetRes{
|
|
ID: shopBet.ID,
|
|
ShopTransactionID: shopBet.ShopTransactionID,
|
|
CashoutID: shopBet.CashoutID,
|
|
CashedOut: shopBet.CashedOut,
|
|
BetID: shopBet.BetID,
|
|
NumberOfOutcomes: shopBet.NumberOfOutcomes,
|
|
}
|
|
}
|
|
func ConvertShopBetDetail(shopBet ShopBetDetail) ShopBetRes {
|
|
return ShopBetRes{
|
|
ID: shopBet.ID,
|
|
ShopTransactionID: shopBet.ShopTransactionID,
|
|
TotalOdds: shopBet.TotalOdds,
|
|
BranchID: shopBet.BranchID,
|
|
CompanyID: shopBet.CompanyID,
|
|
FullName: shopBet.FullName,
|
|
PhoneNumber: shopBet.PhoneNumber,
|
|
FastCode: shopBet.FastCode,
|
|
CashoutID: shopBet.CashoutID,
|
|
CashedOut: shopBet.CashedOut,
|
|
BetID: shopBet.BetID,
|
|
NumberOfOutcomes: shopBet.NumberOfOutcomes,
|
|
Status: shopBet.Status,
|
|
Amount: shopBet.Amount.Float32(),
|
|
Outcomes: shopBet.Outcomes,
|
|
TransactionVerified: shopBet.TransactionVerified,
|
|
UpdatedAt: shopBet.UpdatedAt,
|
|
CreatedAt: shopBet.UpdatedAt,
|
|
}
|
|
}
|