| POST | /purchase/basket | Create Basket |
|---|
<?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 BasketStrapItem implements JsonSerializable
{
public function __construct(
/** @description Article reference */
// @ApiMember(Description="Article reference")
/** @var string|null */
public ?string $speakingArticleCode=null,
/** @description Buckle type Description */
// @ApiMember(Description="Buckle type Description")
/** @var string|null */
public ?string $buckleTypeDescription=null,
/** @description Buckle type */
// @ApiMember(Description="Buckle type")
/** @var string|null */
public ?string $buckleTypeCode=null,
/** @description watch 6 Length */
// @ApiMember(Description="watch 6 Length")
/** @var int|null */
public ?int $watch6Length=null,
/** @description watch 12 Length */
// @ApiMember(Description="watch 12 Length")
/** @var int|null */
public ?int $watch12Length=null,
/** @description Article Material Code */
// @ApiMember(Description="Article Material Code")
/** @var string|null */
public ?string $materialCode=null,
/** @description Article Material Description */
// @ApiMember(Description="Article Material Description")
/** @var string|null */
public ?string $materialDescription=null,
/** @description Article Color Code */
// @ApiMember(Description="Article Color Code")
/** @var string|null */
public ?string $colorCode=null,
/** @description Article Color Description */
// @ApiMember(Description="Article Color Description")
/** @var string|null */
public ?string $colorDescription=null,
/** @description Buckle Witdh */
// @ApiMember(Description="Buckle Witdh")
/** @var string|null */
public ?string $buckleWidth=null,
/** @description Article Lining Code */
// @ApiMember(Description="Article Lining Code")
/** @var string|null */
public ?string $liningCode=null,
/** @description Article Lining Description */
// @ApiMember(Description="Article Lining Description")
/** @var string|null */
public ?string $liningDescription=null,
/** @description Article Stitching Code */
// @ApiMember(Description="Article Stitching Code")
/** @var string|null */
public ?string $stitchingCode=null,
/** @description Article Stitching Description */
// @ApiMember(Description="Article Stitching Description")
/** @var string|null */
public ?string $stitchingDescription=null,
/** @description Article Edge Code */
// @ApiMember(Description="Article Edge Code")
/** @var string|null */
public ?string $edgeCode=null,
/** @description Article Edge Description */
// @ApiMember(Description="Article Edge Description")
/** @var string|null */
public ?string $edgeDescription=null,
/** @description Article Padding Code */
// @ApiMember(Description="Article Padding Code")
/** @var string|null */
public ?string $paddingCode=null,
/** @description Article Padding Description */
// @ApiMember(Description="Article Padding Description")
/** @var string|null */
public ?string $paddingDescription=null,
/** @description Article Speciality Code */
// @ApiMember(Description="Article Speciality Code")
/** @var string|null */
public ?string $specialtyCode=null,
/** @description Article Speciality Description */
// @ApiMember(Description="Article Speciality Description")
/** @var string|null */
public ?string $specialtyDescription=null,
/** @description Nuancier Code */
// @ApiMember(Description="Nuancier Code")
/** @var string|null */
public ?string $nuancierCode=null,
/** @description Strap Vip Order */
// @ApiMember(Description="Strap Vip Order")
/** @var bool|null */
public ?bool $isStrapVipOrder=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['speakingArticleCode'])) $this->speakingArticleCode = $o['speakingArticleCode'];
if (isset($o['buckleTypeDescription'])) $this->buckleTypeDescription = $o['buckleTypeDescription'];
if (isset($o['buckleTypeCode'])) $this->buckleTypeCode = $o['buckleTypeCode'];
if (isset($o['watch6Length'])) $this->watch6Length = $o['watch6Length'];
if (isset($o['watch12Length'])) $this->watch12Length = $o['watch12Length'];
if (isset($o['materialCode'])) $this->materialCode = $o['materialCode'];
if (isset($o['materialDescription'])) $this->materialDescription = $o['materialDescription'];
if (isset($o['colorCode'])) $this->colorCode = $o['colorCode'];
if (isset($o['colorDescription'])) $this->colorDescription = $o['colorDescription'];
if (isset($o['buckleWidth'])) $this->buckleWidth = $o['buckleWidth'];
if (isset($o['liningCode'])) $this->liningCode = $o['liningCode'];
if (isset($o['liningDescription'])) $this->liningDescription = $o['liningDescription'];
if (isset($o['stitchingCode'])) $this->stitchingCode = $o['stitchingCode'];
if (isset($o['stitchingDescription'])) $this->stitchingDescription = $o['stitchingDescription'];
if (isset($o['edgeCode'])) $this->edgeCode = $o['edgeCode'];
if (isset($o['edgeDescription'])) $this->edgeDescription = $o['edgeDescription'];
if (isset($o['paddingCode'])) $this->paddingCode = $o['paddingCode'];
if (isset($o['paddingDescription'])) $this->paddingDescription = $o['paddingDescription'];
if (isset($o['specialtyCode'])) $this->specialtyCode = $o['specialtyCode'];
if (isset($o['specialtyDescription'])) $this->specialtyDescription = $o['specialtyDescription'];
if (isset($o['nuancierCode'])) $this->nuancierCode = $o['nuancierCode'];
if (isset($o['isStrapVipOrder'])) $this->isStrapVipOrder = $o['isStrapVipOrder'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->speakingArticleCode)) $o['speakingArticleCode'] = $this->speakingArticleCode;
if (isset($this->buckleTypeDescription)) $o['buckleTypeDescription'] = $this->buckleTypeDescription;
if (isset($this->buckleTypeCode)) $o['buckleTypeCode'] = $this->buckleTypeCode;
if (isset($this->watch6Length)) $o['watch6Length'] = $this->watch6Length;
if (isset($this->watch12Length)) $o['watch12Length'] = $this->watch12Length;
if (isset($this->materialCode)) $o['materialCode'] = $this->materialCode;
if (isset($this->materialDescription)) $o['materialDescription'] = $this->materialDescription;
if (isset($this->colorCode)) $o['colorCode'] = $this->colorCode;
if (isset($this->colorDescription)) $o['colorDescription'] = $this->colorDescription;
if (isset($this->buckleWidth)) $o['buckleWidth'] = $this->buckleWidth;
if (isset($this->liningCode)) $o['liningCode'] = $this->liningCode;
if (isset($this->liningDescription)) $o['liningDescription'] = $this->liningDescription;
if (isset($this->stitchingCode)) $o['stitchingCode'] = $this->stitchingCode;
if (isset($this->stitchingDescription)) $o['stitchingDescription'] = $this->stitchingDescription;
if (isset($this->edgeCode)) $o['edgeCode'] = $this->edgeCode;
if (isset($this->edgeDescription)) $o['edgeDescription'] = $this->edgeDescription;
if (isset($this->paddingCode)) $o['paddingCode'] = $this->paddingCode;
if (isset($this->paddingDescription)) $o['paddingDescription'] = $this->paddingDescription;
if (isset($this->specialtyCode)) $o['specialtyCode'] = $this->specialtyCode;
if (isset($this->specialtyDescription)) $o['specialtyDescription'] = $this->specialtyDescription;
if (isset($this->nuancierCode)) $o['nuancierCode'] = $this->nuancierCode;
if (isset($this->isStrapVipOrder)) $o['isStrapVipOrder'] = $this->isStrapVipOrder;
return empty($o) ? new class(){} : $o;
}
}
class BasketItemResponse implements JsonSerializable
{
public function __construct(
/** @description Line number of the article */
// @ApiMember(Description="Line number of the article")
/** @var int */
public int $line=0,
/** @description Reference ID of the article/product */
// @ApiMember(Description="Reference ID of the article/product")
/** @var string|null */
public ?string $articleCode=null,
/** @description Old reference ID of the article/product */
// @ApiMember(Description="Old reference ID of the article/product")
/** @var string|null */
public ?string $oldArticleCode=null,
/** @description Quantity of the article */
// @ApiMember(Description="Quantity of the article")
/** @var int */
public int $quantity=0,
/** @description Delivery date of the article */
// @ApiMember(Description="Delivery date of the article")
/** @var DateTime */
public DateTime $deliveryDate=new DateTime(),
/** @description Strap definition */
// @ApiMember(Description="Strap definition")
/** @var BasketStrapItem|null */
public ?BasketStrapItem $strap=null,
/** @description Errors for the article */
// @ApiMember(Description="Errors for the article")
/** @var array<string>|null */
public ?array $errors=null,
/** @description Warnings for the article */
// @ApiMember(Description="Warnings for the article")
/** @var array<string>|null */
public ?array $warnings=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['line'])) $this->line = $o['line'];
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['oldArticleCode'])) $this->oldArticleCode = $o['oldArticleCode'];
if (isset($o['quantity'])) $this->quantity = $o['quantity'];
if (isset($o['deliveryDate'])) $this->deliveryDate = JsonConverters::from('DateTime', $o['deliveryDate']);
if (isset($o['strap'])) $this->strap = JsonConverters::from('BasketStrapItem', $o['strap']);
if (isset($o['errors'])) $this->errors = JsonConverters::fromArray('string', $o['errors']);
if (isset($o['warnings'])) $this->warnings = JsonConverters::fromArray('string', $o['warnings']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->line)) $o['line'] = $this->line;
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->oldArticleCode)) $o['oldArticleCode'] = $this->oldArticleCode;
if (isset($this->quantity)) $o['quantity'] = $this->quantity;
if (isset($this->deliveryDate)) $o['deliveryDate'] = JsonConverters::to('DateTime', $this->deliveryDate);
if (isset($this->strap)) $o['strap'] = JsonConverters::to('BasketStrapItem', $this->strap);
if (isset($this->errors)) $o['errors'] = JsonConverters::toArray('string', $this->errors);
if (isset($this->warnings)) $o['warnings'] = JsonConverters::toArray('string', $this->warnings);
return empty($o) ? new class(){} : $o;
}
}
class CreateBasketResponse implements JsonSerializable
{
public function __construct(
/** @description ID of the newly created Purchase Order / Basket */
// @ApiMember(Description="ID of the newly created Purchase Order / Basket", IsRequired=true)
/** @var int */
public int $purchaseOrderId=0,
/** @description Validation results of each basket item */
// @ApiMember(Description="Validation results of each basket item")
/** @var array<BasketItemResponse>|null */
public ?array $validationResults=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['purchaseOrderId'])) $this->purchaseOrderId = $o['purchaseOrderId'];
if (isset($o['validationResults'])) $this->validationResults = JsonConverters::fromArray('BasketItemResponse', $o['validationResults']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->purchaseOrderId)) $o['purchaseOrderId'] = $this->purchaseOrderId;
if (isset($this->validationResults)) $o['validationResults'] = JsonConverters::toArray('BasketItemResponse', $this->validationResults);
return empty($o) ? new class(){} : $o;
}
}
class BasketItem implements JsonSerializable
{
public function __construct(
/** @description Reference ID of the article/product */
// @ApiMember(Description="Reference ID of the article/product", IsRequired=true)
/** @var string */
public string $articleCode='',
/** @description Desired quantity of the article */
// @ApiMember(Description="Desired quantity of the article")
/** @var int */
public int $quantity=0,
/** @description Strap definition */
// @ApiMember(Description="Strap definition")
/** @var BasketStrapItem|null */
public ?BasketStrapItem $strap=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['quantity'])) $this->quantity = $o['quantity'];
if (isset($o['strap'])) $this->strap = JsonConverters::from('BasketStrapItem', $o['strap']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->quantity)) $o['quantity'] = $this->quantity;
if (isset($this->strap)) $o['strap'] = JsonConverters::to('BasketStrapItem', $this->strap);
return empty($o) ? new class(){} : $o;
}
}
class CreateBasket implements JsonSerializable
{
public function __construct(
/** @description Brand Trigram of the intended order */
// @ApiMember(Description="Brand Trigram of the intended order", IsRequired=true)
/** @var string */
public string $brand='',
/** @description Pos Code for the intended order e.g. ES03-10415-01 */
// @ApiMember(Description="Pos Code for the intended order e.g. ES03-10415-01", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Customer Reference */
// @ApiMember(Description="Customer Reference", IsRequired=true)
/** @var string */
public string $customerReference='',
/** @description Additional Notes regarding the order */
// @ApiMember(Description="Additional Notes regarding the order", IsRequired=true)
/** @var string */
public string $notes='',
/** @description List of Articles to be added in the basket */
// @ApiMember(Description="List of Articles to be added in the basket")
/** @var array<BasketItem>|null */
public ?array $orderItems=null,
/** @description Brand Context ID */
// @ApiMember(Description="Brand Context ID")
/** @var string|null */
public ?string $boosterContextId=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['customerReference'])) $this->customerReference = $o['customerReference'];
if (isset($o['notes'])) $this->notes = $o['notes'];
if (isset($o['orderItems'])) $this->orderItems = JsonConverters::fromArray('BasketItem', $o['orderItems']);
if (isset($o['boosterContextId'])) $this->boosterContextId = $o['boosterContextId'];
}
/** @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->customerReference)) $o['customerReference'] = $this->customerReference;
if (isset($this->notes)) $o['notes'] = $this->notes;
if (isset($this->orderItems)) $o['orderItems'] = JsonConverters::toArray('BasketItem', $this->orderItems);
if (isset($this->boosterContextId)) $o['boosterContextId'] = $this->boosterContextId;
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 /purchase/basket HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
brand: String,
posCode: String,
customerReference: String,
notes: String,
orderItems:
[
{
articleCode: String,
quantity: 0,
strap:
{
speakingArticleCode: String,
buckleTypeDescription: String,
buckleTypeCode: String,
watch6Length: 0,
watch12Length: 0,
materialCode: String,
materialDescription: String,
colorCode: String,
colorDescription: String,
buckleWidth: String,
liningCode: String,
liningDescription: String,
stitchingCode: String,
stitchingDescription: String,
edgeCode: String,
edgeDescription: String,
paddingCode: String,
paddingDescription: String,
specialtyCode: String,
specialtyDescription: String,
nuancierCode: String,
isStrapVipOrder: False
}
}
],
boosterContextId: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
purchaseOrderId: 0,
validationResults:
[
{
line: 0,
articleCode: String,
oldArticleCode: String,
quantity: 0,
deliveryDate: 0001-01-01,
strap:
{
speakingArticleCode: String,
buckleTypeDescription: String,
buckleTypeCode: String,
watch6Length: 0,
watch12Length: 0,
materialCode: String,
materialDescription: String,
colorCode: String,
colorDescription: String,
buckleWidth: String,
liningCode: String,
liningDescription: String,
stitchingCode: String,
stitchingDescription: String,
edgeCode: String,
edgeDescription: String,
paddingCode: String,
paddingDescription: String,
specialtyCode: String,
specialtyDescription: String,
nuancierCode: String,
isStrapVipOrder: False
},
errors:
[
String
],
warnings:
[
String
]
}
]
}