GET | /v1/order/customer/{CustomerId} | Get Order by Customer |
---|
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
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Order:
guid: Optional[str] = None
reference: Optional[str] = None
status: int = 0
customer_id: Optional[str] = None
mulesoft_reference: Optional[str] = None
gas_id: Optional[str] = None
order_date: Optional[str] = None
offer_snap_shot: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OrderStatus:
id: int = 0
description: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OnlineShowroomStatus:
id: int = 0
description: Optional[str] = None
slug: Optional[str] = None
current: bool = False
completed: bool = False
order_statuses: List[OrderStatus] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RetailerOpeningTime:
day: Optional[str] = None
open_from: Optional[str] = None
open_to: Optional[str] = None
special: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RetailerOpeningTimes:
new: List[RetailerOpeningTime] = field(default_factory=list)
used: List[RetailerOpeningTime] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Retailer:
id: int = 0
gssn_id: Optional[str] = None
description: Optional[str] = None
street: Optional[str] = None
city: Optional[str] = None
postcode: Optional[str] = None
google_map_postcode: Optional[str] = None
phone: Optional[str] = None
fax: Optional[str] = None
email: Optional[str] = None
website: Optional[str] = None
retailer_group_id: Optional[str] = None
retailer_group_name: Optional[str] = None
is_online: bool = False
is_new_car_retailer: bool = False
is_used_car_retailer: bool = False
is_central_retailer: bool = False
chat_enabled: bool = False
trade_in_enabled: bool = False
smart: bool = False
display_phone_number_new: Optional[str] = None
display_phone_number_used: Optional[str] = None
latitude: Decimal = decimal.Decimal(0)
longitude: Decimal = decimal.Decimal(0)
smart_description: Optional[str] = None
smart_website: Optional[str] = None
smart_phone: Optional[str] = None
legacy_id: Optional[str] = None
agent: bool = False
market_area_id: int = 0
digital_lounge_parent_gssn_id: Optional[str] = None
send_leads_to_digital_lounge_parent: bool = False
opening_times: Optional[RetailerOpeningTimes] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OnlineShowroomVehicle:
vin: Optional[str] = None
vehicle_class: Optional[str] = None
transmission_type: Optional[str] = None
fuel_type: Optional[str] = None
image_url: Optional[str] = None
colour: Optional[str] = None
description: Optional[str] = None
body_style: Optional[str] = None
upholstery_type: Optional[str] = None
retailer: Optional[Retailer] = None
otr: Decimal = decimal.Decimal(0)
actual_price: Decimal = decimal.Decimal(0)
total_offer_value: Decimal = decimal.Decimal(0)
net_price: Decimal = decimal.Decimal(0)
vehicle_type: Optional[str] = None
offer_expiry_date: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PaymentDetail:
payment_type: Optional[str] = None
payment_link: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OnlineShowroomOrder:
guid: Optional[str] = None
reference: Optional[str] = None
status: List[OnlineShowroomStatus] = field(default_factory=list)
vehicle: Optional[OnlineShowroomVehicle] = None
closed_date: Optional[str] = None
customer_id: Optional[str] = None
handover_date: Optional[str] = None
closed_reason: Optional[str] = None
order_date: Optional[str] = None
payment_links: List[PaymentDetail] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetOrderCustomerResponse:
orders: List[Order] = field(default_factory=list)
completed: List[OnlineShowroomOrder] = field(default_factory=list)
cancelled: List[OnlineShowroomOrder] = field(default_factory=list)
in_progress: List[OnlineShowroomOrder] = field(default_factory=list)
archived: List[OnlineShowroomOrder] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetOrderCustomerRequest(IGet):
customer_id: Optional[str] = None
Python GetOrderCustomerRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/order/customer/{CustomerId} HTTP/1.1 Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Orders: [ { Guid: 00000000000000000000000000000000, Reference: String, Status: 0, CustomerId: String, MulesoftReference: String, GasId: String, OrderDate: String, OfferSnapShot: String } ], Completed: [ { Guid: 00000000000000000000000000000000, Reference: String, Status: [ { Id: 0, Description: String, Slug: String, Current: False, Completed: False, OrderStatuses: [ { Id: 0, Description: String } ] } ], Vehicle: { Vin: String, VehicleClass: String, TransmissionType: String, FuelType: String, ImageUrl: String, Colour: String, Description: String, BodyStyle: String, UpholsteryType: String, Retailer: { Id: 0, GssnId: String, Description: String, Street: String, City: String, Postcode: String, GoogleMapPostcode: String, Phone: String, Fax: String, Email: String, Website: String, RetailerGroupId: String, RetailerGroupName: String, IsOnline: False, IsNewCarRetailer: False, IsUsedCarRetailer: False, IsCentralRetailer: False, ChatEnabled: False, TradeInEnabled: False, smart: False, DisplayPhoneNumberNew: String, DisplayPhoneNumberUsed: String, Latitude: 0, Longitude: 0, smartDescription: String, smartWebsite: String, smartPhone: String, LegacyId: String, Agent: False, MarketAreaId: 0, DigitalLoungeParentGssnId: String, SendLeadsToDigitalLoungeParent: False, OpeningTimes: { New: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ], Used: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ] } }, OTR: 0, ActualPrice: 0, TotalOfferValue: 0, NetPrice: 0, VehicleType: String, OfferExpiryDate: String }, ClosedDate: String, CustomerId: String, HandoverDate: String, ClosedReason: String, OrderDate: String, PaymentLinks: [ { PaymentType: String, PaymentLink: String } ] } ], Cancelled: [ { Guid: 00000000000000000000000000000000, Reference: String, Status: [ { Id: 0, Description: String, Slug: String, Current: False, Completed: False, OrderStatuses: [ { Id: 0, Description: String } ] } ], Vehicle: { Vin: String, VehicleClass: String, TransmissionType: String, FuelType: String, ImageUrl: String, Colour: String, Description: String, BodyStyle: String, UpholsteryType: String, Retailer: { Id: 0, GssnId: String, Description: String, Street: String, City: String, Postcode: String, GoogleMapPostcode: String, Phone: String, Fax: String, Email: String, Website: String, RetailerGroupId: String, RetailerGroupName: String, IsOnline: False, IsNewCarRetailer: False, IsUsedCarRetailer: False, IsCentralRetailer: False, ChatEnabled: False, TradeInEnabled: False, smart: False, DisplayPhoneNumberNew: String, DisplayPhoneNumberUsed: String, Latitude: 0, Longitude: 0, smartDescription: String, smartWebsite: String, smartPhone: String, LegacyId: String, Agent: False, MarketAreaId: 0, DigitalLoungeParentGssnId: String, SendLeadsToDigitalLoungeParent: False, OpeningTimes: { New: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ], Used: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ] } }, OTR: 0, ActualPrice: 0, TotalOfferValue: 0, NetPrice: 0, VehicleType: String, OfferExpiryDate: String }, ClosedDate: String, CustomerId: String, HandoverDate: String, ClosedReason: String, OrderDate: String, PaymentLinks: [ { PaymentType: String, PaymentLink: String } ] } ], InProgress: [ { Guid: 00000000000000000000000000000000, Reference: String, Status: [ { Id: 0, Description: String, Slug: String, Current: False, Completed: False, OrderStatuses: [ { Id: 0, Description: String } ] } ], Vehicle: { Vin: String, VehicleClass: String, TransmissionType: String, FuelType: String, ImageUrl: String, Colour: String, Description: String, BodyStyle: String, UpholsteryType: String, Retailer: { Id: 0, GssnId: String, Description: String, Street: String, City: String, Postcode: String, GoogleMapPostcode: String, Phone: String, Fax: String, Email: String, Website: String, RetailerGroupId: String, RetailerGroupName: String, IsOnline: False, IsNewCarRetailer: False, IsUsedCarRetailer: False, IsCentralRetailer: False, ChatEnabled: False, TradeInEnabled: False, smart: False, DisplayPhoneNumberNew: String, DisplayPhoneNumberUsed: String, Latitude: 0, Longitude: 0, smartDescription: String, smartWebsite: String, smartPhone: String, LegacyId: String, Agent: False, MarketAreaId: 0, DigitalLoungeParentGssnId: String, SendLeadsToDigitalLoungeParent: False, OpeningTimes: { New: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ], Used: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ] } }, OTR: 0, ActualPrice: 0, TotalOfferValue: 0, NetPrice: 0, VehicleType: String, OfferExpiryDate: String }, ClosedDate: String, CustomerId: String, HandoverDate: String, ClosedReason: String, OrderDate: String, PaymentLinks: [ { PaymentType: String, PaymentLink: String } ] } ], Archived: [ { Guid: 00000000000000000000000000000000, Reference: String, Status: [ { Id: 0, Description: String, Slug: String, Current: False, Completed: False, OrderStatuses: [ { Id: 0, Description: String } ] } ], Vehicle: { Vin: String, VehicleClass: String, TransmissionType: String, FuelType: String, ImageUrl: String, Colour: String, Description: String, BodyStyle: String, UpholsteryType: String, Retailer: { Id: 0, GssnId: String, Description: String, Street: String, City: String, Postcode: String, GoogleMapPostcode: String, Phone: String, Fax: String, Email: String, Website: String, RetailerGroupId: String, RetailerGroupName: String, IsOnline: False, IsNewCarRetailer: False, IsUsedCarRetailer: False, IsCentralRetailer: False, ChatEnabled: False, TradeInEnabled: False, smart: False, DisplayPhoneNumberNew: String, DisplayPhoneNumberUsed: String, Latitude: 0, Longitude: 0, smartDescription: String, smartWebsite: String, smartPhone: String, LegacyId: String, Agent: False, MarketAreaId: 0, DigitalLoungeParentGssnId: String, SendLeadsToDigitalLoungeParent: False, OpeningTimes: { New: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ], Used: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ] } }, OTR: 0, ActualPrice: 0, TotalOfferValue: 0, NetPrice: 0, VehicleType: String, OfferExpiryDate: String }, ClosedDate: String, CustomerId: String, HandoverDate: String, ClosedReason: String, OrderDate: String, PaymentLinks: [ { PaymentType: String, PaymentLink: String } ] } ] }