| POST | /bets/payout |
|---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
enum BetSource : int
{
case Landbase = 0;
case Web = 1;
}
class TransactionDtoBase implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $transaction_id=null,
/** @var DateTime */
public DateTime $transaction_time=new DateTime(),
/** @var float */
public float $transaction_amount=0.0,
/** @var string|null */
public ?string $game_name=null,
/** @var string|null */
public ?string $betting_place_id=null,
/** @var string|null */
public ?string $betting_terminal_id=null,
/** @var string|null */
public ?string $jmbg=null,
/** @var string|null */
public ?string $passport_number=null,
/** @var BetSource|null */
public ?BetSource $source=null,
/** @var string|null */
public ?string $identification_document_country=null,
/** @var string|null */
public ?string $identification_document_type=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['transaction_id'])) $this->transaction_id = $o['transaction_id'];
if (isset($o['transaction_time'])) $this->transaction_time = JsonConverters::from('DateTime', $o['transaction_time']);
if (isset($o['transaction_amount'])) $this->transaction_amount = $o['transaction_amount'];
if (isset($o['game_name'])) $this->game_name = $o['game_name'];
if (isset($o['betting_place_id'])) $this->betting_place_id = $o['betting_place_id'];
if (isset($o['betting_terminal_id'])) $this->betting_terminal_id = $o['betting_terminal_id'];
if (isset($o['jmbg'])) $this->jmbg = $o['jmbg'];
if (isset($o['passport_number'])) $this->passport_number = $o['passport_number'];
if (isset($o['source'])) $this->source = JsonConverters::from('BetSource', $o['source']);
if (isset($o['identification_document_country'])) $this->identification_document_country = $o['identification_document_country'];
if (isset($o['identification_document_type'])) $this->identification_document_type = $o['identification_document_type'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->transaction_id)) $o['transaction_id'] = $this->transaction_id;
if (isset($this->transaction_time)) $o['transaction_time'] = JsonConverters::to('DateTime', $this->transaction_time);
if (isset($this->transaction_amount)) $o['transaction_amount'] = $this->transaction_amount;
if (isset($this->game_name)) $o['game_name'] = $this->game_name;
if (isset($this->betting_place_id)) $o['betting_place_id'] = $this->betting_place_id;
if (isset($this->betting_terminal_id)) $o['betting_terminal_id'] = $this->betting_terminal_id;
if (isset($this->jmbg)) $o['jmbg'] = $this->jmbg;
if (isset($this->passport_number)) $o['passport_number'] = $this->passport_number;
if (isset($this->source)) $o['source'] = JsonConverters::to('BetSource', $this->source);
if (isset($this->identification_document_country)) $o['identification_document_country'] = $this->identification_document_country;
if (isset($this->identification_document_type)) $o['identification_document_type'] = $this->identification_document_type;
return empty($o) ? new class(){} : $o;
}
}
enum WinType : int
{
case Regular = 0;
case Cashback = 1;
case Cashout = 2;
}
interface IBetEvent
{
}
class WinDto extends TransactionDtoBase implements JsonSerializable
{
/**
* @param string|null $transaction_id
* @param DateTime $transaction_time
* @param float $transaction_amount
* @param string|null $game_name
* @param string|null $betting_place_id
* @param string|null $betting_terminal_id
* @param string|null $jmbg
* @param string|null $passport_number
* @param BetSource|null $source
* @param string|null $identification_document_country
* @param string|null $identification_document_type
*/
public function __construct(
?string $transaction_id=null,
DateTime $transaction_time=new DateTime(),
float $transaction_amount=0.0,
?string $game_name=null,
?string $betting_place_id=null,
?string $betting_terminal_id=null,
?string $jmbg=null,
?string $passport_number=null,
?BetSource $source=null,
?string $identification_document_country=null,
?string $identification_document_type=null,
/** @var string|null */
public ?string $bet_transaction_id=null,
/** @var string|null */
public ?string $ticket_id=null,
/** @var float */
public float $win_odds=0.0,
/** @var WinType|null */
public ?WinType $win_type=null,
/** @var float */
public float $bonus=0.0,
/** @var bool|null */
public ?bool $cancel=null,
/** @var RecordList<IBetEvent>|null */
public ?RecordList $canceled_events=null
) {
parent::__construct($transaction_id,$transaction_time,$transaction_amount,$game_name,$betting_place_id,$betting_terminal_id,$jmbg,$passport_number,$source,$identification_document_country,$identification_document_type);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['bet_transaction_id'])) $this->bet_transaction_id = $o['bet_transaction_id'];
if (isset($o['ticket_id'])) $this->ticket_id = $o['ticket_id'];
if (isset($o['win_odds'])) $this->win_odds = $o['win_odds'];
if (isset($o['win_type'])) $this->win_type = JsonConverters::from('WinType', $o['win_type']);
if (isset($o['bonus'])) $this->bonus = $o['bonus'];
if (isset($o['cancel'])) $this->cancel = $o['cancel'];
if (isset($o['canceled_events'])) $this->canceled_events = JsonConverters::from(JsonConverters::context('RecordList',genericArgs:['IBetEvent']), $o['canceled_events']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->bet_transaction_id)) $o['bet_transaction_id'] = $this->bet_transaction_id;
if (isset($this->ticket_id)) $o['ticket_id'] = $this->ticket_id;
if (isset($this->win_odds)) $o['win_odds'] = $this->win_odds;
if (isset($this->win_type)) $o['win_type'] = JsonConverters::to('WinType', $this->win_type);
if (isset($this->bonus)) $o['bonus'] = $this->bonus;
if (isset($this->cancel)) $o['cancel'] = $this->cancel;
if (isset($this->canceled_events)) $o['canceled_events'] = JsonConverters::to(JsonConverters::context('RecordList',genericArgs:['IBetEvent']), $this->canceled_events);
return empty($o) ? new class(){} : $o;
}
}
class ReportBetPayouts implements JsonSerializable
{
public function __construct(
/** @var RecordList<WinDto>|null */
public ?RecordList $betPayouts=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['betPayouts'])) $this->betPayouts = JsonConverters::from(JsonConverters::context('RecordList',genericArgs:['WinDto']), $o['betPayouts']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->betPayouts)) $o['betPayouts'] = JsonConverters::to(JsonConverters::context('RecordList',genericArgs:['WinDto']), $this->betPayouts);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
* @template array of T
*/
class RecordList extends \ArrayObject implements JsonSerializable
{
public function __construct(T ...$items) {
parent::__construct($items, \ArrayObject::STD_PROP_LIST);
}
/** @throws \Exception */
public function append($value): void {
if ($value instanceof T)
parent::append($value);
else
throw new \Exception("Can only append a T to " . __CLASS__);
}
/** @throws Exception */
public function fromMap($o): void {
foreach ($o as $item) {
$el = new T();
$el->fromMap($item);
$this->append($el);
}
}
/** @throws Exception */
public function jsonSerialize(): array {
return parent::getArrayCopy();
}
}
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/payout HTTP/1.1
Host: api.prod-mnta.webhop.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<ReportBetPayouts xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Starnet.MontenegroTaxationAuthority.WebApi.ServiceModel">
<BetPayouts xmlns:d2p1="http://schemas.datacontract.org/2004/07/Starnet.MontenegroTaxationAuthority.Common">
<d2p1:WinDto>
<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_transaction_id>String</d2p1:bet_transaction_id>
<d2p1:bonus>0</d2p1:bonus>
<d2p1:cancel>false</d2p1:cancel>
<d2p1:canceled_events xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:anyType i:nil="true" />
</d2p1:canceled_events>
<d2p1:ticket_id>String</d2p1:ticket_id>
<d2p1:win_odds>0</d2p1:win_odds>
<d2p1:win_type>Regular</d2p1:win_type>
</d2p1:WinDto>
</BetPayouts>
</ReportBetPayouts>
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>