Starnet.MontenegroTaxationAuthority.WebApi

<back to all web services

ReportBetCancellations

The following routes are available for this service:
POST/bets/cancel
<?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 RollbackTransactionType : int
{
    case Bet = 0;
    case Win = 1;
    case Jackpot = 1;
}

class RollbackDto 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 $rollback_transaction_id=null,
        /** @var string|null */
        public ?string $ticket_id=null,
        /** @var RollbackTransactionType|null */
        public ?RollbackTransactionType $rollback_transaction_type=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['rollback_transaction_id'])) $this->rollback_transaction_id = $o['rollback_transaction_id'];
        if (isset($o['ticket_id'])) $this->ticket_id = $o['ticket_id'];
        if (isset($o['rollback_transaction_type'])) $this->rollback_transaction_type = JsonConverters::from('RollbackTransactionType', $o['rollback_transaction_type']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->rollback_transaction_id)) $o['rollback_transaction_id'] = $this->rollback_transaction_id;
        if (isset($this->ticket_id)) $o['ticket_id'] = $this->ticket_id;
        if (isset($this->rollback_transaction_type)) $o['rollback_transaction_type'] = JsonConverters::to('RollbackTransactionType', $this->rollback_transaction_type);
        return empty($o) ? new class(){} : $o;
    }
}

class ReportBetCancellations implements JsonSerializable
{
    public function __construct(
        /** @var RecordList<RollbackDto>|null */
        public ?RecordList $betCancellations=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['betCancellations'])) $this->betCancellations = JsonConverters::from(JsonConverters::context('RecordList',genericArgs:['RollbackDto']), $o['betCancellations']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->betCancellations)) $o['betCancellations'] = JsonConverters::to(JsonConverters::context('RecordList',genericArgs:['RollbackDto']), $this->betCancellations);
        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();
    }
}

PHP ReportBetCancellations DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + 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.sbbet-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"}}