DX STF Client API

<back to all web services

SearchClaim

Claim Requests

Claim

Requires Authentication
The following routes are available for this service:
POST/api/claim/searchSearch for claims based on parameters
<?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};


class _Buyer implements IBuyer, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $gln=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['gln'])) $this->gln = $o['gln'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->gln)) $o['gln'] = $this->gln;
        return empty($o) ? new class(){} : $o;
    }
}

class _ClaimNotification implements IClaimNotification, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $entityIdentification=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['entityIdentification'])) $this->entityIdentification = $o['entityIdentification'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->entityIdentification)) $o['entityIdentification'] = $this->entityIdentification;
        return empty($o) ? new class(){} : $o;
    }
}

class _Invoice implements IInvoice, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $entityIdentification=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['entityIdentification'])) $this->entityIdentification = $o['entityIdentification'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->entityIdentification)) $o['entityIdentification'] = $this->entityIdentification;
        return empty($o) ? new class(){} : $o;
    }
}

class SearchClaimQuery implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $receiverGln='',
        /** @var DateTime */
        public DateTime $fromDate=new DateTime(),
        /** @var DateTime */
        public DateTime $toDate=new DateTime(),
        /** @var string */
        public string $claimsNotificationTypeCode='',
        /** @var string */
        public string $claimsNotificationIdentification='',
        /** @var _Buyer|null */
        public ?_Buyer $buyer=null,
        /** @var _ClaimNotification|null */
        public ?_ClaimNotification $claimNotification=null,
        /** @var _Invoice|null */
        public ?_Invoice $invoice=null,
        /** @var bool|null */
        public ?bool $excludeLinkedToCreditNote=null,
        /** @var string */
        public string $senderGln='',
        /** @var array<string>|null */
        public ?array $partnerGln=null,
        /** @var int */
        public int $requestedPage=0,
        /** @var int */
        public int $numberOfRecordsPerPage=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['receiverGln'])) $this->receiverGln = $o['receiverGln'];
        if (isset($o['fromDate'])) $this->fromDate = JsonConverters::from('DateTime', $o['fromDate']);
        if (isset($o['toDate'])) $this->toDate = JsonConverters::from('DateTime', $o['toDate']);
        if (isset($o['claimsNotificationTypeCode'])) $this->claimsNotificationTypeCode = $o['claimsNotificationTypeCode'];
        if (isset($o['claimsNotificationIdentification'])) $this->claimsNotificationIdentification = $o['claimsNotificationIdentification'];
        if (isset($o['buyer'])) $this->buyer = JsonConverters::from('_Buyer', $o['buyer']);
        if (isset($o['claimNotification'])) $this->claimNotification = JsonConverters::from('_ClaimNotification', $o['claimNotification']);
        if (isset($o['invoice'])) $this->invoice = JsonConverters::from('_Invoice', $o['invoice']);
        if (isset($o['excludeLinkedToCreditNote'])) $this->excludeLinkedToCreditNote = $o['excludeLinkedToCreditNote'];
        if (isset($o['senderGln'])) $this->senderGln = $o['senderGln'];
        if (isset($o['partnerGln'])) $this->partnerGln = JsonConverters::fromArray('string', $o['partnerGln']);
        if (isset($o['requestedPage'])) $this->requestedPage = $o['requestedPage'];
        if (isset($o['numberOfRecordsPerPage'])) $this->numberOfRecordsPerPage = $o['numberOfRecordsPerPage'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->receiverGln)) $o['receiverGln'] = $this->receiverGln;
        if (isset($this->fromDate)) $o['fromDate'] = JsonConverters::to('DateTime', $this->fromDate);
        if (isset($this->toDate)) $o['toDate'] = JsonConverters::to('DateTime', $this->toDate);
        if (isset($this->claimsNotificationTypeCode)) $o['claimsNotificationTypeCode'] = $this->claimsNotificationTypeCode;
        if (isset($this->claimsNotificationIdentification)) $o['claimsNotificationIdentification'] = $this->claimsNotificationIdentification;
        if (isset($this->buyer)) $o['buyer'] = JsonConverters::to('_Buyer', $this->buyer);
        if (isset($this->claimNotification)) $o['claimNotification'] = JsonConverters::to('_ClaimNotification', $this->claimNotification);
        if (isset($this->invoice)) $o['invoice'] = JsonConverters::to('_Invoice', $this->invoice);
        if (isset($this->excludeLinkedToCreditNote)) $o['excludeLinkedToCreditNote'] = $this->excludeLinkedToCreditNote;
        if (isset($this->senderGln)) $o['senderGln'] = $this->senderGln;
        if (isset($this->partnerGln)) $o['partnerGln'] = JsonConverters::toArray('string', $this->partnerGln);
        if (isset($this->requestedPage)) $o['requestedPage'] = $this->requestedPage;
        if (isset($this->numberOfRecordsPerPage)) $o['numberOfRecordsPerPage'] = $this->numberOfRecordsPerPage;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Claim */
// @Api(Description="Claim")
// @ApiResponse(Description="Claim search results", StatusCode=200)
class SearchClaim implements JsonSerializable
{
    public function __construct(
        // @ApiMember(ParameterType="model")
        /** @var SearchClaimQuery|null */
        public ?SearchClaimQuery $query=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['query'])) $this->query = JsonConverters::from('SearchClaimQuery', $o['query']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->query)) $o['query'] = JsonConverters::to('SearchClaimQuery', $this->query);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template T
 */
class PagedQueryResult implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): PagedQueryResult {
        $to = new PagedQueryResult();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        /** @var int */
        public mixed $startIndex=0,
        /** @var int */
        public mixed $endIndex=0,
        /** @var int */
        public mixed $numberOfRecordsReturned=0,
        /** @var int */
        public mixed $totalNumberOfPages=0,
        /** @var int */
        public mixed $totalNumberOfRecords=0,
        /** @var array<ResultItem<ClaimMessage>>|null */
        public mixed $results=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['startIndex'])) $this->startIndex = $o['startIndex'];
        if (isset($o['endIndex'])) $this->endIndex = $o['endIndex'];
        if (isset($o['numberOfRecordsReturned'])) $this->numberOfRecordsReturned = $o['numberOfRecordsReturned'];
        if (isset($o['totalNumberOfPages'])) $this->totalNumberOfPages = $o['totalNumberOfPages'];
        if (isset($o['totalNumberOfRecords'])) $this->totalNumberOfRecords = $o['totalNumberOfRecords'];
        if (isset($o['results'])) $this->results = JsonConverters::fromArray('ResultItem<ClaimMessage>', $o['results']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->startIndex)) $o['startIndex'] = $this->startIndex;
        if (isset($this->endIndex)) $o['endIndex'] = $this->endIndex;
        if (isset($this->numberOfRecordsReturned)) $o['numberOfRecordsReturned'] = $this->numberOfRecordsReturned;
        if (isset($this->totalNumberOfPages)) $o['totalNumberOfPages'] = $this->totalNumberOfPages;
        if (isset($this->totalNumberOfRecords)) $o['totalNumberOfRecords'] = $this->totalNumberOfRecords;
        if (isset($this->results)) $o['results'] = JsonConverters::toArray('ResultItem<ClaimMessage>', $this->results);
        return empty($o) ? new class(){} : $o;
    }
}

PHP SearchClaim DTOs

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

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/claim/search HTTP/1.1 
Host: stf-api-uat.data-xchange.co.za 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"query":{"receiverGln":"String","claimsNotificationTypeCode":"String","claimsNotificationIdentification":"String","buyer":{"gln":"String"},"claimNotification":{"entityIdentification":"String"},"invoice":{"entityIdentification":"String"},"excludeLinkedToCreditNote":false,"senderGln":"String","partnerGln":["String"],"requestedPage":0,"numberOfRecordsPerPage":0}}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"startIndex":0,"endIndex":0,"numberOfRecordsReturned":0,"totalNumberOfPages":0,"totalNumberOfRecords":0,"results":[{}]}