| POST | /bets/place |
|---|
import Foundation
import ServiceStack
public class ReportBetPlacements : Codable
{
public var betPlacements:RecordList<BetDto>
required public init(){}
}
public class RecordList<T : Codable> : List<T>
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public class BetDto : TransactionDtoBase
{
public var min_odds:Double
public var max_odds:Double
public var min_win:Double
public var max_win:Double
public var min_bonus:Double
public var max_bonus:Double
public var max_payout:Double
public var promo_amount:Double
public var ticket_id:String
public var ticket:TicketDto
public var bet_type:BetType
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case min_odds
case max_odds
case min_win
case max_win
case min_bonus
case max_bonus
case max_payout
case promo_amount
case ticket_id
case ticket
case bet_type
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
min_odds = try container.decodeIfPresent(Double.self, forKey: .min_odds)
max_odds = try container.decodeIfPresent(Double.self, forKey: .max_odds)
min_win = try container.decodeIfPresent(Double.self, forKey: .min_win)
max_win = try container.decodeIfPresent(Double.self, forKey: .max_win)
min_bonus = try container.decodeIfPresent(Double.self, forKey: .min_bonus)
max_bonus = try container.decodeIfPresent(Double.self, forKey: .max_bonus)
max_payout = try container.decodeIfPresent(Double.self, forKey: .max_payout)
promo_amount = try container.decodeIfPresent(Double.self, forKey: .promo_amount)
ticket_id = try container.decodeIfPresent(String.self, forKey: .ticket_id)
ticket = try container.decodeIfPresent(TicketDto.self, forKey: .ticket)
bet_type = try container.decodeIfPresent(BetType.self, forKey: .bet_type)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if min_odds != nil { try container.encode(min_odds, forKey: .min_odds) }
if max_odds != nil { try container.encode(max_odds, forKey: .max_odds) }
if min_win != nil { try container.encode(min_win, forKey: .min_win) }
if max_win != nil { try container.encode(max_win, forKey: .max_win) }
if min_bonus != nil { try container.encode(min_bonus, forKey: .min_bonus) }
if max_bonus != nil { try container.encode(max_bonus, forKey: .max_bonus) }
if max_payout != nil { try container.encode(max_payout, forKey: .max_payout) }
if promo_amount != nil { try container.encode(promo_amount, forKey: .promo_amount) }
if ticket_id != nil { try container.encode(ticket_id, forKey: .ticket_id) }
if ticket != nil { try container.encode(ticket, forKey: .ticket) }
if bet_type != nil { try container.encode(bet_type, forKey: .bet_type) }
}
}
public class TransactionDtoBase : Codable
{
public var transaction_id:String
public var transaction_time:Date
public var transaction_amount:Double
public var game_name:String
public var betting_place_id:String
public var betting_terminal_id:String
public var jmbg:String
public var passport_number:String
public var source:BetSource
public var identification_document_country:String
public var identification_document_type:String
required public init(){}
}
public enum BetSource : Int, Codable
{
case Landbase = 0
case Web = 1
}
public class TicketDto : Codable
{
public var sy:String
public var nc:Int
public var ac:Double
public var e:RecordList<RecordList<IBetEvent>>
required public init(){}
}
public enum BetType : Int, Codable
{
case Real = 0
case Promo = 1
}
Swift ReportBetPlacements DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bets/place HTTP/1.1
Host: api.prod-mnta.webhop.biz
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
betPlacements:
[
{
min_odds: 0,
max_odds: 0,
min_win: 0,
max_win: 0,
min_bonus: 0,
max_bonus: 0,
max_payout: 0,
promo_amount: 0,
ticket_id: String,
ticket:
{
sy: String,
nc: 0,
ac: 0,
e:
[
[
{
}
]
]
},
bet_type: 0,
transaction_id: String,
transaction_time: 0001-01-01,
transaction_amount: 0,
game_name: String,
betting_place_id: String,
betting_terminal_id: String,
jmbg: String,
passport_number: String,
source: 0,
identification_document_country: String,
identification_document_type: String
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
}