Trendsic Platform Service

<back to all web services

CourierDriverPayRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/worker/dispatch/od/pay
<?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 CourierPayLineView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $DispatchLoadID=0,
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $Label=null,
        /** @var float|null */
        public ?float $Qty=null,
        /** @var float|null */
        public ?float $Rate=null,
        /** @var float */
        public float $Amount=0.0
    ) {
    }

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

class CourierDriverPayRow implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $DispatchLoadID=0,
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $OrderCode=null,
        /** @var string|null */
        public ?string $RunCode=null,
        /** @var string|null */
        public ?string $QtyText=null,
        /** @var string|null */
        public ?string $SourceLabel=null,
        /** @var string|null */
        public ?string $DestinationLabel=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var float|null */
        public ?float $Pay=null,
        /** @var DateTime|null */
        public ?DateTime $OpenedUtc=null,
        /** @var DateTime|null */
        public ?DateTime $ClosedUtc=null,
        /** @var array<CourierPayLineView>|null */
        public ?array $Lines=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['DispatchLoadID'])) $this->DispatchLoadID = $o['DispatchLoadID'];
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['OrderCode'])) $this->OrderCode = $o['OrderCode'];
        if (isset($o['RunCode'])) $this->RunCode = $o['RunCode'];
        if (isset($o['QtyText'])) $this->QtyText = $o['QtyText'];
        if (isset($o['SourceLabel'])) $this->SourceLabel = $o['SourceLabel'];
        if (isset($o['DestinationLabel'])) $this->DestinationLabel = $o['DestinationLabel'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['Pay'])) $this->Pay = $o['Pay'];
        if (isset($o['OpenedUtc'])) $this->OpenedUtc = JsonConverters::from('DateTime', $o['OpenedUtc']);
        if (isset($o['ClosedUtc'])) $this->ClosedUtc = JsonConverters::from('DateTime', $o['ClosedUtc']);
        if (isset($o['Lines'])) $this->Lines = JsonConverters::fromArray('CourierPayLineView', $o['Lines']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->DispatchLoadID)) $o['DispatchLoadID'] = $this->DispatchLoadID;
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->OrderCode)) $o['OrderCode'] = $this->OrderCode;
        if (isset($this->RunCode)) $o['RunCode'] = $this->RunCode;
        if (isset($this->QtyText)) $o['QtyText'] = $this->QtyText;
        if (isset($this->SourceLabel)) $o['SourceLabel'] = $this->SourceLabel;
        if (isset($this->DestinationLabel)) $o['DestinationLabel'] = $this->DestinationLabel;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->Pay)) $o['Pay'] = $this->Pay;
        if (isset($this->OpenedUtc)) $o['OpenedUtc'] = JsonConverters::to('DateTime', $this->OpenedUtc);
        if (isset($this->ClosedUtc)) $o['ClosedUtc'] = JsonConverters::to('DateTime', $this->ClosedUtc);
        if (isset($this->Lines)) $o['Lines'] = JsonConverters::toArray('CourierPayLineView', $this->Lines);
        return empty($o) ? new class(){} : $o;
    }
}

class CourierDriverPayResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<CourierDriverPayRow>|null */
        public ?array $Rows=null,
        /** @var float */
        public float $Total=0.0,
        /** @var bool|null */
        public ?bool $Available=null,
        /** @var DateTime */
        public DateTime $ServerUtc=new DateTime(),
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Rows'])) $this->Rows = JsonConverters::fromArray('CourierDriverPayRow', $o['Rows']);
        if (isset($o['Total'])) $this->Total = $o['Total'];
        if (isset($o['Available'])) $this->Available = $o['Available'];
        if (isset($o['ServerUtc'])) $this->ServerUtc = JsonConverters::from('DateTime', $o['ServerUtc']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Rows)) $o['Rows'] = JsonConverters::toArray('CourierDriverPayRow', $this->Rows);
        if (isset($this->Total)) $o['Total'] = $this->Total;
        if (isset($this->Available)) $o['Available'] = $this->Available;
        if (isset($this->ServerUtc)) $o['ServerUtc'] = JsonConverters::to('DateTime', $this->ServerUtc);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class CourierDriverPayRequest implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP CourierDriverPayRequest DTOs

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

HTTP + JSV

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

GET /v1/worker/dispatch/od/pay HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Rows: 
	[
		{
			DispatchLoadID: 0,
			Code: String,
			Kind: String,
			OrderCode: String,
			RunCode: String,
			QtyText: String,
			SourceLabel: String,
			DestinationLabel: String,
			Status: String,
			Pay: 0,
			OpenedUtc: 0001-01-01,
			ClosedUtc: 0001-01-01,
			Lines: 
			[
				{
					DispatchLoadID: 0,
					Kind: String,
					Label: String,
					Qty: 0,
					Rate: 0,
					Amount: 0
				}
			]
		}
	],
	Total: 0,
	Available: False,
	ServerUtc: 0001-01-01,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}