| 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 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
public var bM7NST:String
public var modelYearCode:String
public var halfModelYearCode: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 bM7NST
case modelYearCode
case halfModelYearCode
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)
bM7NST = try container.decodeIfPresent(String.self, forKey: .bM7NST)
modelYearCode = try container.decodeIfPresent(String.self, forKey: .modelYearCode)
halfModelYearCode = try container.decodeIfPresent(String.self, forKey: .halfModelYearCode)
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 bM7NST != nil { try container.encode(bM7NST, forKey: .bM7NST) }
if modelYearCode != nil { try container.encode(modelYearCode, forKey: .modelYearCode) }
if halfModelYearCode != nil { try container.encode(halfModelYearCode, forKey: .halfModelYearCode) }
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
public var consentAgreedStatus:ConsentAgreedStatus
public var messageDelivered:Bool?
required public init(){}
}
public class ConsentAgreedStatus : Codable
{
public var consentStatus:String
public var consentSelected:[String:Bool] = [:]
public var recommendedAction:String
required public init(){}
}
Swift CreateOneAdminBackOrderRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
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: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"GssnId":"String","AdditionalInformation":"String","Source":"OnlineShowroom","TagUrl":"String","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"},"CustomerCriteria":{"Engine":["String"],"Transmission":["String"],"Fuel":["String"],"Upholstery":["String"],"Equipment":["String"],"Line":["String"],"BodyStyle":["String"],"ColourGroup":["String"],"Packages":["String"],"Model":[{"Description":"String","Id":0}],"UrlReferrer":"String","PreferredDeliveryDate":"String","BM7NST":"String","ModelYearCode":"String","HalfModelYearCode":"String","IsNewModel":false,"IsSmart":false,"IsSpecialised":false,"CriteriaDifference":{"Model":false,"Transmission":false,"Fuel":false,"Upholstery":false,"Equipment":false,"Line":false,"BodyStyle":false,"ColourGroup":false,"Packages":false,"Engine":false,"AdditionalInformation":false,"UrlReferrer":false,"PreferredDeliveryDate":false,"IsSmart":false,"IsSpecialised":false},"Version":0},"AgentCriteria":{"Engine":[{"Badge":"String","Brand":"String"}],"Transmission":["String"],"Fuel":["String"],"Upholstery":["String"],"Equipment":["String"],"Line":["String"],"BodyStyle":["String"],"ColourGroup":["String"],"Packages":["String"],"Model":[{"Description":"String","Id":0}],"UrlReferrer":"String","PreferredDeliveryDate":"String","BM7NST":"String","ModelYearCode":"String","HalfModelYearCode":"String","IsNewModel":false,"IsSmart":false,"IsSpecialised":false,"CriteriaDifference":{"Model":false,"Transmission":false,"Fuel":false,"Upholstery":false,"Equipment":false,"Line":false,"BodyStyle":false,"ColourGroup":false,"Packages":false,"Engine":false,"AdditionalInformation":false,"UrlReferrer":false,"PreferredDeliveryDate":false,"IsSmart":false,"IsSpecialised":false},"Version":0},"OutrightPurchase":{"IsOutrightPurchase":false,"Reference":"String","DiscountRate":0,"Bm7NST":"String","IsBackOrder":false,"IsCOPConverter":false},"GasId":"String","Motability":false,"MotabilityPricingId":0,"AssistanceProviderId":0,"AssistanceDetail":"String","ConfiguratorCode":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"Guid":"String","Reference":"String","ConsentAgreedStatus":{"ConsentStatus":"String","ConsentSelected":{"String":false},"RecommendedAction":"String"},"MessageDelivered":false}