2Service Services API

<back to all web services

GetOrderTracking

The following routes are available for this service:
GET/dealers/order/trackingRetrieves tracking numbers based on order number.
<?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 AuthenticatedRequest implements JsonSerializable
{
    public function __construct(
        /** @description Session token received from successful authentication. */
        // @ApiMember(Description="Session token received from successful authentication.", IsRequired=true, ParameterType="query")
        /** @var string */
        public string $SessionToken=''
    ) {
    }

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

enum OrderStatus : int
{
    case Open = 1;
    case Completed = 2;
    case Cancelled = 3;
}

class ShipmentArticleResult implements JsonSerializable
{
    public function __construct(
        /** @description Order number. */
        // @ApiMember(Description="Order number.")
        /** @var string|null */
        public ?string $OrderNumber=null,

        /** @description Article number. */
        // @ApiMember(Description="Article number.")
        /** @var string|null */
        public ?string $ArticleNumber=null,

        /** @description Quantity. */
        // @ApiMember(Description="Quantity.")
        /** @var int */
        public int $Quantity=0,

        /** @description Custom reference. */
        // @ApiMember(Description="Custom reference.")
        /** @var string|null */
        public ?string $CustomReference=null
    ) {
    }

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

class ShipmentPackageResult implements JsonSerializable
{
    public function __construct(
        /** @description Shipment method. */
        // @ApiMember(Description="Shipment method.")
        /** @var string|null */
        public ?string $ShipmentMethod=null,

        /** @description Tracking number. */
        // @ApiMember(Description="Tracking number.")
        /** @var string|null */
        public ?string $TrackingNumber=null,

        /** @description Tracking URL. */
        // @ApiMember(Description="Tracking URL.")
        /** @var string|null */
        public ?string $TrackingUrl=null
    ) {
    }

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

class ShipmentResult implements JsonSerializable
{
    public function __construct(
        /** @description ID of the shipment. */
        // @ApiMember(Description="ID of the shipment.")
        /** @var int */
        public int $ShipmentId=0,

        /** @description Determines of the shipment has been dispatched. */
        // @ApiMember(Description="Determines of the shipment has been dispatched.")
        /** @var bool|null */
        public ?bool $HasBeenDispatched=null,

        /** @description Date/time of dispatch. */
        // @ApiMember(Description="Date/time of dispatch.")
        /** @var DateTime|null */
        public ?DateTime $DispatchDate=null,

        /** @description List of articles in shipment. */
        // @ApiMember(Description="List of articles in shipment.")
        /** @var array<ShipmentArticleResult>|null */
        public ?array $Articles=null,

        /** @description List of packages for shipment. */
        // @ApiMember(Description="List of packages for shipment.")
        /** @var array<ShipmentPackageResult>|null */
        public ?array $Packages=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ShipmentId'])) $this->ShipmentId = $o['ShipmentId'];
        if (isset($o['HasBeenDispatched'])) $this->HasBeenDispatched = $o['HasBeenDispatched'];
        if (isset($o['DispatchDate'])) $this->DispatchDate = JsonConverters::from('DateTime', $o['DispatchDate']);
        if (isset($o['Articles'])) $this->Articles = JsonConverters::fromArray('ShipmentArticleResult', $o['Articles']);
        if (isset($o['Packages'])) $this->Packages = JsonConverters::fromArray('ShipmentPackageResult', $o['Packages']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ShipmentId)) $o['ShipmentId'] = $this->ShipmentId;
        if (isset($this->HasBeenDispatched)) $o['HasBeenDispatched'] = $this->HasBeenDispatched;
        if (isset($this->DispatchDate)) $o['DispatchDate'] = JsonConverters::to('DateTime', $this->DispatchDate);
        if (isset($this->Articles)) $o['Articles'] = JsonConverters::toArray('ShipmentArticleResult', $this->Articles);
        if (isset($this->Packages)) $o['Packages'] = JsonConverters::toArray('ShipmentPackageResult', $this->Packages);
        return empty($o) ? new class(){} : $o;
    }
}

class OrderTrackingResult implements JsonSerializable
{
    public function __construct(
        /** @description Order number. */
        // @ApiMember(Description="Order number.")
        /** @var string|null */
        public ?string $OrderNumber=null,

        /** @description Order date. */
        // @ApiMember(Description="Order date.")
        /** @var DateTime */
        public DateTime $OrderDate=new DateTime(),

        /** @description Order status. */
        // @ApiMember(Description="Order status.")
        /** @var OrderStatus|null */
        public ?OrderStatus $Status=null,

        /** @description List of shipments (if any). */
        // @ApiMember(Description="List of shipments (if any).")
        /** @var array<ShipmentResult>|null */
        public ?array $Shipments=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['OrderNumber'])) $this->OrderNumber = $o['OrderNumber'];
        if (isset($o['OrderDate'])) $this->OrderDate = JsonConverters::from('DateTime', $o['OrderDate']);
        if (isset($o['Status'])) $this->Status = JsonConverters::from('OrderStatus', $o['Status']);
        if (isset($o['Shipments'])) $this->Shipments = JsonConverters::fromArray('ShipmentResult', $o['Shipments']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->OrderNumber)) $o['OrderNumber'] = $this->OrderNumber;
        if (isset($this->OrderDate)) $o['OrderDate'] = JsonConverters::to('DateTime', $this->OrderDate);
        if (isset($this->Status)) $o['Status'] = JsonConverters::to('OrderStatus', $this->Status);
        if (isset($this->Shipments)) $o['Shipments'] = JsonConverters::toArray('ShipmentResult', $this->Shipments);
        return empty($o) ? new class(){} : $o;
    }
}

class OperationResult implements JsonSerializable
{
    public function __construct(
        /** @description Specifies if the operation was successful. */
        // @ApiMember(Description="Specifies if the operation was successful.", ParameterType="model")
        /** @var bool|null */
        public ?bool $IsSuccessful=null,

        /** @description States error message in case of unsuccessful operation. */
        // @ApiMember(Description="States error message in case of unsuccessful operation.", ParameterType="model")
        /** @var string|null */
        public ?string $ErrorMessage=null
    ) {
    }

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

class PartInfoResultImage implements JsonSerializable
{
    public function __construct(
        /** @description Image number */
        // @ApiMember(Description="Image number")
        /** @var int */
        public int $ImageNumber=0,

        /** @description Image URL */
        // @ApiMember(Description="Image URL")
        /** @var string|null */
        public ?string $ImageUrl=null
    ) {
    }

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

class PartStockQuantity implements JsonSerializable
{
    public function __construct(
        /** @description Location ID */
        // @ApiMember(Description="Location ID")
        /** @var int */
        public int $LocationId=0,

        /** @description Location code */
        // @ApiMember(Description="Location code")
        /** @var string|null */
        public ?string $LocationCode=null,

        /** @description Stock quantity in location */
        // @ApiMember(Description="Stock quantity in location")
        /** @var int */
        public int $StockQuantity=0
    ) {
    }

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

class PartInfoResult implements JsonSerializable
{
    public function __construct(
        /** @description Unique ID for the part. */
        // @ApiMember(Description="Unique ID for the part.")
        /** @var int */
        public int $Id=0,

        /** @description Part number. */
        // @ApiMember(Description="Part number.")
        /** @var string|null */
        public ?string $PartNumber=null,

        /** @description Description of the part. */
        // @ApiMember(Description="Description of the part.")
        /** @var string|null */
        public ?string $Description=null,

        /** @description Part manufacturer. */
        // @ApiMember(Description="Part manufacturer.")
        /** @var string|null */
        public ?string $Manufacturer=null,

        /** @description Determines if the part can be ordered. */
        // @ApiMember(Description="Determines if the part can be ordered.")
        /** @var bool|null */
        public ?bool $CanBeOrdered=null,

        /** @description Textual representation of the status of the part. */
        // @ApiMember(Description="Textual representation of the status of the part.")
        /** @var string|null */
        public ?string $StatusText=null,

        /** @description Available stock to order. */
        // @ApiMember(Description="Available stock to order.")
        /** @var int */
        public int $AvailableStockQuantity=0,

        /** @description Average days needed for delivery. */
        // @ApiMember(Description="Average days needed for delivery.")
        /** @var int|null */
        public ?int $AverageDeliveryInDays=null,

        /** @description Price of a single unit, excluding VAT. */
        // @ApiMember(Description="Price of a single unit, excluding VAT.")
        /** @var float|null */
        public ?float $UnitPrice=null,

        /** @description EAN number. */
        // @ApiMember(Description="EAN number.")
        /** @var string|null */
        public ?string $EanNumber=null,

        /** @description Images */
        // @ApiMember(Description="Images")
        /** @var array<PartInfoResultImage>|null */
        public ?array $Images=null,

        /** @description Secondary article numbers */
        // @ApiMember(Description="Secondary article numbers")
        /** @var array<string>|null */
        public ?array $SecondaryArticleNumbers=null,

        /** @description Replacement article numbers */
        // @ApiMember(Description="Replacement article numbers")
        /** @var array<string>|null */
        public ?array $ReplacementArticleNumbers=null,

        /** @description Stock quantities */
        // @ApiMember(Description="Stock quantities")
        /** @var array<PartStockQuantity>|null */
        public ?array $StockQuantities=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['PartNumber'])) $this->PartNumber = $o['PartNumber'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Manufacturer'])) $this->Manufacturer = $o['Manufacturer'];
        if (isset($o['CanBeOrdered'])) $this->CanBeOrdered = $o['CanBeOrdered'];
        if (isset($o['StatusText'])) $this->StatusText = $o['StatusText'];
        if (isset($o['AvailableStockQuantity'])) $this->AvailableStockQuantity = $o['AvailableStockQuantity'];
        if (isset($o['AverageDeliveryInDays'])) $this->AverageDeliveryInDays = $o['AverageDeliveryInDays'];
        if (isset($o['UnitPrice'])) $this->UnitPrice = $o['UnitPrice'];
        if (isset($o['EanNumber'])) $this->EanNumber = $o['EanNumber'];
        if (isset($o['Images'])) $this->Images = JsonConverters::fromArray('PartInfoResultImage', $o['Images']);
        if (isset($o['SecondaryArticleNumbers'])) $this->SecondaryArticleNumbers = JsonConverters::fromArray('string', $o['SecondaryArticleNumbers']);
        if (isset($o['ReplacementArticleNumbers'])) $this->ReplacementArticleNumbers = JsonConverters::fromArray('string', $o['ReplacementArticleNumbers']);
        if (isset($o['StockQuantities'])) $this->StockQuantities = JsonConverters::fromArray('PartStockQuantity', $o['StockQuantities']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->PartNumber)) $o['PartNumber'] = $this->PartNumber;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Manufacturer)) $o['Manufacturer'] = $this->Manufacturer;
        if (isset($this->CanBeOrdered)) $o['CanBeOrdered'] = $this->CanBeOrdered;
        if (isset($this->StatusText)) $o['StatusText'] = $this->StatusText;
        if (isset($this->AvailableStockQuantity)) $o['AvailableStockQuantity'] = $this->AvailableStockQuantity;
        if (isset($this->AverageDeliveryInDays)) $o['AverageDeliveryInDays'] = $this->AverageDeliveryInDays;
        if (isset($this->UnitPrice)) $o['UnitPrice'] = $this->UnitPrice;
        if (isset($this->EanNumber)) $o['EanNumber'] = $this->EanNumber;
        if (isset($this->Images)) $o['Images'] = JsonConverters::toArray('PartInfoResultImage', $this->Images);
        if (isset($this->SecondaryArticleNumbers)) $o['SecondaryArticleNumbers'] = JsonConverters::toArray('string', $this->SecondaryArticleNumbers);
        if (isset($this->ReplacementArticleNumbers)) $o['ReplacementArticleNumbers'] = JsonConverters::toArray('string', $this->ReplacementArticleNumbers);
        if (isset($this->StockQuantities)) $o['StockQuantities'] = JsonConverters::toArray('PartStockQuantity', $this->StockQuantities);
        return empty($o) ? new class(){} : $o;
    }
}

class PartResults implements JsonSerializable
{
    public function __construct(
        /** @description Total number of parts available. */
        // @ApiMember(Description="Total number of parts available.")
        /** @var int */
        public int $TotalNumberOfParts=0,

        /** @description Indication if there are more parts to retrieve. */
        // @ApiMember(Description="Indication if there are more parts to retrieve.")
        /** @var bool|null */
        public ?bool $HasMoreRecords=null,

        /** @description Part records. */
        // @ApiMember(Description="Part records.")
        /** @var array<PartInfoResult>|null */
        public ?array $Parts=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['TotalNumberOfParts'])) $this->TotalNumberOfParts = $o['TotalNumberOfParts'];
        if (isset($o['HasMoreRecords'])) $this->HasMoreRecords = $o['HasMoreRecords'];
        if (isset($o['Parts'])) $this->Parts = JsonConverters::fromArray('PartInfoResult', $o['Parts']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->TotalNumberOfParts)) $o['TotalNumberOfParts'] = $this->TotalNumberOfParts;
        if (isset($this->HasMoreRecords)) $o['HasMoreRecords'] = $this->HasMoreRecords;
        if (isset($this->Parts)) $o['Parts'] = JsonConverters::toArray('PartInfoResult', $this->Parts);
        return empty($o) ? new class(){} : $o;
    }
}

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

    /**
     * @param bool|null $IsSuccessful
     * @param string|null $ErrorMessage
     */
    public function __construct(
        mixed $IsSuccessful=null,
        mixed $ErrorMessage=null,
        /** @description Result value */
        // @ApiMember(Description="Result value", ParameterType="model")
        /** @var PartResults|null */
        public mixed $Result=null
    ) {
        parent::__construct($IsSuccessful,$ErrorMessage);
    }

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

/**
 * @template OperationResult1 of OrderTrackingResult
 */
class OrderTrackingResponse extends OperationResult1 implements JsonSerializable
{
    /**
     * @param bool|null $IsSuccessful
     * @param string|null $ErrorMessage
     * @param PartResults|null $Result
     */
    public function __construct(
        ?bool $IsSuccessful=null,
        ?string $ErrorMessage=null,
        ?PartResults $Result=null
    ) {
        parent::__construct($IsSuccessful,$ErrorMessage,$Result);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

class GetOrderTracking extends AuthenticatedRequest implements JsonSerializable
{
    /**
     * @param string $SessionToken
     */
    public function __construct(
        string $SessionToken='',
        /** @description Order number to retrieve tracking for. */
        // @ApiMember(Description="Order number to retrieve tracking for.", IsRequired=true)
        /** @var string */
        public string $OrderNumber=''
    ) {
        parent::__construct($SessionToken);
    }

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

PHP GetOrderTracking 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 /dealers/order/tracking HTTP/1.1 
Host: services.acct.2service.nl 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Result: 
	{
		OrderNumber: String,
		OrderDate: 0001-01-01,
		Status: Open,
		Shipments: 
		[
			{
				ShipmentId: 0,
				HasBeenDispatched: False,
				DispatchDate: 0001-01-01,
				Articles: 
				[
					{
						OrderNumber: String,
						ArticleNumber: String,
						Quantity: 0,
						CustomReference: String
					}
				],
				Packages: 
				[
					{
						ShipmentMethod: String,
						TrackingNumber: String,
						TrackingUrl: String
					}
				]
			}
		]
	},
	IsSuccessful: False,
	ErrorMessage: String
}