POST | /v1/pricingdetails | Creates a detailed pricing of a vehicle |
---|
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 Vehicle:
vin: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Option:
is_default: bool = False
value: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Term:
options: List[Option] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Deposit:
default: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Mileage:
options: List[Option] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AdvanceRentals:
options: List[Option] = field(default_factory=list)
class VehicleType(str, Enum):
UNASSIGNED = 'UNASSIGNED'
NEW = 'NEW'
USED = 'USED'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FinanceCriteria:
key: Optional[str] = None
name: Optional[str] = None
type: Optional[str] = None
is_default: bool = False
term: Optional[Term] = None
deposit: Optional[Deposit] = None
mileage: Optional[Mileage] = None
advance_rentals: Optional[AdvanceRentals] = None
is_personalised: bool = False
regular_payment: Optional[str] = None
part_exchange: Optional[str] = None
settlement: Optional[str] = None
customer_type: Optional[str] = None
vehicle_type: Optional[VehicleType] = None
@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
class MotabilityType(IntEnum):
PIP = 1
WPMS = 2
UNASSIGNED = 3
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateOrderBase:
source: Optional[Source] = None
gssn_id: Optional[str] = None
additional_information: Optional[str] = None
cash: bool = False
finance: bool = False
customer: Optional[Customer] = None
vehicle: Optional[Vehicle] = None
finance_criteria: Optional[FinanceCriteria] = None
back_order_guid: Optional[str] = None
tag_url: Optional[str] = None
outright_purchase: Optional[OutrightPurchase] = None
motability: bool = False
motability_pricing_id: Optional[int] = None
finance_application_reference: Optional[str] = None
specialist: bool = False
gas_id: Optional[str] = None
personalised_item_offer_ids: Optional[List[int]] = None
suggested_vin: Optional[str] = None
non_optimum_reason: Optional[str] = None
motability_type: Optional[MotabilityType] = None
estimated_handover_date: Optional[str] = None
class OfferPriceProductType(str, Enum):
LIS_T__P_R_I_C_E = 'LIST_PRICE'
NUMBE_R__P_L_A_T_E__F_E_E = 'NUMBER_PLATE_FEE'
DELIVER_Y__C_H_A_R_G_E = 'DELIVERY_CHARGE'
FUE_L__C_H_A_R_G_E = 'FUEL_CHARGE'
MANUFACTURE_R__O_F_F_E_R = 'MANUFACTURER_OFFER'
PERSONALISE_D__M_O_N_E_Y_O_F_F_E_R = 'PERSONALISED_MONEYOFFER'
PERSONALISE_D__N_O_N_M_O_N_E_Y_O_F_F_E_R = 'PERSONALISED_NONMONEYOFFER'
PERSONALISE_D__N_O_N_M_O_N_E_Y_O_F_F_E_R__N_E_G = 'PERSONALISED_NONMONEYOFFER_NEG'
SERVICE = 'SERVICE'
SERVIC_E__N_E_G = 'SERVICE_NEG'
GOVERNMEN_T__G_R_A_N_T = 'GOVERNMENT_GRANT'
OUTRIGH_T__P_U_R_C_H_A_S_E__D_I_S_C_O_U_N_T = 'OUTRIGHT_PURCHASE_DISCOUNT'
VI_P__O_F_F_E_R = 'VIP_OFFER'
WALLBO_X__O_F_F_E_R = 'WALLBOX_OFFER'
WALLBO_X__O_F_F_E_R__N_E_G = 'WALLBOX_OFFER_NEG'
ROA_D__F_U_N_D__L_I_C_E_N_C_E = 'ROAD_FUND_LICENCE'
FIRS_T__R_E_G_I_S_T_R_A_T_I_O_N__F_E_E = 'FIRST_REGISTRATION_FEE'
NO_T__F_O_U_N_D = 'NOT_FOUND'
ACCESSOR_Y__O_F_F_E_R = 'ACCESSORY_OFFER'
ACCESSOR_Y__O_F_F_E_R__N_E_G = 'ACCESSORY_OFFER_NEG'
MOTABILIT_Y__D_I_S_C_O_U_N_T = 'MOTABILITY_DISCOUNT'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Price:
id: Optional[str] = None
description: Optional[str] = None
net: Decimal = decimal.Decimal(0)
vat: Decimal = decimal.Decimal(0)
gross: Decimal = decimal.Decimal(0)
product: Optional[OfferPriceProductType] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetPricingDetailsResponse:
price: Optional[Price] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetPricingDetailsRequest(CreateOrderBase, IPost):
pass
Python GetPricingDetailsRequest 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/pricingdetails HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetPricingDetailsRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.ServiceModel.Pricing">
<AdditionalInformation xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</AdditionalInformation>
<BackOrderGuid xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">00000000-0000-0000-0000-000000000000</BackOrderGuid>
<Cash xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">false</Cash>
<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.Business.Poco">
<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>
<EstimatedHandoverDate xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</EstimatedHandoverDate>
<Finance xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">false</Finance>
<FinanceApplicationReference xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</FinanceApplicationReference>
<FinanceCriteria xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">
<d2p1:AdvanceRentals>
<d2p1:Options>
<d2p1:Option>
<d2p1:IsDefault>false</d2p1:IsDefault>
<d2p1:Value>0</d2p1:Value>
</d2p1:Option>
</d2p1:Options>
</d2p1:AdvanceRentals>
<d2p1:CustomerType>String</d2p1:CustomerType>
<d2p1:Deposit>
<d2p1:Default>String</d2p1:Default>
</d2p1:Deposit>
<d2p1:IsDefault>false</d2p1:IsDefault>
<d2p1:IsPersonalised>false</d2p1:IsPersonalised>
<d2p1:Key>String</d2p1:Key>
<d2p1:Mileage>
<d2p1:Options>
<d2p1:Option>
<d2p1:IsDefault>false</d2p1:IsDefault>
<d2p1:Value>0</d2p1:Value>
</d2p1:Option>
</d2p1:Options>
</d2p1:Mileage>
<d2p1:Name>String</d2p1:Name>
<d2p1:PartExchange>String</d2p1:PartExchange>
<d2p1:RegularPayment>String</d2p1:RegularPayment>
<d2p1:Settlement>String</d2p1:Settlement>
<d2p1:Term>
<d2p1:Options>
<d2p1:Option>
<d2p1:IsDefault>false</d2p1:IsDefault>
<d2p1:Value>0</d2p1:Value>
</d2p1:Option>
</d2p1:Options>
</d2p1:Term>
<d2p1:Type>String</d2p1:Type>
<d2p1:VehicleType>UNASSIGNED</d2p1:VehicleType>
</FinanceCriteria>
<GasId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</GasId>
<GssnId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</GssnId>
<Motability xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">false</Motability>
<MotabilityPricingId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">0</MotabilityPricingId>
<MotabilityType xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">PIP</MotabilityType>
<NonOptimumReason xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</NonOptimumReason>
<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.Business.Poco">
<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>
<PersonalisedItemOfferIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">
<d2p1:int>0</d2p1:int>
</PersonalisedItemOfferIds>
<Source xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">OnlineShowroom</Source>
<Specialist xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">false</Specialist>
<SuggestedVin xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</SuggestedVin>
<TagUrl xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</TagUrl>
<Vehicle xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">
<d2p1:Vin>String</d2p1:Vin>
</Vehicle>
</GetPricingDetailsRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <GetPricingDetailsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Responses"> <Price xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO"> <d2p1:Description>String</d2p1:Description> <d2p1:Gross>0</d2p1:Gross> <d2p1:Id>String</d2p1:Id> <d2p1:Net>0</d2p1:Net> <d2p1:Product>LIST_PRICE</d2p1:Product> <d2p1:VAT>0</d2p1:VAT> </Price> </GetPricingDetailsResponse>