| POST | /bets/payout |
|---|
import Foundation
import ServiceStack
public class ReportBetPayouts : Codable
{
public var betPayouts:RecordList<WinDto>
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 WinDto : TransactionDtoBase
{
public var bet_transaction_id:String
public var ticket_id:String
public var win_odds:Double
public var win_type:WinType
public var bonus:Double
public var cancel:Bool
public var canceled_events:RecordList<IBetEvent>
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case bet_transaction_id
case ticket_id
case win_odds
case win_type
case bonus
case cancel
case canceled_events
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
bet_transaction_id = try container.decodeIfPresent(String.self, forKey: .bet_transaction_id)
ticket_id = try container.decodeIfPresent(String.self, forKey: .ticket_id)
win_odds = try container.decodeIfPresent(Double.self, forKey: .win_odds)
win_type = try container.decodeIfPresent(WinType.self, forKey: .win_type)
bonus = try container.decodeIfPresent(Double.self, forKey: .bonus)
cancel = try container.decodeIfPresent(Bool.self, forKey: .cancel)
canceled_events = try container.decodeIfPresent(RecordList<IBetEvent>.self, forKey: .canceled_events)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if bet_transaction_id != nil { try container.encode(bet_transaction_id, forKey: .bet_transaction_id) }
if ticket_id != nil { try container.encode(ticket_id, forKey: .ticket_id) }
if win_odds != nil { try container.encode(win_odds, forKey: .win_odds) }
if win_type != nil { try container.encode(win_type, forKey: .win_type) }
if bonus != nil { try container.encode(bonus, forKey: .bonus) }
if cancel != nil { try container.encode(cancel, forKey: .cancel) }
if canceled_events != nil { try container.encode(canceled_events, forKey: .canceled_events) }
}
}
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 enum WinType : Int, Codable
{
case Regular = 0
case Cashback = 1
case Cashout = 2
}
public protocol IBetEvent
{
}
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/payout HTTP/1.1
Host: api.sbbet-prod-mnta.webhop.biz
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
betPayouts:
[
{
bet_transaction_id: String,
ticket_id: String,
win_odds: 0,
win_type: 0,
bonus: 0,
cancel: False,
canceled_events:
[
{
}
],
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
}
}