| POST | /stock/{brand}/acceptDelivery | Manual Order Reception |
|---|
<?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 AcceptDeliveryResponse implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
class AcceptDeliveryNoteItem implements JsonSerializable
{
public function __construct(
/** @description Delivery Notes Number, e.g. 7040123456 */
// @ApiMember(Description="Delivery Notes Number, e.g. 7040123456", IsRequired=true)
/** @var int */
public int $deliveryNotesNumber=0,
/** @description Delivery Notes Date, e.g. 2022-10-10 */
// @ApiMember(Description="Delivery Notes Date, e.g. 2022-10-10", IsRequired=true)
/** @var DateTime */
public DateTime $deliveryNotesDate=new DateTime(),
/** @description Delivery Notes Line Number (DeliveryNotesNoSplit), e.g. 10 */
// @ApiMember(Description="Delivery Notes Line Number (DeliveryNotesNoSplit), e.g. 10", IsRequired=true)
/** @var int */
public int $deliveryNotesLineNumber=0,
/** @description ReceivedQuantity, e.g. 2 */
// @ApiMember(Description="ReceivedQuantity, e.g. 2", IsRequired=true)
/** @var int */
public int $receivedQuantity=0,
/** @description Serial Numbers, e.g. '6361234', '6361235' */
// @ApiMember(Description="Serial Numbers, e.g. '6361234', '6361235'")
/** @var array<string>|null */
public ?array $serialNumbers=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['deliveryNotesNumber'])) $this->deliveryNotesNumber = $o['deliveryNotesNumber'];
if (isset($o['deliveryNotesDate'])) $this->deliveryNotesDate = JsonConverters::from('DateTime', $o['deliveryNotesDate']);
if (isset($o['deliveryNotesLineNumber'])) $this->deliveryNotesLineNumber = $o['deliveryNotesLineNumber'];
if (isset($o['receivedQuantity'])) $this->receivedQuantity = $o['receivedQuantity'];
if (isset($o['serialNumbers'])) $this->serialNumbers = JsonConverters::fromArray('string', $o['serialNumbers']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->deliveryNotesNumber)) $o['deliveryNotesNumber'] = $this->deliveryNotesNumber;
if (isset($this->deliveryNotesDate)) $o['deliveryNotesDate'] = JsonConverters::to('DateTime', $this->deliveryNotesDate);
if (isset($this->deliveryNotesLineNumber)) $o['deliveryNotesLineNumber'] = $this->deliveryNotesLineNumber;
if (isset($this->receivedQuantity)) $o['receivedQuantity'] = $this->receivedQuantity;
if (isset($this->serialNumbers)) $o['serialNumbers'] = JsonConverters::toArray('string', $this->serialNumbers);
return empty($o) ? new class(){} : $o;
}
}
class AcceptDelivery implements JsonSerializable
{
public function __construct(
/** @description Brand */
// @ApiMember(Description="Brand", IsRequired=true)
/** @var string */
public string $brand='',
/** @description Pos Legacy Code with Legacy System ID, e.g. ES123:123456 */
// @ApiMember(Description="Pos Legacy Code with Legacy System ID, e.g. ES123:123456", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Received deliveries */
// @ApiMember(Description="Received deliveries", IsRequired=true)
/** @var array<AcceptDeliveryNoteItem>|null */
public ?array $deliveryNotes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['brand'])) $this->brand = $o['brand'];
if (isset($o['posCode'])) $this->posCode = $o['posCode'];
if (isset($o['deliveryNotes'])) $this->deliveryNotes = JsonConverters::fromArray('AcceptDeliveryNoteItem', $o['deliveryNotes']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->brand)) $o['brand'] = $this->brand;
if (isset($this->posCode)) $o['posCode'] = $this->posCode;
if (isset($this->deliveryNotes)) $o['deliveryNotes'] = JsonConverters::toArray('AcceptDeliveryNoteItem', $this->deliveryNotes);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /stock/{brand}/acceptDelivery HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
brand: String,
posCode: String,
deliveryNotes:
[
{
deliveryNotesNumber: 0,
deliveryNotesDate: 0001-01-01,
deliveryNotesLineNumber: 0,
receivedQuantity: 0,
serialNumbers:
[
String
]
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
}