POST | /v1/oneAdmin/backorder | Creates a back order with vehicle criteria | Create Back Order (called from One Admin) It calls the v1/backorder in the Agency API, where the order is created The details of the back order are sent to OneAgent Validation checks are performed on the input request. |
---|
import Foundation
import ServiceStack
public class CreateOneAdminBackOrderRequest : CreateBackOrderBase, IPost
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public class CreateBackOrderBase : Codable
{
public var gssnId:String
public var additionalInformation:String
public var configCode:String
public var source:Source
public var tagUrl:String
public var customer:Customer
public var customerCriteria:Criteria
public var agentCriteria:V2Criteria
public var outrightPurchase:OutrightPurchase
public var gasId:String
public var motability:Bool
public var motabilityPricingId:Int?
public var assistanceProviderId:Int?
public var assistanceDetail:String
public var configuratorCode:String
required public init(){}
}
public enum Source : Int, Codable
{
case OnlineShowroom = 1
case OneAdmin = 2
}
public class Customer : SalesforceCustomer
{
public var profileId:String?
public var preferences:Preferences
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case profileId
case preferences
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
profileId = try container.decodeIfPresent(String.self, forKey: .profileId)
preferences = try container.decodeIfPresent(Preferences.self, forKey: .preferences)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if profileId != nil { try container.encode(profileId, forKey: .profileId) }
if preferences != nil { try container.encode(preferences, forKey: .preferences) }
}
}
public class SalesforceCustomer : ICustomer, Codable
{
public var customerId:String
public var isCiam:Bool
public var companyName:String
public var title:String
public var firstname:String
public var surname:String
public var emailAddress:String
public var telephone:String
public var address:Address
public var mode:CustomerMode
required public init(){}
}
public class Address : Codable
{
public var property:String
public var street:String
public var town:String
public var county:String
public var locality:String
public var postcode:String
required public init(){}
}
public enum CustomerMode : Int, Codable
{
case Private = 1
case Business = 2
case Motability = 3
}
public class Preferences : Codable
{
public var optinEmail:Bool
public var optinPost:Bool
public var optinSMS:Bool
public var optinTelephone:Bool
required public init(){}
}
public class Criteria : CriteriaBase
{
public var engine:[String] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case engine
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
engine = try container.decodeIfPresent([String].self, forKey: .engine) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if engine.count > 0 { try container.encode(engine, forKey: .engine) }
}
}
public class CriteriaBase : JsonVersion
{
public var transmission:[String] = []
public var fuel:[String] = []
public var upholstery:[String] = []
public var equipment:[String] = []
public var line:[String] = []
public var bodyStyle:[String] = []
public var colourGroup:[String] = []
public var packages:[String] = []
public var model:[CriteriaModel] = []
public var urlReferrer:String
public var preferredDeliveryDate:String
// @ApiMember(ExcludeInSchema=true)
public var isNewModel:Bool
// @ApiMember(ExcludeInSchema=true)
public var isSmart:Bool
// @ApiMember(ExcludeInSchema=true)
public var isSpecialised:Bool
// @ApiMember(ExcludeInSchema=true)
public var criteriaDifference:CriteriaDifference
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case transmission
case fuel
case upholstery
case equipment
case line
case bodyStyle
case colourGroup
case packages
case model
case urlReferrer
case preferredDeliveryDate
case isNewModel
case isSmart
case isSpecialised
case criteriaDifference
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
transmission = try container.decodeIfPresent([String].self, forKey: .transmission) ?? []
fuel = try container.decodeIfPresent([String].self, forKey: .fuel) ?? []
upholstery = try container.decodeIfPresent([String].self, forKey: .upholstery) ?? []
equipment = try container.decodeIfPresent([String].self, forKey: .equipment) ?? []
line = try container.decodeIfPresent([String].self, forKey: .line) ?? []
bodyStyle = try container.decodeIfPresent([String].self, forKey: .bodyStyle) ?? []
colourGroup = try container.decodeIfPresent([String].self, forKey: .colourGroup) ?? []
packages = try container.decodeIfPresent([String].self, forKey: .packages) ?? []
model = try container.decodeIfPresent([CriteriaModel].self, forKey: .model) ?? []
urlReferrer = try container.decodeIfPresent(String.self, forKey: .urlReferrer)
preferredDeliveryDate = try container.decodeIfPresent(String.self, forKey: .preferredDeliveryDate)
isNewModel = try container.decodeIfPresent(Bool.self, forKey: .isNewModel)
isSmart = try container.decodeIfPresent(Bool.self, forKey: .isSmart)
isSpecialised = try container.decodeIfPresent(Bool.self, forKey: .isSpecialised)
criteriaDifference = try container.decodeIfPresent(CriteriaDifference.self, forKey: .criteriaDifference)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if transmission.count > 0 { try container.encode(transmission, forKey: .transmission) }
if fuel.count > 0 { try container.encode(fuel, forKey: .fuel) }
if upholstery.count > 0 { try container.encode(upholstery, forKey: .upholstery) }
if equipment.count > 0 { try container.encode(equipment, forKey: .equipment) }
if line.count > 0 { try container.encode(line, forKey: .line) }
if bodyStyle.count > 0 { try container.encode(bodyStyle, forKey: .bodyStyle) }
if colourGroup.count > 0 { try container.encode(colourGroup, forKey: .colourGroup) }
if packages.count > 0 { try container.encode(packages, forKey: .packages) }
if model.count > 0 { try container.encode(model, forKey: .model) }
if urlReferrer != nil { try container.encode(urlReferrer, forKey: .urlReferrer) }
if preferredDeliveryDate != nil { try container.encode(preferredDeliveryDate, forKey: .preferredDeliveryDate) }
if isNewModel != nil { try container.encode(isNewModel, forKey: .isNewModel) }
if isSmart != nil { try container.encode(isSmart, forKey: .isSmart) }
if isSpecialised != nil { try container.encode(isSpecialised, forKey: .isSpecialised) }
if criteriaDifference != nil { try container.encode(criteriaDifference, forKey: .criteriaDifference) }
}
}
public class JsonVersion : IJsonVersion, Codable
{
public var version:Int
required public init(){}
}
public class CriteriaModel : Codable
{
public var Description:String
public var id:Int
required public init(){}
}
public class CriteriaDifference : Codable
{
public var model:Bool
public var transmission:Bool
public var fuel:Bool
public var upholstery:Bool
public var equipment:Bool
public var line:Bool
public var bodyStyle:Bool
public var colourGroup:Bool
public var packages:Bool
public var engine:Bool
public var additionalInformation:Bool
public var urlReferrer:Bool
public var preferredDeliveryDate:Bool
public var isSmart:Bool
public var isSpecialised:Bool
required public init(){}
}
public class V2Criteria : CriteriaBase
{
public var engine:[V2EngineCriteria] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case engine
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
engine = try container.decodeIfPresent([V2EngineCriteria].self, forKey: .engine) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if engine.count > 0 { try container.encode(engine, forKey: .engine) }
}
}
public class V2EngineCriteria : Codable
{
public var badge:String
public var brand:String
required public init(){}
}
public class OutrightPurchase : Codable
{
public var isOutrightPurchase:Bool
public var reference:String
public var discountRate:Double
public var bm7NST:String
public var isBackOrder:Bool
public var isCOPConverter:Bool
required public init(){}
}
public class CreateBackOrderResponse : Codable
{
public var guid:String
public var reference:String
required public init(){}
}
Swift CreateOneAdminBackOrderRequest 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/oneAdmin/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
<CreateOneAdminBackOrderRequest 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>
</CreateOneAdminBackOrderRequest>
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>