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 |
---|
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
public static class CreateOneAdminOrderRequest extends CreateOrderBase implements IGet
{
public Integer CustomerLocationId = null;
public Integer getCustomerLocationId() { return CustomerLocationId; }
public CreateOneAdminOrderRequest setCustomerLocationId(Integer value) { this.CustomerLocationId = value; return this; }
}
public static class CreateOrderBase
{
public Source Source = null;
public String GssnId = null;
public String AdditionalInformation = null;
public Boolean Cash = null;
public Boolean Finance = null;
public Customer Customer = null;
public Vehicle Vehicle = null;
public FinanceCriteria FinanceCriteria = null;
public UUID BackOrderGuid = null;
public String TagUrl = null;
public OutrightPurchase OutrightPurchase = null;
public Boolean Motability = null;
public Integer MotabilityPricingId = null;
public String FinanceApplicationReference = null;
public Boolean Specialist = null;
public String GasId = null;
public ArrayList<Integer> PersonalisedItemOfferIds = null;
public String SuggestedVin = null;
public String NonOptimumReason = null;
public MotabilityType MotabilityType = null;
public String EstimatedHandoverDate = null;
public Source getSource() { return Source; }
public CreateOrderBase setSource(Source value) { this.Source = value; return this; }
public String getGssnId() { return GssnId; }
public CreateOrderBase setGssnId(String value) { this.GssnId = value; return this; }
public String getAdditionalInformation() { return AdditionalInformation; }
public CreateOrderBase setAdditionalInformation(String value) { this.AdditionalInformation = value; return this; }
public Boolean isCash() { return Cash; }
public CreateOrderBase setCash(Boolean value) { this.Cash = value; return this; }
public Boolean isFinance() { return Finance; }
public CreateOrderBase setFinance(Boolean value) { this.Finance = value; return this; }
public Customer getCustomer() { return Customer; }
public CreateOrderBase setCustomer(Customer value) { this.Customer = value; return this; }
public Vehicle getVehicle() { return Vehicle; }
public CreateOrderBase setVehicle(Vehicle value) { this.Vehicle = value; return this; }
public FinanceCriteria getFinanceCriteria() { return FinanceCriteria; }
public CreateOrderBase setFinanceCriteria(FinanceCriteria value) { this.FinanceCriteria = value; return this; }
public UUID getBackOrderGuid() { return BackOrderGuid; }
public CreateOrderBase setBackOrderGuid(UUID value) { this.BackOrderGuid = value; return this; }
public String getTagUrl() { return TagUrl; }
public CreateOrderBase setTagUrl(String value) { this.TagUrl = value; return this; }
public OutrightPurchase getOutrightPurchase() { return OutrightPurchase; }
public CreateOrderBase setOutrightPurchase(OutrightPurchase value) { this.OutrightPurchase = value; return this; }
public Boolean isMotability() { return Motability; }
public CreateOrderBase setMotability(Boolean value) { this.Motability = value; return this; }
public Integer getMotabilityPricingId() { return MotabilityPricingId; }
public CreateOrderBase setMotabilityPricingId(Integer value) { this.MotabilityPricingId = value; return this; }
public String getFinanceApplicationReference() { return FinanceApplicationReference; }
public CreateOrderBase setFinanceApplicationReference(String value) { this.FinanceApplicationReference = value; return this; }
public Boolean isSpecialist() { return Specialist; }
public CreateOrderBase setSpecialist(Boolean value) { this.Specialist = value; return this; }
public String getGasId() { return GasId; }
public CreateOrderBase setGasId(String value) { this.GasId = value; return this; }
public ArrayList<Integer> getPersonalisedItemOfferIds() { return PersonalisedItemOfferIds; }
public CreateOrderBase setPersonalisedItemOfferIds(ArrayList<Integer> value) { this.PersonalisedItemOfferIds = value; return this; }
public String getSuggestedVin() { return SuggestedVin; }
public CreateOrderBase setSuggestedVin(String value) { this.SuggestedVin = value; return this; }
public String getNonOptimumReason() { return NonOptimumReason; }
public CreateOrderBase setNonOptimumReason(String value) { this.NonOptimumReason = value; return this; }
public MotabilityType getMotabilityType() { return MotabilityType; }
public CreateOrderBase setMotabilityType(MotabilityType value) { this.MotabilityType = value; return this; }
public String getEstimatedHandoverDate() { return EstimatedHandoverDate; }
public CreateOrderBase setEstimatedHandoverDate(String value) { this.EstimatedHandoverDate = value; return this; }
}
public static enum Source
{
OnlineShowroom(1),
OneAdmin(2);
private final int value;
Source(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static class Customer extends SalesforceCustomer
{
public UUID ProfileId = null;
public Preferences Preferences = null;
public UUID getProfileId() { return ProfileId; }
public Customer setProfileId(UUID value) { this.ProfileId = value; return this; }
public Preferences getPreferences() { return Preferences; }
public Customer setPreferences(Preferences value) { this.Preferences = value; return this; }
}
public static class SalesforceCustomer implements ICustomer
{
public String CustomerId = null;
public Boolean IsCiam = null;
public String CompanyName = null;
public String Title = null;
public String Firstname = null;
public String Surname = null;
public String EmailAddress = null;
public String Telephone = null;
public Address Address = null;
public CustomerMode Mode = null;
public String getCustomerId() { return CustomerId; }
public SalesforceCustomer setCustomerId(String value) { this.CustomerId = value; return this; }
public Boolean getIsCiam() { return IsCiam; }
public SalesforceCustomer setIsCiam(Boolean value) { this.IsCiam = value; return this; }
public String getCompanyName() { return CompanyName; }
public SalesforceCustomer setCompanyName(String value) { this.CompanyName = value; return this; }
public String getTitle() { return Title; }
public SalesforceCustomer setTitle(String value) { this.Title = value; return this; }
public String getFirstname() { return Firstname; }
public SalesforceCustomer setFirstname(String value) { this.Firstname = value; return this; }
public String getSurname() { return Surname; }
public SalesforceCustomer setSurname(String value) { this.Surname = value; return this; }
public String getEmailAddress() { return EmailAddress; }
public SalesforceCustomer setEmailAddress(String value) { this.EmailAddress = value; return this; }
public String getTelephone() { return Telephone; }
public SalesforceCustomer setTelephone(String value) { this.Telephone = value; return this; }
public Address getAddress() { return Address; }
public SalesforceCustomer setAddress(Address value) { this.Address = value; return this; }
public CustomerMode getMode() { return Mode; }
public SalesforceCustomer setMode(CustomerMode value) { this.Mode = value; return this; }
}
public static class Address
{
public String Property = null;
public String Street = null;
public String Town = null;
public String County = null;
public String Locality = null;
public String Postcode = null;
public String getProperty() { return Property; }
public Address setProperty(String value) { this.Property = value; return this; }
public String getStreet() { return Street; }
public Address setStreet(String value) { this.Street = value; return this; }
public String getTown() { return Town; }
public Address setTown(String value) { this.Town = value; return this; }
public String getCounty() { return County; }
public Address setCounty(String value) { this.County = value; return this; }
public String getLocality() { return Locality; }
public Address setLocality(String value) { this.Locality = value; return this; }
public String getPostcode() { return Postcode; }
public Address setPostcode(String value) { this.Postcode = value; return this; }
}
public static enum CustomerMode
{
Private(1),
Business(2),
Motability(3);
private final int value;
CustomerMode(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static class Preferences
{
public Boolean OptinEmail = null;
public Boolean OptinPost = null;
public Boolean OptinSMS = null;
public Boolean OptinTelephone = null;
public Boolean isOptinEmail() { return OptinEmail; }
public Preferences setOptinEmail(Boolean value) { this.OptinEmail = value; return this; }
public Boolean isOptinPost() { return OptinPost; }
public Preferences setOptinPost(Boolean value) { this.OptinPost = value; return this; }
public Boolean isOptinSMS() { return OptinSMS; }
public Preferences setOptinSMS(Boolean value) { this.OptinSMS = value; return this; }
public Boolean isOptinTelephone() { return OptinTelephone; }
public Preferences setOptinTelephone(Boolean value) { this.OptinTelephone = value; return this; }
}
public static class Vehicle
{
public String Vin = null;
public String getVin() { return Vin; }
public Vehicle setVin(String value) { this.Vin = value; return this; }
}
public static class FinanceCriteria
{
public String Key = null;
public String Name = null;
public String Type = null;
public Boolean IsDefault = null;
public Term Term = null;
public Deposit Deposit = null;
public Mileage Mileage = null;
public AdvanceRentals AdvanceRentals = null;
public Boolean IsPersonalised = null;
public String RegularPayment = null;
public String PartExchange = null;
public String Settlement = null;
public String CustomerType = null;
public VehicleType VehicleType = null;
public String getKey() { return Key; }
public FinanceCriteria setKey(String value) { this.Key = value; return this; }
public String getName() { return Name; }
public FinanceCriteria setName(String value) { this.Name = value; return this; }
public String getType() { return Type; }
public FinanceCriteria setType(String value) { this.Type = value; return this; }
public Boolean getIsDefault() { return IsDefault; }
public FinanceCriteria setIsDefault(Boolean value) { this.IsDefault = value; return this; }
public Term getTerm() { return Term; }
public FinanceCriteria setTerm(Term value) { this.Term = value; return this; }
public Deposit getDeposit() { return Deposit; }
public FinanceCriteria setDeposit(Deposit value) { this.Deposit = value; return this; }
public Mileage getMileage() { return Mileage; }
public FinanceCriteria setMileage(Mileage value) { this.Mileage = value; return this; }
public AdvanceRentals getAdvanceRentals() { return AdvanceRentals; }
public FinanceCriteria setAdvanceRentals(AdvanceRentals value) { this.AdvanceRentals = value; return this; }
public Boolean getIsPersonalised() { return IsPersonalised; }
public FinanceCriteria setIsPersonalised(Boolean value) { this.IsPersonalised = value; return this; }
public String getRegularPayment() { return RegularPayment; }
public FinanceCriteria setRegularPayment(String value) { this.RegularPayment = value; return this; }
public String getPartExchange() { return PartExchange; }
public FinanceCriteria setPartExchange(String value) { this.PartExchange = value; return this; }
public String getSettlement() { return Settlement; }
public FinanceCriteria setSettlement(String value) { this.Settlement = value; return this; }
public String getCustomerType() { return CustomerType; }
public FinanceCriteria setCustomerType(String value) { this.CustomerType = value; return this; }
public VehicleType getVehicleType() { return VehicleType; }
public FinanceCriteria setVehicleType(VehicleType value) { this.VehicleType = value; return this; }
}
public static class Term
{
public ArrayList<Option> Options = new ArrayList<Option>();
public ArrayList<Option> getOptions() { return Options; }
public Term setOptions(ArrayList<Option> value) { this.Options = value; return this; }
}
public static class Option
{
public Boolean IsDefault = null;
public Integer Value = null;
public Boolean getIsDefault() { return IsDefault; }
public Option setIsDefault(Boolean value) { this.IsDefault = value; return this; }
public Integer getValue() { return Value; }
public Option setValue(Integer value) { this.Value = value; return this; }
}
public static class Deposit
{
public String Default = null;
public String getDefault() { return Default; }
public Deposit setDefault(String value) { this.Default = value; return this; }
}
public static class Mileage
{
public ArrayList<Option> Options = new ArrayList<Option>();
public ArrayList<Option> getOptions() { return Options; }
public Mileage setOptions(ArrayList<Option> value) { this.Options = value; return this; }
}
public static class AdvanceRentals
{
public ArrayList<Option> Options = new ArrayList<Option>();
public ArrayList<Option> getOptions() { return Options; }
public AdvanceRentals setOptions(ArrayList<Option> value) { this.Options = value; return this; }
}
public static enum VehicleType
{
Unassigned,
New,
Used;
}
public static class OutrightPurchase
{
public Boolean IsOutrightPurchase = null;
public String Reference = null;
public BigDecimal DiscountRate = null;
public String Bm7NST = null;
public Boolean IsBackOrder = null;
public Boolean IsCOPConverter = null;
public Boolean getIsOutrightPurchase() { return IsOutrightPurchase; }
public OutrightPurchase setIsOutrightPurchase(Boolean value) { this.IsOutrightPurchase = value; return this; }
public String getReference() { return Reference; }
public OutrightPurchase setReference(String value) { this.Reference = value; return this; }
public BigDecimal getDiscountRate() { return DiscountRate; }
public OutrightPurchase setDiscountRate(BigDecimal value) { this.DiscountRate = value; return this; }
public String getBm7NST() { return Bm7NST; }
public OutrightPurchase setBm7NST(String value) { this.Bm7NST = value; return this; }
public Boolean getIsBackOrder() { return IsBackOrder; }
public OutrightPurchase setIsBackOrder(Boolean value) { this.IsBackOrder = value; return this; }
public Boolean getIsCOPConverter() { return IsCOPConverter; }
public OutrightPurchase setIsCOPConverter(Boolean value) { this.IsCOPConverter = value; return this; }
}
public static enum MotabilityType
{
Pip(1),
Wpms(2),
Unassigned(3);
private final int value;
MotabilityType(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static class CreateOrderResponse
{
public String Guid = null;
public String Reference = null;
public ResponseStatus ResponseStatus = null;
public String BackOrderReference = null;
public String getGuid() { return Guid; }
public CreateOrderResponse setGuid(String value) { this.Guid = value; return this; }
public String getReference() { return Reference; }
public CreateOrderResponse setReference(String value) { this.Reference = value; return this; }
public ResponseStatus getResponseStatus() { return ResponseStatus; }
public CreateOrderResponse setResponseStatus(ResponseStatus value) { this.ResponseStatus = value; return this; }
public String getBackOrderReference() { return BackOrderReference; }
public CreateOrderResponse setBackOrderReference(String value) { this.BackOrderReference = value; return this; }
}
}
Java CreateOneAdminOrderRequest 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/order HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateOneAdminOrderRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.ServiceModel.Orders">
<AdditionalInformation xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</AdditionalInformation>
<BackOrderGuid xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">00000000-0000-0000-0000-000000000000</BackOrderGuid>
<Cash xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">false</Cash>
<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.Business.Poco">
<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>
<EstimatedHandoverDate xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</EstimatedHandoverDate>
<Finance xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">false</Finance>
<FinanceApplicationReference xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</FinanceApplicationReference>
<FinanceCriteria xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">
<d2p1:AdvanceRentals>
<d2p1:Options>
<d2p1:Option>
<d2p1:IsDefault>false</d2p1:IsDefault>
<d2p1:Value>0</d2p1:Value>
</d2p1:Option>
</d2p1:Options>
</d2p1:AdvanceRentals>
<d2p1:CustomerType>String</d2p1:CustomerType>
<d2p1:Deposit>
<d2p1:Default>String</d2p1:Default>
</d2p1:Deposit>
<d2p1:IsDefault>false</d2p1:IsDefault>
<d2p1:IsPersonalised>false</d2p1:IsPersonalised>
<d2p1:Key>String</d2p1:Key>
<d2p1:Mileage>
<d2p1:Options>
<d2p1:Option>
<d2p1:IsDefault>false</d2p1:IsDefault>
<d2p1:Value>0</d2p1:Value>
</d2p1:Option>
</d2p1:Options>
</d2p1:Mileage>
<d2p1:Name>String</d2p1:Name>
<d2p1:PartExchange>String</d2p1:PartExchange>
<d2p1:RegularPayment>String</d2p1:RegularPayment>
<d2p1:Settlement>String</d2p1:Settlement>
<d2p1:Term>
<d2p1:Options>
<d2p1:Option>
<d2p1:IsDefault>false</d2p1:IsDefault>
<d2p1:Value>0</d2p1:Value>
</d2p1:Option>
</d2p1:Options>
</d2p1:Term>
<d2p1:Type>String</d2p1:Type>
<d2p1:VehicleType>UNASSIGNED</d2p1:VehicleType>
</FinanceCriteria>
<GasId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</GasId>
<GssnId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</GssnId>
<Motability xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">false</Motability>
<MotabilityPricingId xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">0</MotabilityPricingId>
<MotabilityType xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">PIP</MotabilityType>
<NonOptimumReason xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</NonOptimumReason>
<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.Business.Poco">
<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>
<PersonalisedItemOfferIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">
<d2p1:int>0</d2p1:int>
</PersonalisedItemOfferIds>
<Source xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">OnlineShowroom</Source>
<Specialist xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">false</Specialist>
<SuggestedVin xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</SuggestedVin>
<TagUrl xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">String</TagUrl>
<Vehicle xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Business.Poco">
<d2p1:Vin>String</d2p1:Vin>
</Vehicle>
<CustomerLocationId>0</CustomerLocationId>
</CreateOneAdminOrderRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreateOrderResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Responses"> <BackOrderReference>String</BackOrderReference> <Guid>String</Guid> <Reference>String</Reference> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> </CreateOrderResponse>