| PUT | /v1/VehicleSwap | Updates vehicle swap, order and back order records | This endpoint validates a swap vehicle and then calls an endpoint in the Agency API to update vehicle swap, order and back order and sends a message to OneAgent with the updated order vehicle and offers |
|---|
<?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 VehicleError implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Field='',
/** @var string */
public string $Message=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Field'])) $this->Field = $o['Field'];
if (isset($o['Message'])) $this->Message = $o['Message'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Field)) $o['Field'] = $this->Field;
if (isset($this->Message)) $o['Message'] = $this->Message;
return empty($o) ? new class(){} : $o;
}
}
class UpdateVehicleSwapResponse implements JsonSerializable
{
public function __construct(
/** @var array<VehicleError>|null */
public ?array $Errors=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Errors'])) $this->Errors = JsonConverters::fromArray('VehicleError', $o['Errors']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Errors)) $o['Errors'] = JsonConverters::toArray('VehicleError', $this->Errors);
return empty($o) ? new class(){} : $o;
}
}
class UpdateVehicleSwapRequest implements IPost, JsonSerializable
{
public function __construct(
/** @var string */
public string $VehicleSwapGuid='',
/** @var string */
public string $OrderGuid='',
/** @var string|null */
public ?string $BackOrderGuid=null,
/** @var string */
public string $GssnId='',
/** @var string */
public string $Agent='',
/** @var string */
public string $ExistingVin='',
/** @var string */
public string $SwapVin='',
/** @var int[]|null */
public ?array $PersonalisedItemOfferIds=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['VehicleSwapGuid'])) $this->VehicleSwapGuid = $o['VehicleSwapGuid'];
if (isset($o['OrderGuid'])) $this->OrderGuid = $o['OrderGuid'];
if (isset($o['BackOrderGuid'])) $this->BackOrderGuid = $o['BackOrderGuid'];
if (isset($o['GssnId'])) $this->GssnId = $o['GssnId'];
if (isset($o['Agent'])) $this->Agent = $o['Agent'];
if (isset($o['ExistingVin'])) $this->ExistingVin = $o['ExistingVin'];
if (isset($o['SwapVin'])) $this->SwapVin = $o['SwapVin'];
if (isset($o['PersonalisedItemOfferIds'])) $this->PersonalisedItemOfferIds = JsonConverters::fromArray('int', $o['PersonalisedItemOfferIds']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->VehicleSwapGuid)) $o['VehicleSwapGuid'] = $this->VehicleSwapGuid;
if (isset($this->OrderGuid)) $o['OrderGuid'] = $this->OrderGuid;
if (isset($this->BackOrderGuid)) $o['BackOrderGuid'] = $this->BackOrderGuid;
if (isset($this->GssnId)) $o['GssnId'] = $this->GssnId;
if (isset($this->Agent)) $o['Agent'] = $this->Agent;
if (isset($this->ExistingVin)) $o['ExistingVin'] = $this->ExistingVin;
if (isset($this->SwapVin)) $o['SwapVin'] = $this->SwapVin;
if (isset($this->PersonalisedItemOfferIds)) $o['PersonalisedItemOfferIds'] = JsonConverters::toArray('int', $this->PersonalisedItemOfferIds);
return empty($o) ? new class(){} : $o;
}
}
PHP UpdateVehicleSwapRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /v1/VehicleSwap HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdateVehicleSwapRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.ServiceModel.VehicleSwap">
<Agent>String</Agent>
<BackOrderGuid>00000000-0000-0000-0000-000000000000</BackOrderGuid>
<ExistingVin>String</ExistingVin>
<GssnId>String</GssnId>
<OrderGuid>00000000-0000-0000-0000-000000000000</OrderGuid>
<PersonalisedItemOfferIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:int>0</d2p1:int>
</PersonalisedItemOfferIds>
<SwapVin>String</SwapVin>
<VehicleSwapGuid>00000000-0000-0000-0000-000000000000</VehicleSwapGuid>
</UpdateVehicleSwapRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<UpdateVehicleSwapResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO">
<Errors>
<VehicleError>
<Field>String</Field>
<Message>String</Message>
</VehicleError>
</Errors>
</UpdateVehicleSwapResponse>