Mercedes.Agency.Orchestration.API

<back to all web services

CreateOneAdminOrderRequest

Order
Requires Authentication
The following routes are available for this service:
POST/v1/oneAdmin/orderCreates an order for a selected vehicle via the Agency APIThis endpoint is called from the OneAdmin portal to create a vehicle order. It builds the order request object for the Agency API before calling it to create the order. The information it retrieves and builds for the Agency API request include 1.) The customer. 2.) The vehicle. 3.) Ourright purchase. 4.) Motability. 5.) Offers applicable to the vehicle Validation is performed on the input data which includes checking for mandatory items: 1.} Customer details 2.) Vehicle Vin 3.) Agent 4.) GSSN Outlet Id 5.) Source 6.) Order Type 7.) Customer Location Id 8.) Estimated Handover Date
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


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateOrderResponse:
    guid: Optional[str] = None
    reference: Optional[str] = None
    response_status: Optional[ResponseStatus] = None
    back_order_reference: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateOneAdminOrderRequest(CreateOrderBase, IGet):
    customer_location_id: Optional[int] = None

Python CreateOneAdminOrderRequest DTOs

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

HTTP + OTHER

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

POST /v1/oneAdmin/order HTTP/1.1 
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"CustomerLocationId":0,"Source":"OnlineShowroom","GssnId":"String","AdditionalInformation":"String","Cash":false,"Finance":false,"Customer":{"ProfileId":"00000000000000000000000000000000","Preferences":{"OptinEmail":false,"OptinPost":false,"OptinSMS":false,"OptinTelephone":false},"CustomerId":"String","IsCiam":false,"CompanyName":"String","Title":"String","Firstname":"String","Surname":"String","EmailAddress":"String","Telephone":"String","Address":{"Property":"String","Street":"String","Town":"String","County":"String","Locality":"String","Postcode":"String"},"Mode":"Private"},"Vehicle":{"Vin":"String"},"FinanceCriteria":{"Key":"String","Name":"String","Type":"String","IsDefault":false,"Term":{"Options":[{"IsDefault":false,"Value":0}]},"Deposit":{"Default":"String"},"Mileage":{"Options":[{"IsDefault":false,"Value":0}]},"AdvanceRentals":{"Options":[{"IsDefault":false,"Value":0}]},"IsPersonalised":false,"RegularPayment":"String","PartExchange":"String","Settlement":"String","CustomerType":"String","VehicleType":"UNASSIGNED"},"BackOrderGuid":"00000000000000000000000000000000","TagUrl":"String","OutrightPurchase":{"IsOutrightPurchase":false,"Reference":"String","DiscountRate":0,"Bm7NST":"String","IsBackOrder":false,"IsCOPConverter":false},"Motability":false,"MotabilityPricingId":0,"FinanceApplicationReference":"String","Specialist":false,"GasId":"String","PersonalisedItemOfferIds":[0],"SuggestedVin":"String","NonOptimumReason":"String","MotabilityType":"PIP","EstimatedHandoverDate":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Guid":"String","Reference":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"BackOrderReference":"String"}