| 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 .xml suffix or ?format=xml
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: application/xml
Content-Type: application/xml
Content-Length: length
<ReportBetPlacements xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Starnet.MontenegroTaxationAuthority.WebApi.ServiceModel">
<BetPlacements xmlns:d2p1="http://schemas.datacontract.org/2004/07/Starnet.MontenegroTaxationAuthority.Common">
<d2p1:BetDto>
<d2p1:betting_place_id>String</d2p1:betting_place_id>
<d2p1:betting_terminal_id>String</d2p1:betting_terminal_id>
<d2p1:game_name>String</d2p1:game_name>
<d2p1:identification_document_country>String</d2p1:identification_document_country>
<d2p1:identification_document_type>String</d2p1:identification_document_type>
<d2p1:jmbg>String</d2p1:jmbg>
<d2p1:passport_number>String</d2p1:passport_number>
<d2p1:source>Landbase</d2p1:source>
<d2p1:transaction_amount>0</d2p1:transaction_amount>
<d2p1:transaction_id>String</d2p1:transaction_id>
<d2p1:transaction_time>0001-01-01T00:00:00</d2p1:transaction_time>
<d2p1:bet_type>Real</d2p1:bet_type>
<d2p1:max_bonus>0</d2p1:max_bonus>
<d2p1:max_odds>0</d2p1:max_odds>
<d2p1:max_payout>0</d2p1:max_payout>
<d2p1:max_win>0</d2p1:max_win>
<d2p1:min_bonus>0</d2p1:min_bonus>
<d2p1:min_odds>0</d2p1:min_odds>
<d2p1:min_win>0</d2p1:min_win>
<d2p1:promo_amount>0</d2p1:promo_amount>
<d2p1:ticket>
<d2p1:ac>0</d2p1:ac>
<d2p1:e xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:ArrayOfanyType>
<d5p1:anyType i:nil="true" />
</d5p1:ArrayOfanyType>
</d2p1:e>
<d2p1:nc>0</d2p1:nc>
<d2p1:sy>String</d2p1:sy>
</d2p1:ticket>
<d2p1:ticket_id>String</d2p1:ticket_id>
</d2p1:BetDto>
</BetPlacements>
</ReportBetPlacements>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<ResponseStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<StackTrace>String</StackTrace>
<Errors>
<ResponseError>
<ErrorCode>String</ErrorCode>
<FieldName>String</FieldName>
<Message>String</Message>
<Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:KeyValueOfstringstring>
<d4p1:Key>String</d4p1:Key>
<d4p1:Value>String</d4p1:Value>
</d4p1:KeyValueOfstringstring>
</Meta>
</ResponseError>
</Errors>
<Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>String</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</Meta>
</ResponseStatus>