POST | /v1/oneAdmin/order | Creates an order for a selected vehicle via the Agency API | This 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 |
---|
"use strict";
/** @typedef {number} */
export var Source;
(function (Source) {
Source[Source["OnlineShowroom"] = 1] = "OnlineShowroom"
Source[Source["OneAdmin"] = 2] = "OneAdmin"
})(Source || (Source = {}));
export class Address {
/** @param {{Property?:string,Street?:string,Town?:string,County?:string,Locality?:string,Postcode?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Property;
/** @type {string} */
Street;
/** @type {string} */
Town;
/** @type {string} */
County;
/** @type {string} */
Locality;
/** @type {string} */
Postcode;
}
/** @typedef {number} */
export var CustomerMode;
(function (CustomerMode) {
CustomerMode[CustomerMode["Private"] = 1] = "Private"
CustomerMode[CustomerMode["Business"] = 2] = "Business"
CustomerMode[CustomerMode["Motability"] = 3] = "Motability"
})(CustomerMode || (CustomerMode = {}));
export class SalesforceCustomer {
/** @param {{CustomerId?:string,IsCiam?:boolean,CompanyName?:string,Title?:string,Firstname?:string,Surname?:string,EmailAddress?:string,Telephone?:string,Address?:Address,Mode?:CustomerMode}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
CustomerId;
/** @type {boolean} */
IsCiam;
/** @type {string} */
CompanyName;
/** @type {string} */
Title;
/** @type {string} */
Firstname;
/** @type {string} */
Surname;
/** @type {string} */
EmailAddress;
/** @type {string} */
Telephone;
/** @type {Address} */
Address;
/** @type {CustomerMode} */
Mode;
}
export class Preferences {
/** @param {{OptinEmail?:boolean,OptinPost?:boolean,OptinSMS?:boolean,OptinTelephone?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {boolean} */
OptinEmail;
/** @type {boolean} */
OptinPost;
/** @type {boolean} */
OptinSMS;
/** @type {boolean} */
OptinTelephone;
}
export class Customer extends SalesforceCustomer {
/** @param {{ProfileId?:string,Preferences?:Preferences,CustomerId?:string,IsCiam?:boolean,CompanyName?:string,Title?:string,Firstname?:string,Surname?:string,EmailAddress?:string,Telephone?:string,Address?:Address,Mode?:CustomerMode}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
/** @type {?string} */
ProfileId;
/** @type {?Preferences} */
Preferences;
}
export class Vehicle {
/** @param {{Vin?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {?string} */
Vin;
}
export class Option {
/** @param {{IsDefault?:boolean,Value?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {boolean} */
IsDefault;
/** @type {number} */
Value;
}
export class Term {
/** @param {{Options?:Option[]}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {Option[]} */
Options = [];
}
export class Deposit {
/** @param {{Default?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Default;
}
export class Mileage {
/** @param {{Options?:Option[]}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {Option[]} */
Options = [];
}
export class AdvanceRentals {
/** @param {{Options?:Option[]}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {Option[]} */
Options = [];
}
/** @typedef {'UNASSIGNED'|'NEW'|'USED'} */
export var VehicleType;
(function (VehicleType) {
VehicleType["UNASSIGNED"] = "UNASSIGNED"
VehicleType["NEW"] = "NEW"
VehicleType["USED"] = "USED"
})(VehicleType || (VehicleType = {}));
export class FinanceCriteria {
/** @param {{Key?:string,Name?:string,Type?:string,IsDefault?:boolean,Term?:Term,Deposit?:Deposit,Mileage?:Mileage,AdvanceRentals?:AdvanceRentals,IsPersonalised?:boolean,RegularPayment?:string,PartExchange?:string,Settlement?:string,CustomerType?:string,VehicleType?:VehicleType}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Key;
/** @type {string} */
Name;
/** @type {string} */
Type;
/** @type {boolean} */
IsDefault;
/** @type {Term} */
Term;
/** @type {Deposit} */
Deposit;
/** @type {Mileage} */
Mileage;
/** @type {AdvanceRentals} */
AdvanceRentals;
/** @type {boolean} */
IsPersonalised;
/** @type {string} */
RegularPayment;
/** @type {string} */
PartExchange;
/** @type {string} */
Settlement;
/** @type {string} */
CustomerType;
/** @type {VehicleType} */
VehicleType;
}
export class OutrightPurchase {
/** @param {{IsOutrightPurchase?:boolean,Reference?:string,DiscountRate?:number,Bm7NST?:string,IsBackOrder?:boolean,IsCOPConverter?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {boolean} */
IsOutrightPurchase;
/** @type {string} */
Reference;
/** @type {number} */
DiscountRate;
/** @type {string} */
Bm7NST;
/** @type {boolean} */
IsBackOrder;
/** @type {boolean} */
IsCOPConverter;
}
/** @typedef {number} */
export var MotabilityType;
(function (MotabilityType) {
MotabilityType[MotabilityType["PIP"] = 1] = "PIP"
MotabilityType[MotabilityType["WPMS"] = 2] = "WPMS"
MotabilityType[MotabilityType["UNASSIGNED"] = 3] = "UNASSIGNED"
})(MotabilityType || (MotabilityType = {}));
export class CreateOrderBase {
/** @param {{Source?:Source,GssnId?:string,AdditionalInformation?:string,Cash?:boolean,Finance?:boolean,Customer?:Customer,Vehicle?:Vehicle,FinanceCriteria?:FinanceCriteria,BackOrderGuid?:string,TagUrl?:string,OutrightPurchase?:OutrightPurchase,Motability?:boolean,MotabilityPricingId?:number,FinanceApplicationReference?:string,Specialist?:boolean,GasId?:string,PersonalisedItemOfferIds?:number[],SuggestedVin?:string,NonOptimumReason?:string,MotabilityType?:MotabilityType,EstimatedHandoverDate?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {Source} */
Source;
/** @type {string} */
GssnId;
/** @type {string} */
AdditionalInformation;
/** @type {boolean} */
Cash;
/** @type {boolean} */
Finance;
/** @type {Customer} */
Customer;
/** @type {Vehicle} */
Vehicle;
/** @type {FinanceCriteria} */
FinanceCriteria;
/** @type {?string} */
BackOrderGuid;
/** @type {?string} */
TagUrl;
/** @type {?OutrightPurchase} */
OutrightPurchase;
/** @type {boolean} */
Motability;
/** @type {?number} */
MotabilityPricingId;
/** @type {string} */
FinanceApplicationReference;
/** @type {boolean} */
Specialist;
/** @type {string} */
GasId;
/** @type {?number[]} */
PersonalisedItemOfferIds;
/** @type {?string} */
SuggestedVin;
/** @type {?string} */
NonOptimumReason;
/** @type {MotabilityType} */
MotabilityType;
/** @type {string} */
EstimatedHandoverDate;
}
export class CreateOrderResponse {
/** @param {{Guid?:string,Reference?:string,ResponseStatus?:ResponseStatus,BackOrderReference?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Guid;
/** @type {string} */
Reference;
/** @type {ResponseStatus} */
ResponseStatus;
/** @type {string} */
BackOrderReference;
}
export class CreateOneAdminOrderRequest extends CreateOrderBase {
/** @param {{CustomerLocationId?:number,Source?:Source,GssnId?:string,AdditionalInformation?:string,Cash?:boolean,Finance?:boolean,Customer?:Customer,Vehicle?:Vehicle,FinanceCriteria?:FinanceCriteria,BackOrderGuid?:string,TagUrl?:string,OutrightPurchase?:OutrightPurchase,Motability?:boolean,MotabilityPricingId?:number,FinanceApplicationReference?:string,Specialist?:boolean,GasId?:string,PersonalisedItemOfferIds?:number[],SuggestedVin?:string,NonOptimumReason?:string,MotabilityType?:MotabilityType,EstimatedHandoverDate?:string}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
/** @type {?number} */
CustomerLocationId;
}
JavaScript CreateOneAdminOrderRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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/csv
Content-Type: text/csv
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/csv 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"}