Mercedes.Agency.Orchestration.API

<back to all web services

CreateOrderRequest

Order
Requires Authentication
The following routes are available for this service:
POST/v1/orderCreates an order for a selected vehicle via the Agency APIThis endpoint is called from Online Showroom 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 'package:servicestack/servicestack.dart';

enum Source
{
    OnlineShowroom,
    OneAdmin,
}

class Address implements IConvertible
{
    String? Property;
    String? Street;
    String? Town;
    String? County;
    String? Locality;
    String? Postcode;

    Address({this.Property,this.Street,this.Town,this.County,this.Locality,this.Postcode});
    Address.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Property = json['Property'];
        Street = json['Street'];
        Town = json['Town'];
        County = json['County'];
        Locality = json['Locality'];
        Postcode = json['Postcode'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Property': Property,
        'Street': Street,
        'Town': Town,
        'County': County,
        'Locality': Locality,
        'Postcode': Postcode
    };

    getTypeName() => "Address";
    TypeContext? context = _ctx;
}

enum CustomerMode
{
    Private,
    Business,
    Motability,
}

class SalesforceCustomer implements ICustomer, IConvertible
{
    String? CustomerId;
    bool? IsCiam;
    String? CompanyName;
    String? Title;
    String? Firstname;
    String? Surname;
    String? EmailAddress;
    String? Telephone;
    Address? Address;
    CustomerMode? Mode;

    SalesforceCustomer({this.CustomerId,this.IsCiam,this.CompanyName,this.Title,this.Firstname,this.Surname,this.EmailAddress,this.Telephone,this.Address,this.Mode});
    SalesforceCustomer.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CustomerId = json['CustomerId'];
        IsCiam = json['IsCiam'];
        CompanyName = json['CompanyName'];
        Title = json['Title'];
        Firstname = json['Firstname'];
        Surname = json['Surname'];
        EmailAddress = json['EmailAddress'];
        Telephone = json['Telephone'];
        Address = JsonConverters.fromJson(json['Address'],'Address',context!);
        Mode = JsonConverters.fromJson(json['Mode'],'CustomerMode',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CustomerId': CustomerId,
        'IsCiam': IsCiam,
        'CompanyName': CompanyName,
        'Title': Title,
        'Firstname': Firstname,
        'Surname': Surname,
        'EmailAddress': EmailAddress,
        'Telephone': Telephone,
        'Address': JsonConverters.toJson(Address,'Address',context!),
        'Mode': JsonConverters.toJson(Mode,'CustomerMode',context!)
    };

    getTypeName() => "SalesforceCustomer";
    TypeContext? context = _ctx;
}

class Preferences implements IConvertible
{
    bool? OptinEmail;
    bool? OptinPost;
    bool? OptinSMS;
    bool? OptinTelephone;

    Preferences({this.OptinEmail,this.OptinPost,this.OptinSMS,this.OptinTelephone});
    Preferences.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        OptinEmail = json['OptinEmail'];
        OptinPost = json['OptinPost'];
        OptinSMS = json['OptinSMS'];
        OptinTelephone = json['OptinTelephone'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'OptinEmail': OptinEmail,
        'OptinPost': OptinPost,
        'OptinSMS': OptinSMS,
        'OptinTelephone': OptinTelephone
    };

    getTypeName() => "Preferences";
    TypeContext? context = _ctx;
}

class Customer extends SalesforceCustomer implements IConvertible
{
    String? ProfileId;
    Preferences? Preferences;

    Customer({this.ProfileId,this.Preferences});
    Customer.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        ProfileId = json['ProfileId'];
        Preferences = JsonConverters.fromJson(json['Preferences'],'Preferences',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'ProfileId': ProfileId,
        'Preferences': JsonConverters.toJson(Preferences,'Preferences',context!)
    });

    getTypeName() => "Customer";
    TypeContext? context = _ctx;
}

class Vehicle implements IConvertible
{
    String? Vin;

    Vehicle({this.Vin});
    Vehicle.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Vin = json['Vin'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Vin': Vin
    };

    getTypeName() => "Vehicle";
    TypeContext? context = _ctx;
}

class Option implements IConvertible
{
    bool? IsDefault;
    int? Value;

    Option({this.IsDefault,this.Value});
    Option.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        IsDefault = json['IsDefault'];
        Value = json['Value'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'IsDefault': IsDefault,
        'Value': Value
    };

    getTypeName() => "Option";
    TypeContext? context = _ctx;
}

class Term implements IConvertible
{
    List<Option>? Options = [];

    Term({this.Options});
    Term.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Options = JsonConverters.fromJson(json['Options'],'List<Option>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Options': JsonConverters.toJson(Options,'List<Option>',context!)
    };

    getTypeName() => "Term";
    TypeContext? context = _ctx;
}

class Deposit implements IConvertible
{
    String? Default;

    Deposit({this.Default});
    Deposit.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Default = json['Default'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Default': Default
    };

    getTypeName() => "Deposit";
    TypeContext? context = _ctx;
}

class Mileage implements IConvertible
{
    List<Option>? Options = [];

    Mileage({this.Options});
    Mileage.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Options = JsonConverters.fromJson(json['Options'],'List<Option>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Options': JsonConverters.toJson(Options,'List<Option>',context!)
    };

    getTypeName() => "Mileage";
    TypeContext? context = _ctx;
}

class AdvanceRentals implements IConvertible
{
    List<Option>? Options = [];

    AdvanceRentals({this.Options});
    AdvanceRentals.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Options = JsonConverters.fromJson(json['Options'],'List<Option>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Options': JsonConverters.toJson(Options,'List<Option>',context!)
    };

    getTypeName() => "AdvanceRentals";
    TypeContext? context = _ctx;
}

enum VehicleType
{
    UNASSIGNED,
    NEW,
    USED,
}

class FinanceCriteria implements IConvertible
{
    String? Key;
    String? Name;
    String? Type;
    bool? IsDefault;
    Term? Term;
    Deposit? Deposit;
    Mileage? Mileage;
    AdvanceRentals? AdvanceRentals;
    bool? IsPersonalised;
    String? RegularPayment;
    String? PartExchange;
    String? Settlement;
    String? CustomerType;
    VehicleType? VehicleType;

    FinanceCriteria({this.Key,this.Name,this.Type,this.IsDefault,this.Term,this.Deposit,this.Mileage,this.AdvanceRentals,this.IsPersonalised,this.RegularPayment,this.PartExchange,this.Settlement,this.CustomerType,this.VehicleType});
    FinanceCriteria.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Key = json['Key'];
        Name = json['Name'];
        Type = json['Type'];
        IsDefault = json['IsDefault'];
        Term = JsonConverters.fromJson(json['Term'],'Term',context!);
        Deposit = JsonConverters.fromJson(json['Deposit'],'Deposit',context!);
        Mileage = JsonConverters.fromJson(json['Mileage'],'Mileage',context!);
        AdvanceRentals = JsonConverters.fromJson(json['AdvanceRentals'],'AdvanceRentals',context!);
        IsPersonalised = json['IsPersonalised'];
        RegularPayment = json['RegularPayment'];
        PartExchange = json['PartExchange'];
        Settlement = json['Settlement'];
        CustomerType = json['CustomerType'];
        VehicleType = JsonConverters.fromJson(json['VehicleType'],'VehicleType',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Key': Key,
        'Name': Name,
        'Type': Type,
        'IsDefault': IsDefault,
        'Term': JsonConverters.toJson(Term,'Term',context!),
        'Deposit': JsonConverters.toJson(Deposit,'Deposit',context!),
        'Mileage': JsonConverters.toJson(Mileage,'Mileage',context!),
        'AdvanceRentals': JsonConverters.toJson(AdvanceRentals,'AdvanceRentals',context!),
        'IsPersonalised': IsPersonalised,
        'RegularPayment': RegularPayment,
        'PartExchange': PartExchange,
        'Settlement': Settlement,
        'CustomerType': CustomerType,
        'VehicleType': JsonConverters.toJson(VehicleType,'VehicleType',context!)
    };

    getTypeName() => "FinanceCriteria";
    TypeContext? context = _ctx;
}

class OutrightPurchase implements IConvertible
{
    bool? IsOutrightPurchase;
    String? Reference;
    double? DiscountRate;
    String? Bm7NST;
    bool? IsBackOrder;
    bool? IsCOPConverter;

    OutrightPurchase({this.IsOutrightPurchase,this.Reference,this.DiscountRate,this.Bm7NST,this.IsBackOrder,this.IsCOPConverter});
    OutrightPurchase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        IsOutrightPurchase = json['IsOutrightPurchase'];
        Reference = json['Reference'];
        DiscountRate = JsonConverters.toDouble(json['DiscountRate']);
        Bm7NST = json['Bm7NST'];
        IsBackOrder = json['IsBackOrder'];
        IsCOPConverter = json['IsCOPConverter'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'IsOutrightPurchase': IsOutrightPurchase,
        'Reference': Reference,
        'DiscountRate': DiscountRate,
        'Bm7NST': Bm7NST,
        'IsBackOrder': IsBackOrder,
        'IsCOPConverter': IsCOPConverter
    };

    getTypeName() => "OutrightPurchase";
    TypeContext? context = _ctx;
}

enum MotabilityType
{
    PIP,
    WPMS,
    UNASSIGNED,
}

class CreateOrderBase implements IConvertible
{
    Source? Source;
    String? GssnId;
    String? AdditionalInformation;
    bool? Cash;
    bool? Finance;
    Customer? Customer;
    Vehicle? Vehicle;
    FinanceCriteria? FinanceCriteria;
    String? BackOrderGuid;
    String? TagUrl;
    OutrightPurchase? OutrightPurchase;
    bool? Motability;
    int? MotabilityPricingId;
    String? FinanceApplicationReference;
    bool? Specialist;
    String? GasId;
    List<int>? PersonalisedItemOfferIds;
    String? SuggestedVin;
    String? NonOptimumReason;
    MotabilityType? MotabilityType;
    String? EstimatedHandoverDate;

    CreateOrderBase({this.Source,this.GssnId,this.AdditionalInformation,this.Cash,this.Finance,this.Customer,this.Vehicle,this.FinanceCriteria,this.BackOrderGuid,this.TagUrl,this.OutrightPurchase,this.Motability,this.MotabilityPricingId,this.FinanceApplicationReference,this.Specialist,this.GasId,this.PersonalisedItemOfferIds,this.SuggestedVin,this.NonOptimumReason,this.MotabilityType,this.EstimatedHandoverDate});
    CreateOrderBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Source = JsonConverters.fromJson(json['Source'],'Source',context!);
        GssnId = json['GssnId'];
        AdditionalInformation = json['AdditionalInformation'];
        Cash = json['Cash'];
        Finance = json['Finance'];
        Customer = JsonConverters.fromJson(json['Customer'],'Customer',context!);
        Vehicle = JsonConverters.fromJson(json['Vehicle'],'Vehicle',context!);
        FinanceCriteria = JsonConverters.fromJson(json['FinanceCriteria'],'FinanceCriteria',context!);
        BackOrderGuid = json['BackOrderGuid'];
        TagUrl = json['TagUrl'];
        OutrightPurchase = JsonConverters.fromJson(json['OutrightPurchase'],'OutrightPurchase',context!);
        Motability = json['Motability'];
        MotabilityPricingId = json['MotabilityPricingId'];
        FinanceApplicationReference = json['FinanceApplicationReference'];
        Specialist = json['Specialist'];
        GasId = json['GasId'];
        PersonalisedItemOfferIds = JsonConverters.fromJson(json['PersonalisedItemOfferIds'],'List<int>',context!);
        SuggestedVin = json['SuggestedVin'];
        NonOptimumReason = json['NonOptimumReason'];
        MotabilityType = JsonConverters.fromJson(json['MotabilityType'],'MotabilityType',context!);
        EstimatedHandoverDate = json['EstimatedHandoverDate'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Source': JsonConverters.toJson(Source,'Source',context!),
        'GssnId': GssnId,
        'AdditionalInformation': AdditionalInformation,
        'Cash': Cash,
        'Finance': Finance,
        'Customer': JsonConverters.toJson(Customer,'Customer',context!),
        'Vehicle': JsonConverters.toJson(Vehicle,'Vehicle',context!),
        'FinanceCriteria': JsonConverters.toJson(FinanceCriteria,'FinanceCriteria',context!),
        'BackOrderGuid': BackOrderGuid,
        'TagUrl': TagUrl,
        'OutrightPurchase': JsonConverters.toJson(OutrightPurchase,'OutrightPurchase',context!),
        'Motability': Motability,
        'MotabilityPricingId': MotabilityPricingId,
        'FinanceApplicationReference': FinanceApplicationReference,
        'Specialist': Specialist,
        'GasId': GasId,
        'PersonalisedItemOfferIds': JsonConverters.toJson(PersonalisedItemOfferIds,'List<int>',context!),
        'SuggestedVin': SuggestedVin,
        'NonOptimumReason': NonOptimumReason,
        'MotabilityType': JsonConverters.toJson(MotabilityType,'MotabilityType',context!),
        'EstimatedHandoverDate': EstimatedHandoverDate
    };

    getTypeName() => "CreateOrderBase";
    TypeContext? context = _ctx;
}

class CreateOrderResponse implements IConvertible
{
    String? Guid;
    String? Reference;
    ResponseStatus? ResponseStatus;
    String? BackOrderReference;

    CreateOrderResponse({this.Guid,this.Reference,this.ResponseStatus,this.BackOrderReference});
    CreateOrderResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Guid = json['Guid'];
        Reference = json['Reference'];
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        BackOrderReference = json['BackOrderReference'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Guid': Guid,
        'Reference': Reference,
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
        'BackOrderReference': BackOrderReference
    };

    getTypeName() => "CreateOrderResponse";
    TypeContext? context = _ctx;
}

class CreateOrderRequest extends CreateOrderBase implements IGet, IConvertible
{
    CreateOrderRequest();
    CreateOrderRequest.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "CreateOrderRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'prod_api_agency_orch_mb_dhc.rapp_customers.co.uk', types: <String, TypeInfo> {
    'Source': TypeInfo(TypeOf.Enum, enumValues:Source.values),
    'Address': TypeInfo(TypeOf.Class, create:() => Address()),
    'CustomerMode': TypeInfo(TypeOf.Enum, enumValues:CustomerMode.values),
    'SalesforceCustomer': TypeInfo(TypeOf.Class, create:() => SalesforceCustomer()),
    'Preferences': TypeInfo(TypeOf.Class, create:() => Preferences()),
    'Customer': TypeInfo(TypeOf.Class, create:() => Customer()),
    'Vehicle': TypeInfo(TypeOf.Class, create:() => Vehicle()),
    'Option': TypeInfo(TypeOf.Class, create:() => Option()),
    'Term': TypeInfo(TypeOf.Class, create:() => Term()),
    'List<Option>': TypeInfo(TypeOf.Class, create:() => <Option>[]),
    'Deposit': TypeInfo(TypeOf.Class, create:() => Deposit()),
    'Mileage': TypeInfo(TypeOf.Class, create:() => Mileage()),
    'AdvanceRentals': TypeInfo(TypeOf.Class, create:() => AdvanceRentals()),
    'VehicleType': TypeInfo(TypeOf.Enum, enumValues:VehicleType.values),
    'FinanceCriteria': TypeInfo(TypeOf.Class, create:() => FinanceCriteria()),
    'OutrightPurchase': TypeInfo(TypeOf.Class, create:() => OutrightPurchase()),
    'MotabilityType': TypeInfo(TypeOf.Enum, enumValues:MotabilityType.values),
    'CreateOrderBase': TypeInfo(TypeOf.Class, create:() => CreateOrderBase()),
    'CreateOrderResponse': TypeInfo(TypeOf.Class, create:() => CreateOrderResponse()),
    'CreateOrderRequest': TypeInfo(TypeOf.Class, create:() => CreateOrderRequest()),
});

Dart CreateOrderRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/order HTTP/1.1 
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	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/jsv
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
}