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 |
---|
Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports Mercedes.Agency.Orchestration.API.ServiceModel.Orders
Imports Mercedes.Agency.Orchestration.API.Business.Poco
Imports Mercedes.Agency.API.Shared.Enums
Imports Mercedes.Agency.API.Shared.POCO
Imports Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Responses
Namespace Global
Namespace Mercedes.Agency.API.Shared.POCO
Public Partial Class Address
Public Overridable Property [Property] As String
Public Overridable Property Street As String
Public Overridable Property Town As String
Public Overridable Property County As String
Public Overridable Property Locality As String
Public Overridable Property Postcode As String
End Class
Public Partial Class AdvanceRentals
Public Overridable Property Options As List(Of Option) = New List(Of Option)
End Class
Public Partial Class Customer
Inherits SalesforceCustomer
Public Overridable Property ProfileId As Guid?
Public Overridable Property Preferences As Preferences
End Class
Public Partial Class Deposit
Public Overridable Property [Default] As String
End Class
Public Partial Class FinanceCriteria
Public Overridable Property Key As String
Public Overridable Property Name As String
Public Overridable Property Type As String
Public Overridable Property IsDefault As Boolean
Public Overridable Property Term As Term
Public Overridable Property Deposit As Deposit
Public Overridable Property Mileage As Mileage
Public Overridable Property AdvanceRentals As AdvanceRentals
Public Overridable Property IsPersonalised As Boolean
Public Overridable Property RegularPayment As String
Public Overridable Property PartExchange As String
Public Overridable Property Settlement As String
Public Overridable Property CustomerType As String
Public Overridable Property VehicleType As VehicleType
End Class
Public Partial Class Mileage
Public Overridable Property Options As List(Of Option) = New List(Of Option)
End Class
Public Partial Class Option
Public Overridable Property IsDefault As Boolean
Public Overridable Property Value As Integer
End Class
Public Partial Class OutrightPurchase
Public Overridable Property IsOutrightPurchase As Boolean
Public Overridable Property Reference As String
Public Overridable Property DiscountRate As Decimal
Public Overridable Property Bm7NST As String
Public Overridable Property IsBackOrder As Boolean
Public Overridable Property IsCOPConverter As Boolean
End Class
Public Partial Class Preferences
Public Overridable Property OptinEmail As Boolean
Public Overridable Property OptinPost As Boolean
Public Overridable Property OptinSMS As Boolean
Public Overridable Property OptinTelephone As Boolean
End Class
Public Partial Class SalesforceCustomer
Implements ICustomer
Public Overridable Property CustomerId As String Implements ICustomer.CustomerId
Public Overridable Property IsCiam As Boolean Implements ICustomer.IsCiam
Public Overridable Property CompanyName As String Implements ICustomer.CompanyName
Public Overridable Property Title As String Implements ICustomer.Title
Public Overridable Property Firstname As String Implements ICustomer.Firstname
Public Overridable Property Surname As String Implements ICustomer.Surname
Public Overridable Property EmailAddress As String Implements ICustomer.EmailAddress
Public Overridable Property Telephone As String Implements ICustomer.Telephone
Public Overridable Property Address As Address Implements ICustomer.Address
Public Overridable Property Mode As CustomerMode Implements ICustomer.Mode
End Class
Public Partial Class Term
Public Overridable Property Options As List(Of Option) = New List(Of Option)
End Class
Public Partial Class Vehicle
Public Overridable Property Vin As String
End Class
End Namespace
Namespace Mercedes.Agency.Orchestration.API.Business.Poco
Public Partial Class CreateOrderBase
Public Overridable Property Source As Source
Public Overridable Property GssnId As String
Public Overridable Property AdditionalInformation As String
Public Overridable Property Cash As Boolean
Public Overridable Property Finance As Boolean
Public Overridable Property Customer As Customer
Public Overridable Property Vehicle As Vehicle
Public Overridable Property FinanceCriteria As FinanceCriteria
Public Overridable Property BackOrderGuid As Guid?
Public Overridable Property TagUrl As String
Public Overridable Property OutrightPurchase As OutrightPurchase
Public Overridable Property Motability As Boolean
Public Overridable Property MotabilityPricingId As Integer?
Public Overridable Property FinanceApplicationReference As String
Public Overridable Property Specialist As Boolean
Public Overridable Property GasId As String
Public Overridable Property PersonalisedItemOfferIds As Integer()
Public Overridable Property SuggestedVin As String
Public Overridable Property NonOptimumReason As String
Public Overridable Property MotabilityType As MotabilityType
Public Overridable Property EstimatedHandoverDate As String
End Class
End Namespace
Namespace Mercedes.Agency.Orchestration.API.Clients.AgencyApi.Responses
Public Partial Class CreateOrderResponse
Public Overridable Property Guid As String
Public Overridable Property Reference As String
Public Overridable Property ResponseStatus As ResponseStatus
Public Overridable Property BackOrderReference As String
End Class
End Namespace
Namespace Mercedes.Agency.Orchestration.API.ServiceModel.Orders
Public Partial Class CreateOneAdminOrderRequest
Inherits CreateOrderBase
Implements IGet
Public Overridable Property CustomerLocationId As Integer?
End Class
End Namespace
End Namespace
VB.NET 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"}