POST | /v1/backorder | Create Back Order (Online Showroom) |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
class Source(IntEnum):
ONLINE_SHOWROOM = 1
ONE_ADMIN = 2
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Address:
property: Optional[str] = None
street: Optional[str] = None
town: Optional[str] = None
county: Optional[str] = None
locality: Optional[str] = None
postcode: Optional[str] = None
class CustomerMode(IntEnum):
PRIVATE = 1
BUSINESS = 2
MOTABILITY = 3
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SalesforceCustomer(ICustomer):
customer_id: Optional[str] = None
is_ciam: bool = False
company_name: Optional[str] = None
title: Optional[str] = None
firstname: Optional[str] = None
surname: Optional[str] = None
email_address: Optional[str] = None
telephone: Optional[str] = None
address: Optional[Address] = None
mode: Optional[CustomerMode] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Preferences:
optin_email: bool = False
optin_post: bool = False
optin_s_m_s: bool = False
optin_telephone: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Customer(SalesforceCustomer):
profile_id: Optional[str] = None
preferences: Optional[Preferences] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JsonVersion(IJsonVersion):
version: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CriteriaModel:
description: Optional[str] = None
id: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CriteriaDifference:
model: bool = False
transmission: bool = False
fuel: bool = False
upholstery: bool = False
equipment: bool = False
line: bool = False
body_style: bool = False
colour_group: bool = False
packages: bool = False
engine: bool = False
additional_information: bool = False
url_referrer: bool = False
preferred_delivery_date: bool = False
is_smart: bool = False
is_specialised: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CriteriaBase(JsonVersion):
transmission: List[str] = field(default_factory=list)
fuel: List[str] = field(default_factory=list)
upholstery: List[str] = field(default_factory=list)
equipment: List[str] = field(default_factory=list)
line: List[str] = field(default_factory=list)
body_style: List[str] = field(default_factory=list)
colour_group: List[str] = field(default_factory=list)
packages: List[str] = field(default_factory=list)
model: List[CriteriaModel] = field(default_factory=list)
url_referrer: Optional[str] = None
preferred_delivery_date: Optional[str] = None
# @ApiMember(ExcludeInSchema=true)
is_new_model: bool = False
# @ApiMember(ExcludeInSchema=true)
is_smart: bool = False
# @ApiMember(ExcludeInSchema=true)
is_specialised: bool = False
# @ApiMember(ExcludeInSchema=true)
criteria_difference: Optional[CriteriaDifference] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Criteria(CriteriaBase):
engine: List[str] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class V2EngineCriteria:
badge: Optional[str] = None
brand: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class V2Criteria(CriteriaBase):
engine: List[V2EngineCriteria] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OutrightPurchase:
is_outright_purchase: bool = False
reference: Optional[str] = None
discount_rate: Decimal = decimal.Decimal(0)
bm7_n_s_t: Optional[str] = None
is_back_order: bool = False
is_c_o_p_converter: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateBackOrderBase:
gssn_id: Optional[str] = None
additional_information: Optional[str] = None
config_code: Optional[str] = None
source: Optional[Source] = None
tag_url: Optional[str] = None
customer: Optional[Customer] = None
customer_criteria: Optional[Criteria] = None
agent_criteria: Optional[V2Criteria] = None
outright_purchase: Optional[OutrightPurchase] = None
gas_id: Optional[str] = None
motability: bool = False
motability_pricing_id: Optional[int] = None
assistance_provider_id: Optional[int] = None
assistance_detail: Optional[str] = None
configurator_code: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateBackOrderResponse:
guid: Optional[str] = None
reference: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateBackOrderRequest(CreateBackOrderBase, IPost):
pass
Python CreateBackOrderRequest 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.
POST /v1/backorder HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateBackOrderRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.ServiceModel.BackOrders">
<AdditionalInformation xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">String</AdditionalInformation>
<AgentCriteria xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">
<d2p1:Version>0</d2p1:Version>
<d2p1:BodyStyle xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:BodyStyle>
<d2p1:ColourGroup xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:ColourGroup>
<d2p1:CriteriaDifference>
<d2p1:AdditionalInformation>false</d2p1:AdditionalInformation>
<d2p1:BodyStyle>false</d2p1:BodyStyle>
<d2p1:ColourGroup>false</d2p1:ColourGroup>
<d2p1:Engine>false</d2p1:Engine>
<d2p1:Equipment>false</d2p1:Equipment>
<d2p1:Fuel>false</d2p1:Fuel>
<d2p1:IsSmart>false</d2p1:IsSmart>
<d2p1:IsSpecialised>false</d2p1:IsSpecialised>
<d2p1:Line>false</d2p1:Line>
<d2p1:Model>false</d2p1:Model>
<d2p1:Packages>false</d2p1:Packages>
<d2p1:PreferredDeliveryDate>false</d2p1:PreferredDeliveryDate>
<d2p1:Transmission>false</d2p1:Transmission>
<d2p1:Upholstery>false</d2p1:Upholstery>
<d2p1:UrlReferrer>false</d2p1:UrlReferrer>
</d2p1:CriteriaDifference>
<d2p1:Equipment xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Equipment>
<d2p1:Fuel xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Fuel>
<d2p1:IsNewModel>false</d2p1:IsNewModel>
<d2p1:IsSmart>false</d2p1:IsSmart>
<d2p1:IsSpecialised>false</d2p1:IsSpecialised>
<d2p1:Line xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Line>
<d2p1:Model>
<d2p1:CriteriaModel>
<d2p1:Description>String</d2p1:Description>
<d2p1:Id>0</d2p1:Id>
</d2p1:CriteriaModel>
</d2p1:Model>
<d2p1:Packages xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Packages>
<d2p1:PreferredDeliveryDate>String</d2p1:PreferredDeliveryDate>
<d2p1:Transmission xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Transmission>
<d2p1:Upholstery xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Upholstery>
<d2p1:UrlReferrer>String</d2p1:UrlReferrer>
<d2p1:Engine>
<d2p1:V2EngineCriteria>
<d2p1:Badge>String</d2p1:Badge>
<d2p1:Brand>String</d2p1:Brand>
</d2p1:V2EngineCriteria>
</d2p1:Engine>
</AgentCriteria>
<AssistanceDetail xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">String</AssistanceDetail>
<AssistanceProviderId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">0</AssistanceProviderId>
<ConfigCode xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">String</ConfigCode>
<ConfiguratorCode xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">String</ConfiguratorCode>
<Customer xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">
<d2p1:Address>
<d2p1:County>String</d2p1:County>
<d2p1:Locality>String</d2p1:Locality>
<d2p1:Postcode>String</d2p1:Postcode>
<d2p1:Property>String</d2p1:Property>
<d2p1:Street>String</d2p1:Street>
<d2p1:Town>String</d2p1:Town>
</d2p1:Address>
<d2p1:CompanyName>String</d2p1:CompanyName>
<d2p1:CustomerId>String</d2p1:CustomerId>
<d2p1:EmailAddress>String</d2p1:EmailAddress>
<d2p1:Firstname>String</d2p1:Firstname>
<d2p1:IsCiam>false</d2p1:IsCiam>
<d2p1:Mode>Private</d2p1:Mode>
<d2p1:Surname>String</d2p1:Surname>
<d2p1:Telephone>String</d2p1:Telephone>
<d2p1:Title>String</d2p1:Title>
<d2p1:Preferences>
<d2p1:OptinEmail>false</d2p1:OptinEmail>
<d2p1:OptinPost>false</d2p1:OptinPost>
<d2p1:OptinSMS>false</d2p1:OptinSMS>
<d2p1:OptinTelephone>false</d2p1:OptinTelephone>
</d2p1:Preferences>
<d2p1:ProfileId>00000000-0000-0000-0000-000000000000</d2p1:ProfileId>
</Customer>
<CustomerCriteria xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">
<d2p1:Version>0</d2p1:Version>
<d2p1:BodyStyle xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:BodyStyle>
<d2p1:ColourGroup xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:ColourGroup>
<d2p1:CriteriaDifference>
<d2p1:AdditionalInformation>false</d2p1:AdditionalInformation>
<d2p1:BodyStyle>false</d2p1:BodyStyle>
<d2p1:ColourGroup>false</d2p1:ColourGroup>
<d2p1:Engine>false</d2p1:Engine>
<d2p1:Equipment>false</d2p1:Equipment>
<d2p1:Fuel>false</d2p1:Fuel>
<d2p1:IsSmart>false</d2p1:IsSmart>
<d2p1:IsSpecialised>false</d2p1:IsSpecialised>
<d2p1:Line>false</d2p1:Line>
<d2p1:Model>false</d2p1:Model>
<d2p1:Packages>false</d2p1:Packages>
<d2p1:PreferredDeliveryDate>false</d2p1:PreferredDeliveryDate>
<d2p1:Transmission>false</d2p1:Transmission>
<d2p1:Upholstery>false</d2p1:Upholstery>
<d2p1:UrlReferrer>false</d2p1:UrlReferrer>
</d2p1:CriteriaDifference>
<d2p1:Equipment xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Equipment>
<d2p1:Fuel xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Fuel>
<d2p1:IsNewModel>false</d2p1:IsNewModel>
<d2p1:IsSmart>false</d2p1:IsSmart>
<d2p1:IsSpecialised>false</d2p1:IsSpecialised>
<d2p1:Line xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Line>
<d2p1:Model>
<d2p1:CriteriaModel>
<d2p1:Description>String</d2p1:Description>
<d2p1:Id>0</d2p1:Id>
</d2p1:CriteriaModel>
</d2p1:Model>
<d2p1:Packages xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Packages>
<d2p1:PreferredDeliveryDate>String</d2p1:PreferredDeliveryDate>
<d2p1:Transmission xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Transmission>
<d2p1:Upholstery xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Upholstery>
<d2p1:UrlReferrer>String</d2p1:UrlReferrer>
<d2p1:Engine xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</d2p1:Engine>
</CustomerCriteria>
<GasId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">String</GasId>
<GssnId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">String</GssnId>
<Motability xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">false</Motability>
<MotabilityPricingId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">0</MotabilityPricingId>
<OutrightPurchase xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">
<d2p1:Bm7NST>String</d2p1:Bm7NST>
<d2p1:DiscountRate>0</d2p1:DiscountRate>
<d2p1:IsBackOrder>false</d2p1:IsBackOrder>
<d2p1:IsCOPConverter>false</d2p1:IsCOPConverter>
<d2p1:IsOutrightPurchase>false</d2p1:IsOutrightPurchase>
<d2p1:Reference>String</d2p1:Reference>
</OutrightPurchase>
<Source xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">OnlineShowroom</Source>
<TagUrl xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Requests">String</TagUrl>
</CreateBackOrderRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreateBackOrderResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Responses"> <Guid>String</Guid> <Reference>String</Reference> </CreateBackOrderResponse>