| POST | /cmd/bettingPolicies/config |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
class PayinConstraintType(IntEnum):
SINGLE_BET = 0
MULTI_BET = 1
SYSTEM_BET = 2
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Money:
amount: Decimal = decimal.Decimal(0)
currency: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PayinConstraint:
type: Optional[PayinConstraintType] = None
min: Optional[Money] = None
default: Optional[Money] = None
warning_threshold: Optional[Money] = None
max: Optional[Money] = None
class WinningsCapType(IntEnum):
SINGLE_BET = 0
MULTI_BET = 1
SYSTEM_BET = 2
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class WinningsCap:
type: Optional[WinningsCapType] = None
cap: Optional[Money] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BettingPolicies:
payin_constraints: Optional[RecordList[PayinConstraint]] = None
payin_taxation_policy_id: Optional[str] = None
winnings_caps: Optional[RecordList[WinningsCap]] = None
winnings_taxation_policy_id: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Ref:
id: Optional[str] = None
val: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SetBettingPoliciesConfig:
id: Optional[str] = None
policies: Optional[BettingPolicies] = None
product_instance_ref: Optional[Ref] = None
owner_ref: Optional[Ref] = None
is_active: bool = False
T = TypeVar('T')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RecordList(Generic[T], List[T]):
pass
Python SetBettingPoliciesConfig 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 /cmd/bettingPolicies/config HTTP/1.1
Host: api.beto2.webhop.biz
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
id: String,
policies:
{
payinConstraints:
[
{
type: 0,
min:
{
amount: 0,
currency: String
},
default:
{
amount: 0,
currency: String
},
warningThreshold:
{
amount: 0,
currency: String
},
max:
{
amount: 0,
currency: String
}
}
],
payinTaxationPolicyId: String,
winningsCaps:
[
{
type: 0,
cap:
{
amount: 0,
currency: String
}
}
],
winningsTaxationPolicyId: String
},
productInstanceRef:
{
id: String,
val: String
},
ownerRef:
{
id: String,
val: String
},
isActive: False
}
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
}
}