Richemont.Booster2.PublicApi

<back to all web services

CreateSellOut

Requires Authentication
The following routes are available for this service:
POST/warrantyCreate a Sell-OutCreate a sell-out in a POS you are authorised for
<?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 CreateSellOutResponse implements JsonSerializable
{
    public function __construct(
        /** @description Unique Identifier of the Sell-out item created in Booster */
        // @ApiMember(Description="Unique Identifier of the Sell-out item created in Booster")
        /** @var int|null */
        public ?int $saleDetailId=null,

        /** @description Unique Identifiers of the Sell-out items created in Booster if more than one */
        // @ApiMember(Description="Unique Identifiers of the Sell-out items created in Booster if more than one")
        /** @var array<int>|null */
        public ?array $saleDetailIds=null,

        /** @description Unique Identifier of the Sell-out header created in Booster */
        // @ApiMember(Description="Unique Identifier of the Sell-out header created in Booster", IsRequired=true)
        /** @var int */
        public int $saleId=0
    ) {
    }

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

class CreateSellOut implements JsonSerializable
{
    public function __construct(
        /** @description Brand Trigram, e.g. CAR, IWC; compulsory only if articleCode is not provided */
        // @ApiMember(Description="Brand Trigram, e.g. CAR, IWC; compulsory only if articleCode is not provided")
        /** @var string|null */
        public ?string $brand=null,

        /** @description Richemont POS code */
        // @ApiMember(Description="Richemont POS code", IsRequired=true)
        /** @var string */
        public string $posCode='',

        /** @description Receipt or Invoice Number */
        // @ApiMember(Description="Receipt or Invoice Number")
        /** @var string|null */
        public ?string $documentNumber=null,

        /** @description Date of the Sell-out */
        // @ApiMember(Description="Date of the Sell-out", IsRequired=true)
        /** @var DateTime */
        public DateTime $documentDate=new DateTime(),

        /** @description Position Number */
        // @ApiMember(Description="Position Number")
        /** @var int|null */
        public ?int $documentLineNumber=null,

        /** @description Richemont Reference Code of the item */
        // @ApiMember(Description="Richemont Reference Code of the item", IsRequired=true)
        /** @var string */
        public string $articleCode='',

        /** @description Serial Number of the item */
        // @ApiMember(Description="Serial Number of the item")
        /** @var string|null */
        public ?string $serialNumber=null,

        /** @description Use positive for standard Sell-out and negative quantity for return */
        // @ApiMember(Description="Use positive for standard Sell-out and negative quantity for return", IsRequired=true)
        /** @var int */
        public int $quantity=0,

        /** @description Sold Price */
        // @ApiMember(Description="Sold Price")
        /** @var float|null */
        public ?float $unitPrice=null,

        /** @description Currency of the sold price */
        // @ApiMember(Description="Currency of the sold price")
        /** @var string|null */
        public ?string $currencyCode=null,

        /** @description Booster Customer Id */
        // @ApiMember(Description="Booster Customer Id")
        /** @var int|null */
        public ?int $boosterCustomerId=null,

        /** @description Sale Representative Email e.g. rauf.aliyev@richemont.com */
        // @ApiMember(Description="Sale Representative Email e.g. rauf.aliyev@richemont.com")
        /** @var array<string>|null */
        public ?array $saleRepresentativeEmails=null,

        /** @description Promoter Type ID, e.g. DAI, FIT, GRT */
        // @ApiMember(Description="Promoter Type ID, e.g. DAI, FIT, GRT")
        /** @var string|null */
        public ?string $promoterTypeId=null,

        /** @description Return Reason ID, e.g ADM, CLR, EXC, DEF, OTH */
        // @ApiMember(Description="Return Reason ID, e.g ADM, CLR, EXC, DEF, OTH")
        /** @var string|null */
        public ?string $returnReasonId=null,

        /** @description Sale related comments */
        // @ApiMember(Description="Sale related comments")
        /** @var string|null */
        public ?string $comments=null,

        /** @description Original Sale Detail Id */
        // @ApiMember(Description="Original Sale Detail Id")
        /** @var int|null */
        public ?int $originalSaleDetailId=null,

        /** @description To have the piece back in stock as consignment in case of consignment sellout return */
        // @ApiMember(Description="To have the piece back in stock as consignment in case of consignment sellout return")
        /** @var bool|null */
        public ?bool $consSelloutReturnInStock=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['documentNumber'])) $this->documentNumber = $o['documentNumber'];
        if (isset($o['documentDate'])) $this->documentDate = JsonConverters::from('DateTime', $o['documentDate']);
        if (isset($o['documentLineNumber'])) $this->documentLineNumber = $o['documentLineNumber'];
        if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
        if (isset($o['serialNumber'])) $this->serialNumber = $o['serialNumber'];
        if (isset($o['quantity'])) $this->quantity = $o['quantity'];
        if (isset($o['unitPrice'])) $this->unitPrice = $o['unitPrice'];
        if (isset($o['currencyCode'])) $this->currencyCode = $o['currencyCode'];
        if (isset($o['boosterCustomerId'])) $this->boosterCustomerId = $o['boosterCustomerId'];
        if (isset($o['saleRepresentativeEmails'])) $this->saleRepresentativeEmails = JsonConverters::fromArray('string', $o['saleRepresentativeEmails']);
        if (isset($o['promoterTypeId'])) $this->promoterTypeId = $o['promoterTypeId'];
        if (isset($o['returnReasonId'])) $this->returnReasonId = $o['returnReasonId'];
        if (isset($o['comments'])) $this->comments = $o['comments'];
        if (isset($o['originalSaleDetailId'])) $this->originalSaleDetailId = $o['originalSaleDetailId'];
        if (isset($o['consSelloutReturnInStock'])) $this->consSelloutReturnInStock = $o['consSelloutReturnInStock'];
    }
    
    /** @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->documentNumber)) $o['documentNumber'] = $this->documentNumber;
        if (isset($this->documentDate)) $o['documentDate'] = JsonConverters::to('DateTime', $this->documentDate);
        if (isset($this->documentLineNumber)) $o['documentLineNumber'] = $this->documentLineNumber;
        if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
        if (isset($this->serialNumber)) $o['serialNumber'] = $this->serialNumber;
        if (isset($this->quantity)) $o['quantity'] = $this->quantity;
        if (isset($this->unitPrice)) $o['unitPrice'] = $this->unitPrice;
        if (isset($this->currencyCode)) $o['currencyCode'] = $this->currencyCode;
        if (isset($this->boosterCustomerId)) $o['boosterCustomerId'] = $this->boosterCustomerId;
        if (isset($this->saleRepresentativeEmails)) $o['saleRepresentativeEmails'] = JsonConverters::toArray('string', $this->saleRepresentativeEmails);
        if (isset($this->promoterTypeId)) $o['promoterTypeId'] = $this->promoterTypeId;
        if (isset($this->returnReasonId)) $o['returnReasonId'] = $this->returnReasonId;
        if (isset($this->comments)) $o['comments'] = $this->comments;
        if (isset($this->originalSaleDetailId)) $o['originalSaleDetailId'] = $this->originalSaleDetailId;
        if (isset($this->consSelloutReturnInStock)) $o['consSelloutReturnInStock'] = $this->consSelloutReturnInStock;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateSellOut DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /warranty HTTP/1.1 
Host: dev-api-booster.richemont.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"brand":"String","posCode":"String","documentNumber":"String","documentDate":"\/Date(-62135596800000-0000)\/","documentLineNumber":0,"articleCode":"String","serialNumber":"String","quantity":0,"unitPrice":0,"currencyCode":"String","boosterCustomerId":0,"saleRepresentativeEmails":["String"],"promoterTypeId":"String","returnReasonId":"String","comments":"String","originalSaleDetailId":0,"consSelloutReturnInStock":false}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"saleDetailId":0,"saleDetailIds":[0],"saleId":0}