Trendsic Platform Service

<back to all web services

CourierBookOrderRequest

The following routes are available for this service:
POST,OPTIONS/v1/book/{Slug}/orders
POST,OPTIONS/v1/book/{Slug}/orders/confirm
<?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 CourierBookOrderResponse implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $Done=null,
        /** @var bool|null */
        public ?bool $NeedsAction=null,
        /** @var string|null */
        public ?string $ClientSecret=null,
        /** @var string|null */
        public ?string $SetupIntentId=null,
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $TrackUrl=null,
        /** @var string|null */
        public ?string $IcsUrl=null,
        /** @var string|null */
        public ?string $WindowText=null,
        /** @var string|null */
        public ?string $Promise=null,
        /** @var float */
        public float $Total=0.0,
        /** @var string|null */
        public ?string $PayTiming=null,
        /** @var string|null */
        public ?string $CardLast4=null,
        /** @var string|null */
        public ?string $Repeats=null,
        /** @var string|null */
        public ?string $LinkSentBy=null,
        /** @var string|null */
        public ?string $ReopenStep=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Done'])) $this->Done = $o['Done'];
        if (isset($o['NeedsAction'])) $this->NeedsAction = $o['NeedsAction'];
        if (isset($o['ClientSecret'])) $this->ClientSecret = $o['ClientSecret'];
        if (isset($o['SetupIntentId'])) $this->SetupIntentId = $o['SetupIntentId'];
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['TrackUrl'])) $this->TrackUrl = $o['TrackUrl'];
        if (isset($o['IcsUrl'])) $this->IcsUrl = $o['IcsUrl'];
        if (isset($o['WindowText'])) $this->WindowText = $o['WindowText'];
        if (isset($o['Promise'])) $this->Promise = $o['Promise'];
        if (isset($o['Total'])) $this->Total = $o['Total'];
        if (isset($o['PayTiming'])) $this->PayTiming = $o['PayTiming'];
        if (isset($o['CardLast4'])) $this->CardLast4 = $o['CardLast4'];
        if (isset($o['Repeats'])) $this->Repeats = $o['Repeats'];
        if (isset($o['LinkSentBy'])) $this->LinkSentBy = $o['LinkSentBy'];
        if (isset($o['ReopenStep'])) $this->ReopenStep = $o['ReopenStep'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Done)) $o['Done'] = $this->Done;
        if (isset($this->NeedsAction)) $o['NeedsAction'] = $this->NeedsAction;
        if (isset($this->ClientSecret)) $o['ClientSecret'] = $this->ClientSecret;
        if (isset($this->SetupIntentId)) $o['SetupIntentId'] = $this->SetupIntentId;
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->TrackUrl)) $o['TrackUrl'] = $this->TrackUrl;
        if (isset($this->IcsUrl)) $o['IcsUrl'] = $this->IcsUrl;
        if (isset($this->WindowText)) $o['WindowText'] = $this->WindowText;
        if (isset($this->Promise)) $o['Promise'] = $this->Promise;
        if (isset($this->Total)) $o['Total'] = $this->Total;
        if (isset($this->PayTiming)) $o['PayTiming'] = $this->PayTiming;
        if (isset($this->CardLast4)) $o['CardLast4'] = $this->CardLast4;
        if (isset($this->Repeats)) $o['Repeats'] = $this->Repeats;
        if (isset($this->LinkSentBy)) $o['LinkSentBy'] = $this->LinkSentBy;
        if (isset($this->ReopenStep)) $o['ReopenStep'] = $this->ReopenStep;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class CourierBookOrderRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Slug=null,
        /** @var string|null */
        public ?string $Profile=null,
        /** @var string|null */
        public ?string $TurnstileToken=null,
        /** @var string|null */
        public ?string $Level=null,
        /** @var string|null */
        public ?string $WindowId=null,
        /** @var string|null */
        public ?string $Recur=null,
        /** @var string|null */
        public ?string $Address=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var string|null */
        public ?string $City=null,
        /** @var string|null */
        public ?string $Zip=null,
        /** @var float|null */
        public ?float $Lat=null,
        /** @var float|null */
        public ?float $Lng=null,
        /** @var string|null */
        public ?string $PickupName=null,
        /** @var string|null */
        public ?string $DropAddress=null,
        /** @var string|null */
        public ?string $DropUnit=null,
        /** @var string|null */
        public ?string $DropCity=null,
        /** @var string|null */
        public ?string $DropZip=null,
        /** @var float|null */
        public ?float $DropLat=null,
        /** @var float|null */
        public ?float $DropLng=null,
        /** @var string|null */
        public ?string $RecipientName=null,
        /** @var int */
        public int $Units=0,
        /** @var string|null */
        public ?string $Handoff=null,
        /** @var string|null */
        public ?string $GateCode=null,
        /** @var string|null */
        public ?string $Note=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Phone=null,
        /** @var string|null */
        public ?string $Email=null,
        /** @var bool|null */
        public ?bool $SmsConsent=null,
        /** @var bool|null */
        public ?bool $Terms=null,
        /** @var string|null */
        public ?string $PaymentMethodId=null,
        /** @var string|null */
        public ?string $SetupIntentId=null,
        /** @var float|null */
        public ?float $QuotedTotal=null,
        /** @var string|null */
        public ?string $Lang=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Slug'])) $this->Slug = $o['Slug'];
        if (isset($o['Profile'])) $this->Profile = $o['Profile'];
        if (isset($o['TurnstileToken'])) $this->TurnstileToken = $o['TurnstileToken'];
        if (isset($o['Level'])) $this->Level = $o['Level'];
        if (isset($o['WindowId'])) $this->WindowId = $o['WindowId'];
        if (isset($o['Recur'])) $this->Recur = $o['Recur'];
        if (isset($o['Address'])) $this->Address = $o['Address'];
        if (isset($o['Unit'])) $this->Unit = $o['Unit'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
        if (isset($o['PickupName'])) $this->PickupName = $o['PickupName'];
        if (isset($o['DropAddress'])) $this->DropAddress = $o['DropAddress'];
        if (isset($o['DropUnit'])) $this->DropUnit = $o['DropUnit'];
        if (isset($o['DropCity'])) $this->DropCity = $o['DropCity'];
        if (isset($o['DropZip'])) $this->DropZip = $o['DropZip'];
        if (isset($o['DropLat'])) $this->DropLat = $o['DropLat'];
        if (isset($o['DropLng'])) $this->DropLng = $o['DropLng'];
        if (isset($o['RecipientName'])) $this->RecipientName = $o['RecipientName'];
        if (isset($o['Units'])) $this->Units = $o['Units'];
        if (isset($o['Handoff'])) $this->Handoff = $o['Handoff'];
        if (isset($o['GateCode'])) $this->GateCode = $o['GateCode'];
        if (isset($o['Note'])) $this->Note = $o['Note'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Phone'])) $this->Phone = $o['Phone'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['SmsConsent'])) $this->SmsConsent = $o['SmsConsent'];
        if (isset($o['Terms'])) $this->Terms = $o['Terms'];
        if (isset($o['PaymentMethodId'])) $this->PaymentMethodId = $o['PaymentMethodId'];
        if (isset($o['SetupIntentId'])) $this->SetupIntentId = $o['SetupIntentId'];
        if (isset($o['QuotedTotal'])) $this->QuotedTotal = $o['QuotedTotal'];
        if (isset($o['Lang'])) $this->Lang = $o['Lang'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Slug)) $o['Slug'] = $this->Slug;
        if (isset($this->Profile)) $o['Profile'] = $this->Profile;
        if (isset($this->TurnstileToken)) $o['TurnstileToken'] = $this->TurnstileToken;
        if (isset($this->Level)) $o['Level'] = $this->Level;
        if (isset($this->WindowId)) $o['WindowId'] = $this->WindowId;
        if (isset($this->Recur)) $o['Recur'] = $this->Recur;
        if (isset($this->Address)) $o['Address'] = $this->Address;
        if (isset($this->Unit)) $o['Unit'] = $this->Unit;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        if (isset($this->PickupName)) $o['PickupName'] = $this->PickupName;
        if (isset($this->DropAddress)) $o['DropAddress'] = $this->DropAddress;
        if (isset($this->DropUnit)) $o['DropUnit'] = $this->DropUnit;
        if (isset($this->DropCity)) $o['DropCity'] = $this->DropCity;
        if (isset($this->DropZip)) $o['DropZip'] = $this->DropZip;
        if (isset($this->DropLat)) $o['DropLat'] = $this->DropLat;
        if (isset($this->DropLng)) $o['DropLng'] = $this->DropLng;
        if (isset($this->RecipientName)) $o['RecipientName'] = $this->RecipientName;
        if (isset($this->Units)) $o['Units'] = $this->Units;
        if (isset($this->Handoff)) $o['Handoff'] = $this->Handoff;
        if (isset($this->GateCode)) $o['GateCode'] = $this->GateCode;
        if (isset($this->Note)) $o['Note'] = $this->Note;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Phone)) $o['Phone'] = $this->Phone;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->SmsConsent)) $o['SmsConsent'] = $this->SmsConsent;
        if (isset($this->Terms)) $o['Terms'] = $this->Terms;
        if (isset($this->PaymentMethodId)) $o['PaymentMethodId'] = $this->PaymentMethodId;
        if (isset($this->SetupIntentId)) $o['SetupIntentId'] = $this->SetupIntentId;
        if (isset($this->QuotedTotal)) $o['QuotedTotal'] = $this->QuotedTotal;
        if (isset($this->Lang)) $o['Lang'] = $this->Lang;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CourierBookOrderRequest 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.

POST /v1/book/{Slug}/orders HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Slug: String,
	Profile: String,
	TurnstileToken: String,
	Level: String,
	WindowId: String,
	Recur: String,
	Address: String,
	Unit: String,
	City: String,
	Zip: String,
	Lat: 0,
	Lng: 0,
	PickupName: String,
	DropAddress: String,
	DropUnit: String,
	DropCity: String,
	DropZip: String,
	DropLat: 0,
	DropLng: 0,
	RecipientName: String,
	Units: 0,
	Handoff: String,
	GateCode: String,
	Note: String,
	Name: String,
	Phone: String,
	Email: String,
	SmsConsent: False,
	Terms: False,
	PaymentMethodId: String,
	SetupIntentId: String,
	QuotedTotal: 0,
	Lang: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Done: False,
	NeedsAction: False,
	ClientSecret: String,
	SetupIntentId: String,
	Code: String,
	TrackUrl: String,
	IcsUrl: String,
	WindowText: String,
	Promise: String,
	Total: 0,
	PayTiming: String,
	CardLast4: String,
	Repeats: String,
	LinkSentBy: String,
	ReopenStep: String,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}