| PUT | /api/order/{OrderId}/duplicate | Mark order as duplicate |
|---|
<?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 TokenDto implements ICommandResponse, JsonSerializable
{
public function __construct(
/** @var string */
public string $token=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['token'])) $this->token = $o['token'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->token)) $o['token'] = $this->token;
return empty($o) ? new class(){} : $o;
}
}
enum DuplicateOrderReasonCode : string
{
case OrderExist = 'OrderExist';
}
/** @description Order */
// @Api(Description="Order")
// @ApiResponse(Description="Command received", IsDefaultResponse=true, StatusCode=200)
class DuplicatedOrder implements JsonSerializable
{
public function __construct(
/** @description Order ID or Token */
// @ApiMember(Description="Order ID or Token", ExcludeInSchema=true, ParameterType="path")
/** @var string */
public string $orderId='',
/** @description Reason code */
// @ApiMember(Description="Reason code")
/** @var DuplicateOrderReasonCode|null */
public ?DuplicateOrderReasonCode $duplicateReasonCode=null,
/** @description Description */
// @ApiMember(Description="Description")
/** @var string */
public string $duplicateReasonCodeDescription='',
/** @description Date and Time order was identified as duplicate */
// @ApiMember(Description="Date and Time order was identified as duplicate")
/** @var DateTime|null */
public ?DateTime $duplicateDate=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['orderId'])) $this->orderId = $o['orderId'];
if (isset($o['duplicateReasonCode'])) $this->duplicateReasonCode = JsonConverters::from('DuplicateOrderReasonCode', $o['duplicateReasonCode']);
if (isset($o['duplicateReasonCodeDescription'])) $this->duplicateReasonCodeDescription = $o['duplicateReasonCodeDescription'];
if (isset($o['duplicateDate'])) $this->duplicateDate = JsonConverters::from('DateTime', $o['duplicateDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->orderId)) $o['orderId'] = $this->orderId;
if (isset($this->duplicateReasonCode)) $o['duplicateReasonCode'] = JsonConverters::to('DuplicateOrderReasonCode', $this->duplicateReasonCode);
if (isset($this->duplicateReasonCodeDescription)) $o['duplicateReasonCodeDescription'] = $this->duplicateReasonCodeDescription;
if (isset($this->duplicateDate)) $o['duplicateDate'] = JsonConverters::to('DateTime', $this->duplicateDate);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /api/order/{OrderId}/duplicate HTTP/1.1
Host: stf-api-uat.data-xchange.co.za
Accept: application/json
Content-Type: application/json
Content-Length: length
{"duplicateReasonCode":"OrderExist","duplicateReasonCodeDescription":"String","duplicateDate":"0001-01-01"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{}