| GET | /deliveryNote/{brand} | Get a list of Delivery Notes |
|---|
<?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 Amount2 implements JsonSerializable
{
public function __construct(
/** @description Currency ISO Code e.g. EUR, USD */
// @ApiMember(Description="Currency ISO Code e.g. EUR, USD", IsRequired=true)
/** @var string */
public string $currencyIsoCode='',
/** @description Cost */
// @ApiMember(Description="Cost", IsRequired=true)
/** @var float */
public float $value=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['currencyIsoCode'])) $this->currencyIsoCode = $o['currencyIsoCode'];
if (isset($o['value'])) $this->value = $o['value'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->currencyIsoCode)) $o['currencyIsoCode'] = $this->currencyIsoCode;
if (isset($this->value)) $o['value'] = $this->value;
return empty($o) ? new class(){} : $o;
}
}
class DeliveryNoteItem implements JsonSerializable
{
public function __construct(
/** @description Line number of Delivery note document e.g. 10, 90, 10000 */
// @ApiMember(Description="Line number of Delivery note document e.g. 10, 90, 10000", IsRequired=true)
/** @var int */
public int $deliveryNotesLineNumber=0,
/** @description Status e.g. I, P */
// @ApiMember(Description="Status e.g. I, P", IsRequired=true)
/** @var string */
public string $status='',
/** @description Article code of product e.g. CRWGSA0032 */
// @ApiMember(Description="Article code of product e.g. CRWGSA0032", IsRequired=true)
/** @var string */
public string $articleCode='',
/** @description Article description of product */
// @ApiMember(Description="Article description of product")
/** @var string|null */
public ?string $articleDescription=null,
/** @description Article code of product for straps e.g. CRKD12346879 */
// @ApiMember(Description="Article code of product for straps e.g. CRKD12346879")
/** @var string|null */
public ?string $speakingArticleCode=null,
/** @description Serial numbers of products */
// @ApiMember(Description="Serial numbers of products")
/** @var array<string>|null */
public ?array $serialNumbers=null,
/** @description ERP ID of purchase order which delivery note attached to e.g. 200232323 */
// @ApiMember(Description="ERP ID of purchase order which delivery note attached to e.g. 200232323", IsRequired=true)
/** @var int */
public int $erpOrderNumber=0,
/** @description Date of purchase order which delivery note attached to e.g. '2023-01-01' */
// @ApiMember(Description="Date of purchase order which delivery note attached to e.g. '2023-01-01'", IsRequired=true)
/** @var DateTime */
public DateTime $erpOrderDate=new DateTime(),
/** @description Line number of purchase order which delivery note attached to e.g. '2023-01-01' */
// @ApiMember(Description="Line number of purchase order which delivery note attached to e.g. '2023-01-01'", IsRequired=true)
/** @var int */
public int $erpOrderLineNumber=0,
/** @description Customer reference of order */
// @ApiMember(Description="Customer reference of order")
/** @var string|null */
public ?string $customerReference=null,
/** @description Carrier name */
// @ApiMember(Description="Carrier name")
/** @var string|null */
public ?string $carrier=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,
/** @description Flag that shows the order is sellable or not */
// @ApiMember(Description="Flag that shows the order is sellable or not", IsRequired=true)
/** @var bool|null */
public ?bool $isSellable=null,
/** @description Flag that shows the order is consignment or not */
// @ApiMember(Description="Flag that shows the order is consignment or not", IsRequired=true)
/** @var bool|null */
public ?bool $isConsignment=null,
/** @description Flag that shows the order is Automatic Replenishment or not */
// @ApiMember(Description="Flag that shows the order is Automatic Replenishment or not", IsRequired=true)
/** @var bool|null */
public ?bool $isAutomaticReplenishment=null,
/** @description Order reason code */
// @ApiMember(Description="Order reason code", IsRequired=true)
/** @var string */
public string $orderReasonCode='',
/** @description Original quantity of item */
// @ApiMember(Description="Original quantity of item")
/** @var DateTime|null */
public ?DateTime $consignmentDueDate=null,
/** @description Quantity of item */
// @ApiMember(Description="Quantity of item", IsRequired=true)
/** @var int */
public int $quantity=0,
/** @description Price of item */
// @ApiMember(Description="Price of item", IsRequired=true)
/** @var Amount2|null */
public ?Amount2 $unitAmount=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['deliveryNotesLineNumber'])) $this->deliveryNotesLineNumber = $o['deliveryNotesLineNumber'];
if (isset($o['status'])) $this->status = $o['status'];
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['articleDescription'])) $this->articleDescription = $o['articleDescription'];
if (isset($o['speakingArticleCode'])) $this->speakingArticleCode = $o['speakingArticleCode'];
if (isset($o['serialNumbers'])) $this->serialNumbers = JsonConverters::fromArray('string', $o['serialNumbers']);
if (isset($o['erpOrderNumber'])) $this->erpOrderNumber = $o['erpOrderNumber'];
if (isset($o['erpOrderDate'])) $this->erpOrderDate = JsonConverters::from('DateTime', $o['erpOrderDate']);
if (isset($o['erpOrderLineNumber'])) $this->erpOrderLineNumber = $o['erpOrderLineNumber'];
if (isset($o['customerReference'])) $this->customerReference = $o['customerReference'];
if (isset($o['carrier'])) $this->carrier = $o['carrier'];
if (isset($o['trackingNumber'])) $this->trackingNumber = $o['trackingNumber'];
if (isset($o['trackingUrl'])) $this->trackingUrl = $o['trackingUrl'];
if (isset($o['isSellable'])) $this->isSellable = $o['isSellable'];
if (isset($o['isConsignment'])) $this->isConsignment = $o['isConsignment'];
if (isset($o['isAutomaticReplenishment'])) $this->isAutomaticReplenishment = $o['isAutomaticReplenishment'];
if (isset($o['orderReasonCode'])) $this->orderReasonCode = $o['orderReasonCode'];
if (isset($o['consignmentDueDate'])) $this->consignmentDueDate = JsonConverters::from('DateTime', $o['consignmentDueDate']);
if (isset($o['quantity'])) $this->quantity = $o['quantity'];
if (isset($o['unitAmount'])) $this->unitAmount = JsonConverters::from('Amount2', $o['unitAmount']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->deliveryNotesLineNumber)) $o['deliveryNotesLineNumber'] = $this->deliveryNotesLineNumber;
if (isset($this->status)) $o['status'] = $this->status;
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->articleDescription)) $o['articleDescription'] = $this->articleDescription;
if (isset($this->speakingArticleCode)) $o['speakingArticleCode'] = $this->speakingArticleCode;
if (isset($this->serialNumbers)) $o['serialNumbers'] = JsonConverters::toArray('string', $this->serialNumbers);
if (isset($this->erpOrderNumber)) $o['erpOrderNumber'] = $this->erpOrderNumber;
if (isset($this->erpOrderDate)) $o['erpOrderDate'] = JsonConverters::to('DateTime', $this->erpOrderDate);
if (isset($this->erpOrderLineNumber)) $o['erpOrderLineNumber'] = $this->erpOrderLineNumber;
if (isset($this->customerReference)) $o['customerReference'] = $this->customerReference;
if (isset($this->carrier)) $o['carrier'] = $this->carrier;
if (isset($this->trackingNumber)) $o['trackingNumber'] = $this->trackingNumber;
if (isset($this->trackingUrl)) $o['trackingUrl'] = $this->trackingUrl;
if (isset($this->isSellable)) $o['isSellable'] = $this->isSellable;
if (isset($this->isConsignment)) $o['isConsignment'] = $this->isConsignment;
if (isset($this->isAutomaticReplenishment)) $o['isAutomaticReplenishment'] = $this->isAutomaticReplenishment;
if (isset($this->orderReasonCode)) $o['orderReasonCode'] = $this->orderReasonCode;
if (isset($this->consignmentDueDate)) $o['consignmentDueDate'] = JsonConverters::to('DateTime', $this->consignmentDueDate);
if (isset($this->quantity)) $o['quantity'] = $this->quantity;
if (isset($this->unitAmount)) $o['unitAmount'] = JsonConverters::to('Amount2', $this->unitAmount);
return empty($o) ? new class(){} : $o;
}
}
class DeliveryNote implements JsonSerializable
{
public function __construct(
/** @description ID of ERP system e.g. ES100 */
// @ApiMember(Description="ID of ERP system e.g. ES100", IsRequired=true)
/** @var string */
public string $erpSystemId='',
/** @description POS Legacy e.g. ES100:102048 */
// @ApiMember(Description="POS Legacy e.g. ES100:102048", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description ShipTo POS Legacy e.g. ES100:102048 */
// @ApiMember(Description="ShipTo POS Legacy e.g. ES100:102048", IsRequired=true)
/** @var string */
public string $shipToPosCode='',
/** @description ID of Delivery note document e.g. 7032150324 */
// @ApiMember(Description="ID of Delivery note document e.g. 7032150324", IsRequired=true)
/** @var int */
public int $deliveryNotesNumber=0,
/** @description Date of Delivery note document e.g. '2023-01-01' */
// @ApiMember(Description="Date of Delivery note document e.g. '2023-01-01'", IsRequired=true)
/** @var DateTime */
public DateTime $deliveryNotesDate=new DateTime(),
/** @description Delivery note items */
// @ApiMember(Description="Delivery note items", IsRequired=true)
/** @var array<DeliveryNoteItem>|null */
public ?array $deliveryNoteItems=null,
/** @description ID of IC Delivery note document e.g. 7032150324 */
// @ApiMember(Description="ID of IC Delivery note document e.g. 7032150324", IsRequired=true)
/** @var int */
public int $icDeliveryNotesNumber=0,
/** @description Date of IC Delivery note document e.g. '2023-01-01' */
// @ApiMember(Description="Date of IC Delivery note document e.g. '2023-01-01'", IsRequired=true)
/** @var DateTime */
public DateTime $icDeliveryNotesDate=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['erpSystemId'])) $this->erpSystemId = $o['erpSystemId'];
if (isset($o['posCode'])) $this->posCode = $o['posCode'];
if (isset($o['shipToPosCode'])) $this->shipToPosCode = $o['shipToPosCode'];
if (isset($o['deliveryNotesNumber'])) $this->deliveryNotesNumber = $o['deliveryNotesNumber'];
if (isset($o['deliveryNotesDate'])) $this->deliveryNotesDate = JsonConverters::from('DateTime', $o['deliveryNotesDate']);
if (isset($o['deliveryNoteItems'])) $this->deliveryNoteItems = JsonConverters::fromArray('DeliveryNoteItem', $o['deliveryNoteItems']);
if (isset($o['icDeliveryNotesNumber'])) $this->icDeliveryNotesNumber = $o['icDeliveryNotesNumber'];
if (isset($o['icDeliveryNotesDate'])) $this->icDeliveryNotesDate = JsonConverters::from('DateTime', $o['icDeliveryNotesDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->erpSystemId)) $o['erpSystemId'] = $this->erpSystemId;
if (isset($this->posCode)) $o['posCode'] = $this->posCode;
if (isset($this->shipToPosCode)) $o['shipToPosCode'] = $this->shipToPosCode;
if (isset($this->deliveryNotesNumber)) $o['deliveryNotesNumber'] = $this->deliveryNotesNumber;
if (isset($this->deliveryNotesDate)) $o['deliveryNotesDate'] = JsonConverters::to('DateTime', $this->deliveryNotesDate);
if (isset($this->deliveryNoteItems)) $o['deliveryNoteItems'] = JsonConverters::toArray('DeliveryNoteItem', $this->deliveryNoteItems);
if (isset($this->icDeliveryNotesNumber)) $o['icDeliveryNotesNumber'] = $this->icDeliveryNotesNumber;
if (isset($this->icDeliveryNotesDate)) $o['icDeliveryNotesDate'] = JsonConverters::to('DateTime', $this->icDeliveryNotesDate);
return empty($o) ? new class(){} : $o;
}
}
class GetDeliveryNotePaginatedResponse implements JsonSerializable
{
public function __construct(
/** @description Total Pages */
// @ApiMember(Description="Total Pages", IsRequired=true)
/** @var int */
public int $totalPages=0,
/** @description Total Results */
// @ApiMember(Description="Total Results", IsRequired=true)
/** @var int */
public int $totalResults=0,
/** @description Index of the result set returned */
// @ApiMember(Description="Index of the result set returned", IsRequired=true)
/** @var int */
public int $page=0,
/** @description Size of the result set returned */
// @ApiMember(Description="Size of the result set returned", IsRequired=true)
/** @var int */
public int $items=0,
/** @description List of delivery notes */
// @ApiMember(Description="List of delivery notes", IsRequired=true)
/** @var array<DeliveryNote>|null */
public ?array $elements=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['totalPages'])) $this->totalPages = $o['totalPages'];
if (isset($o['totalResults'])) $this->totalResults = $o['totalResults'];
if (isset($o['page'])) $this->page = $o['page'];
if (isset($o['items'])) $this->items = $o['items'];
if (isset($o['elements'])) $this->elements = JsonConverters::fromArray('DeliveryNote', $o['elements']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->totalPages)) $o['totalPages'] = $this->totalPages;
if (isset($this->totalResults)) $o['totalResults'] = $this->totalResults;
if (isset($this->page)) $o['page'] = $this->page;
if (isset($this->items)) $o['items'] = $this->items;
if (isset($this->elements)) $o['elements'] = JsonConverters::toArray('DeliveryNote', $this->elements);
return empty($o) ? new class(){} : $o;
}
}
class GetDeliveryNotePaginated implements IPagedRequest, JsonSerializable
{
public function __construct(
/** @description Brand Trigram, e.g. CAR, IWC */
// @ApiMember(Description="Brand Trigram, e.g. CAR, IWC", IsRequired=true)
/** @var string */
public string $brand='',
/** @description POS Legacy Codes, e.g. ES100:102048 */
// @ApiMember(Description="POS Legacy Codes, e.g. ES100:102048", IsRequired=true)
/** @var array<string>|null */
public ?array $posCodes=null,
/** @description Delivery notes date to */
// @ApiMember(Description="Delivery notes date to")
/** @var DateTime|null */
public ?DateTime $dateTo=null,
/** @description Delivery notes date from */
// @ApiMember(Description="Delivery notes date from")
/** @var DateTime|null */
public ?DateTime $dateFrom=null,
/** @description Status possible values: 'I' for pending delivery notes, 'P' for accepted ones */
// @ApiMember(Description="Status possible values: 'I' for pending delivery notes, 'P' for accepted ones")
/** @var array<string>|null */
public ?array $status=null,
/** @description Provide value 'true' for getting only consignment delivery notes */
// @ApiMember(Description="Provide value 'true' for getting only consignment delivery notes")
/** @var bool|null */
public ?bool $onlyConsignment=null,
/** @description Order type filter: “autorep“ for getting only delivery notes linked to an automatic replenishment trigger. It means the reason codes Auto Repl Standard (Z22) and Auto Repl Consignment (Z89) ; “manual“ for getting only delivery notes linked to a manual replenishment trigger. It means all the other reason codes. */
// @ApiMember(Description="Order type filter: “autorep“ for getting only delivery notes linked to an automatic replenishment trigger. It means the reason codes Auto Repl Standard (Z22) and Auto Repl Consignment (Z89) ; “manual“ for getting only delivery notes linked to a manual replenishment trigger. It means all the other reason codes.")
/** @var string|null */
public ?string $orderType=null,
/** @description Stock type filter: “consigned“ for consigned products only ; “asset“ for standard products only ; empty for both consignment & asset */
// @ApiMember(Description="Stock type filter: “consigned“ for consigned products only ; “asset“ for standard products only ; empty for both consignment & asset")
/** @var string|null */
public ?string $stockType=null,
/** @description Richemont Reference Code of the item */
// @ApiMember(Description="Richemont Reference Code of the item")
/** @var string|null */
public ?string $articleCode=null,
/** @description Serial Number of the item */
// @ApiMember(Description="Serial Number of the item")
/** @var string|null */
public ?string $serialNumber=null,
/** @description Delivery notes number for getting specific delivery, e.g. 7032150324 */
// @ApiMember(Description="Delivery notes number for getting specific delivery, e.g. 7032150324")
/** @var int|null */
public ?int $deliveryNotesNumber=null,
/** @description IC Delivery notes number for getting specific delivery, e.g. 7032150324 */
// @ApiMember(Description="IC Delivery notes number for getting specific delivery, e.g. 7032150324")
/** @var int|null */
public ?int $icDeliveryNotesNumber=null,
/** @description Purchase order number for getting specific deliveries by order number, e.g 207285022 */
// @ApiMember(Description="Purchase order number for getting specific deliveries by order number, e.g 207285022")
/** @var int|null */
public ?int $erpOrderNumber=null,
/** @description Index of the result set returned */
// @ApiMember(Description="Index of the result set returned")
/** @var int */
public int $page=0,
/** @description Size of the result set returned */
// @ApiMember(Description="Size of the result set returned")
/** @var int */
public int $items=0,
/** @description Omit precise record count - save on performance */
// @ApiMember(Description="Omit precise record count - save on performance")
/** @var bool|null */
public ?bool $noCount=null,
/** @description Values can be 'DateDESC', 'DateASC', 'PosASC', 'PosDESC' */
// @ApiMember(Description="Values can be 'DateDESC', 'DateASC', 'PosASC', 'PosDESC'")
/** @var string|null */
public ?string $sortBy=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['brand'])) $this->brand = $o['brand'];
if (isset($o['posCodes'])) $this->posCodes = JsonConverters::fromArray('string', $o['posCodes']);
if (isset($o['dateTo'])) $this->dateTo = JsonConverters::from('DateTime', $o['dateTo']);
if (isset($o['dateFrom'])) $this->dateFrom = JsonConverters::from('DateTime', $o['dateFrom']);
if (isset($o['status'])) $this->status = JsonConverters::fromArray('string', $o['status']);
if (isset($o['onlyConsignment'])) $this->onlyConsignment = $o['onlyConsignment'];
if (isset($o['orderType'])) $this->orderType = $o['orderType'];
if (isset($o['stockType'])) $this->stockType = $o['stockType'];
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['serialNumber'])) $this->serialNumber = $o['serialNumber'];
if (isset($o['deliveryNotesNumber'])) $this->deliveryNotesNumber = $o['deliveryNotesNumber'];
if (isset($o['icDeliveryNotesNumber'])) $this->icDeliveryNotesNumber = $o['icDeliveryNotesNumber'];
if (isset($o['erpOrderNumber'])) $this->erpOrderNumber = $o['erpOrderNumber'];
if (isset($o['page'])) $this->page = $o['page'];
if (isset($o['items'])) $this->items = $o['items'];
if (isset($o['noCount'])) $this->noCount = $o['noCount'];
if (isset($o['sortBy'])) $this->sortBy = $o['sortBy'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->brand)) $o['brand'] = $this->brand;
if (isset($this->posCodes)) $o['posCodes'] = JsonConverters::toArray('string', $this->posCodes);
if (isset($this->dateTo)) $o['dateTo'] = JsonConverters::to('DateTime', $this->dateTo);
if (isset($this->dateFrom)) $o['dateFrom'] = JsonConverters::to('DateTime', $this->dateFrom);
if (isset($this->status)) $o['status'] = JsonConverters::toArray('string', $this->status);
if (isset($this->onlyConsignment)) $o['onlyConsignment'] = $this->onlyConsignment;
if (isset($this->orderType)) $o['orderType'] = $this->orderType;
if (isset($this->stockType)) $o['stockType'] = $this->stockType;
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->serialNumber)) $o['serialNumber'] = $this->serialNumber;
if (isset($this->deliveryNotesNumber)) $o['deliveryNotesNumber'] = $this->deliveryNotesNumber;
if (isset($this->icDeliveryNotesNumber)) $o['icDeliveryNotesNumber'] = $this->icDeliveryNotesNumber;
if (isset($this->erpOrderNumber)) $o['erpOrderNumber'] = $this->erpOrderNumber;
if (isset($this->page)) $o['page'] = $this->page;
if (isset($this->items)) $o['items'] = $this->items;
if (isset($this->noCount)) $o['noCount'] = $this->noCount;
if (isset($this->sortBy)) $o['sortBy'] = $this->sortBy;
return empty($o) ? new class(){} : $o;
}
}
PHP GetDeliveryNotePaginated DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /deliveryNote/{brand} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"totalPages":0,"totalResults":0,"page":0,"items":0}