| POST | /bets/cancel |
|---|
import Foundation
import ServiceStack
public class ReportBetCancellations : Codable
{
public var betCancellations:RecordList<RollbackDto>
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 RollbackDto : TransactionDtoBase
{
public var rollback_transaction_id:String
public var ticket_id:String
public var rollback_transaction_type:RollbackTransactionType
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case rollback_transaction_id
case ticket_id
case rollback_transaction_type
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
rollback_transaction_id = try container.decodeIfPresent(String.self, forKey: .rollback_transaction_id)
ticket_id = try container.decodeIfPresent(String.self, forKey: .ticket_id)
rollback_transaction_type = try container.decodeIfPresent(RollbackTransactionType.self, forKey: .rollback_transaction_type)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if rollback_transaction_id != nil { try container.encode(rollback_transaction_id, forKey: .rollback_transaction_id) }
if ticket_id != nil { try container.encode(ticket_id, forKey: .ticket_id) }
if rollback_transaction_type != nil { try container.encode(rollback_transaction_type, forKey: .rollback_transaction_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 enum RollbackTransactionType : Int, Codable
{
case Bet = 0
case Win = 1
case Jackpot = 1
}
Swift ReportBetCancellations DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bets/cancel HTTP/1.1
Host: api.prod-mnta.webhop.biz
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"betCancellations":[{"rollback_transaction_id":"String","ticket_id":"String","rollback_transaction_type":0,"transaction_id":"String","transaction_time":"0001-01-01T00:00:00.0000000Z","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/csv
Content-Length: length
{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}