| POST | /v1/c/app/orders |
|---|
import Foundation
import ServiceStack
public class CustomerAppOrderRequest : CustomerAppSessionRequest
{
public var level:String
public var windowId:String
public var recur:String
public var addressId:Int
public var dropAddressId:Int?
public var recipientName:String
public var units:Int
public var handoff:String
public var gateCode:String
public var note:String
public var cardId:Int?
public var quotedTotal:Double?
public var lang:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case level
case windowId
case recur
case addressId
case dropAddressId
case recipientName
case units
case handoff
case gateCode
case note
case cardId
case quotedTotal
case lang
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
level = try container.decodeIfPresent(String.self, forKey: .level)
windowId = try container.decodeIfPresent(String.self, forKey: .windowId)
recur = try container.decodeIfPresent(String.self, forKey: .recur)
addressId = try container.decodeIfPresent(Int.self, forKey: .addressId)
dropAddressId = try container.decodeIfPresent(Int.self, forKey: .dropAddressId)
recipientName = try container.decodeIfPresent(String.self, forKey: .recipientName)
units = try container.decodeIfPresent(Int.self, forKey: .units)
handoff = try container.decodeIfPresent(String.self, forKey: .handoff)
gateCode = try container.decodeIfPresent(String.self, forKey: .gateCode)
note = try container.decodeIfPresent(String.self, forKey: .note)
cardId = try container.decodeIfPresent(Int.self, forKey: .cardId)
quotedTotal = try container.decodeIfPresent(Double.self, forKey: .quotedTotal)
lang = try container.decodeIfPresent(String.self, forKey: .lang)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if level != nil { try container.encode(level, forKey: .level) }
if windowId != nil { try container.encode(windowId, forKey: .windowId) }
if recur != nil { try container.encode(recur, forKey: .recur) }
if addressId != nil { try container.encode(addressId, forKey: .addressId) }
if dropAddressId != nil { try container.encode(dropAddressId, forKey: .dropAddressId) }
if recipientName != nil { try container.encode(recipientName, forKey: .recipientName) }
if units != nil { try container.encode(units, forKey: .units) }
if handoff != nil { try container.encode(handoff, forKey: .handoff) }
if gateCode != nil { try container.encode(gateCode, forKey: .gateCode) }
if note != nil { try container.encode(note, forKey: .note) }
if cardId != nil { try container.encode(cardId, forKey: .cardId) }
if quotedTotal != nil { try container.encode(quotedTotal, forKey: .quotedTotal) }
if lang != nil { try container.encode(lang, forKey: .lang) }
}
}
public class CustomerAppSessionRequest : Codable
{
public var slug:String
public var profile:String
required public init(){}
}
public class CustomerAppResponse : Codable
{
public var boot:CustomerAppBoot
public var customer:CustomerAppMe
public var addresses:[CustomerAppAddress] = []
public var cards:[CustomerAppCard] = []
public var notif:CustomerAppNotif
public var recurring:[CustomerAppRecurrence] = []
public var booked:CourierBookOrderResponse
public var sent:Bool
public var token:String
public var needsName:Bool
public var name:String
public var url:String
public var clientSecret:String
public var publishableKey:String
public var message:String
public var reopenStep:String
public var customers:[CourierCustomerRow] = []
public var run:RunResult
public var responseStatus:ResponseStatus
required public init(){}
}
public class CustomerAppBoot : Codable
{
public var profile:String
public var available:Bool
public var reason:String
public var authMethod:String
public var slug:String
public var page:CourierBookPageView
public var manifestUrl:String
required public init(){}
}
public class CourierBookPageView : Codable
{
public var available:Bool
public var bookingOn:Bool
public var business:CourierTrackBusiness
public var profile:CourierBookProfile
public var profiles:[CourierBookProfileLink] = []
public var cardEnabled:Bool
public var publishableKey:String
public var appUrl:String
public var today:String
public var weekday:Int
public var nowMin:Int
required public init(){}
}
public class CourierTrackBusiness : Codable
{
public var name:String
public var phone:String
required public init(){}
}
public class CourierBookProfile : Codable
{
public var code:String
public var name:String
public var shape:String
public var template:String
public var unitOne:String
public var unitMany:String
public var unitOneEs:String
public var unitManyEs:String
public var facilityNoun:String
public var facilityNounEs:String
public var facilityName:String
public var levels:[CourierBookLevel] = []
public var asap:Bool
public var recurring:Bool
public var payTiming:String
public var finalAfterCount:Bool
public var cancelFee:Double
public var missedFee:Double
public var missedWaitMin:Int
public var serviceArea:[String] = []
public var zips:[String] = []
public var handoffs:HandoffOptions
required public init(){}
}
public class CourierBookLevel : Codable
{
public var code:String
public var name:String
public var ready:String
public var withinMin:Int
public var inBy:String
public var surcharge:Double
public var days:[Int] = []
public var deadlineMin:Int?
required public init(){}
}
public class HandoffOptions : Codable
{
public var hand:Bool
public var porch:Bool
public var desk:Bool
public var sigRequired:Bool
public var idRequired:Bool
public var codeRequired:Bool
required public init(){}
}
public class CourierBookProfileLink : Codable
{
public var code:String
public var name:String
public var shape:String
required public init(){}
}
public class CustomerAppMe : Codable
{
public var contactId:Int
public var firstName:String
public var lastName:String
public var name:String
public var phone:String
public var needsName:Bool
public var billingMode:String
public var accountCode:String
public var addresses:[CustomerAppAddress] = []
public var cards:[CustomerAppCard] = []
public var notif:CustomerAppNotif
public var orders:[CustomerAppOrder] = []
public var recurring:[CustomerAppRecurrence] = []
public var invoices:[CustomerAppInvoice] = []
public var today:String
public var nowMin:Int
required public init(){}
}
public class CustomerAppAddress : Codable
{
public var id:Int
public var label:String
public var street:String
public var unit:String
public var city:String
public var zip:String
public var lat:Double?
public var lng:Double?
public var inArea:Bool
required public init(){}
}
public class CustomerAppCard : Codable
{
public var id:Int
public var label:String
public var brand:String
public var last4:String
public var isDefault:Bool
required public init(){}
}
public class CustomerAppNotif : Codable
{
public var texts:Bool
public var push:Bool
public var promos:Bool
required public init(){}
}
public class CustomerAppOrder : Codable
{
public var id:Int
public var code:String
public var status:String
public var state:String
public var active:Bool
public var levelCode:String
public var levelName:String
public var units:Int
public var unitsFound:Int?
public var address:String
public var unit:String
public var zip:String
public var dropAddress:String
public var recipientName:String
public var handoff:String
public var isAsap:Bool
public var dayIx:Int
public var dateText:String
public var startMin:Int?
public var endMin:Int?
public var driverFirstName:String
public var etaMin:Int?
public var promise:String
public var payMode:String
public var amount:Double
public var charged:Double?
public var tip:Double?
public var cardLast4:String
public var recurrenceId:Int?
public var steps:[CustomerAppStep] = []
required public init(){}
}
public class CustomerAppStep : Codable
{
public var key:String
public var done:Bool
public var time:String
required public init(){}
}
public class CustomerAppRecurrence : Codable
{
public var id:Int
public var weekday:Int
public var startMin:Int
public var endMin:Int
public var cadence:String
public var levelCode:String
public var units:Int
public var handoff:String
public var address:String
public var paused:Bool
public var payMode:String
public var cardLast4:String
public var nextDate:String
public var skippedDate:String
public var aheadDays:Int
required public init(){}
}
public class CustomerAppInvoice : Codable
{
public var uid:String
public var number:String
public var dateText:String
public var total:Double
public var balance:Double
public var paid:Bool
required public init(){}
}
public class CourierBookOrderResponse : Codable
{
public var done:Bool
public var needsAction:Bool
public var clientSecret:String
public var setupIntentId:String
public var code:String
public var trackUrl:String
public var icsUrl:String
public var windowText:String
public var promise:String
public var total:Double
public var payTiming:String
public var cardLast4:String
public var repeats:String
public var linkSentBy:String
public var reopenStep:String
public var responseStatus:ResponseStatus
required public init(){}
}
public class CourierCustomerRow : Codable
{
public var contactId:Int
public var name:String
public var phone:String
public var billingMode:String
public var accountCode:String
public var orders:Int
public var lastOrderAt:Date?
public var unbilled:Int
public var unbilledAmount:Double
public var cards:Int
required public init(){}
}
public class RunResult : Codable
{
public var invoices:Int
public var orders:Int
public var total:Double
public var skipped:[String] = []
required public init(){}
}
Swift CustomerAppOrderRequest 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/c/app/orders HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CustomerAppOrderRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Profile>String</Profile>
<Slug>String</Slug>
<AddressId>0</AddressId>
<CardId>0</CardId>
<DropAddressId>0</DropAddressId>
<GateCode>String</GateCode>
<Handoff>String</Handoff>
<Lang>String</Lang>
<Level>String</Level>
<Note>String</Note>
<QuotedTotal>0</QuotedTotal>
<RecipientName>String</RecipientName>
<Recur>String</Recur>
<Units>0</Units>
<WindowId>String</WindowId>
</CustomerAppOrderRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<CustomerAppResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Addresses>
<CustomerAppAddress>
<City>String</City>
<Id>0</Id>
<InArea>false</InArea>
<Label>String</Label>
<Lat>0</Lat>
<Lng>0</Lng>
<Street>String</Street>
<Unit>String</Unit>
<Zip>String</Zip>
</CustomerAppAddress>
</Addresses>
<Booked>
<CardLast4>String</CardLast4>
<ClientSecret>String</ClientSecret>
<Code>String</Code>
<Done>false</Done>
<IcsUrl>String</IcsUrl>
<LinkSentBy>String</LinkSentBy>
<NeedsAction>false</NeedsAction>
<PayTiming>String</PayTiming>
<Promise>String</Promise>
<ReopenStep>String</ReopenStep>
<Repeats>String</Repeats>
<ResponseStatus xmlns:d3p1="http://schemas.servicestack.net/types">
<d3p1:ErrorCode>String</d3p1:ErrorCode>
<d3p1:Message>String</d3p1:Message>
<d3p1:StackTrace>String</d3p1:StackTrace>
<d3p1:Errors>
<d3p1:ResponseError>
<d3p1:ErrorCode>String</d3p1:ErrorCode>
<d3p1:FieldName>String</d3p1:FieldName>
<d3p1:Message>String</d3p1:Message>
<d3p1:Meta xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d6p1:KeyValueOfstringstring>
<d6p1:Key>String</d6p1:Key>
<d6p1:Value>String</d6p1:Value>
</d6p1:KeyValueOfstringstring>
</d3p1:Meta>
</d3p1:ResponseError>
</d3p1:Errors>
<d3p1:Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:KeyValueOfstringstring>
<d4p1:Key>String</d4p1:Key>
<d4p1:Value>String</d4p1:Value>
</d4p1:KeyValueOfstringstring>
</d3p1:Meta>
</ResponseStatus>
<SetupIntentId>String</SetupIntentId>
<Total>0</Total>
<TrackUrl>String</TrackUrl>
<WindowText>String</WindowText>
</Booked>
<Boot>
<AuthMethod>String</AuthMethod>
<Available>false</Available>
<ManifestUrl>String</ManifestUrl>
<Page>
<AppUrl>String</AppUrl>
<Available>false</Available>
<BookingOn>false</BookingOn>
<Business>
<Name>String</Name>
<Phone>String</Phone>
</Business>
<CardEnabled>false</CardEnabled>
<NowMin>0</NowMin>
<Profile>
<Asap>false</Asap>
<CancelFee>0</CancelFee>
<Code>String</Code>
<FacilityName>String</FacilityName>
<FacilityNoun>String</FacilityNoun>
<FacilityNounEs>String</FacilityNounEs>
<FinalAfterCount>false</FinalAfterCount>
<Handoffs>
<CodeRequired>false</CodeRequired>
<Desk>false</Desk>
<Hand>false</Hand>
<IdRequired>false</IdRequired>
<Porch>false</Porch>
<SigRequired>false</SigRequired>
</Handoffs>
<Levels>
<CourierBookLevel>
<Code>String</Code>
<Days xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:int>0</d7p1:int>
</Days>
<DeadlineMin>0</DeadlineMin>
<InBy>String</InBy>
<Name>String</Name>
<Ready>String</Ready>
<Surcharge>0</Surcharge>
<WithinMin>0</WithinMin>
</CourierBookLevel>
</Levels>
<MissedFee>0</MissedFee>
<MissedWaitMin>0</MissedWaitMin>
<Name>String</Name>
<PayTiming>String</PayTiming>
<Recurring>false</Recurring>
<ServiceArea xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:string>String</d5p1:string>
</ServiceArea>
<Shape>String</Shape>
<Template>String</Template>
<UnitMany>String</UnitMany>
<UnitManyEs>String</UnitManyEs>
<UnitOne>String</UnitOne>
<UnitOneEs>String</UnitOneEs>
<Zips xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:string>String</d5p1:string>
</Zips>
</Profile>
<Profiles>
<CourierBookProfileLink>
<Code>String</Code>
<Name>String</Name>
<Shape>String</Shape>
</CourierBookProfileLink>
</Profiles>
<PublishableKey>String</PublishableKey>
<Today>String</Today>
<Weekday>0</Weekday>
</Page>
<Profile>String</Profile>
<Reason>String</Reason>
<Slug>String</Slug>
</Boot>
<Cards>
<CustomerAppCard>
<Brand>String</Brand>
<Id>0</Id>
<IsDefault>false</IsDefault>
<Label>String</Label>
<Last4>String</Last4>
</CustomerAppCard>
</Cards>
<ClientSecret>String</ClientSecret>
<Customer>
<AccountCode>String</AccountCode>
<Addresses>
<CustomerAppAddress>
<City>String</City>
<Id>0</Id>
<InArea>false</InArea>
<Label>String</Label>
<Lat>0</Lat>
<Lng>0</Lng>
<Street>String</Street>
<Unit>String</Unit>
<Zip>String</Zip>
</CustomerAppAddress>
</Addresses>
<BillingMode>String</BillingMode>
<Cards>
<CustomerAppCard>
<Brand>String</Brand>
<Id>0</Id>
<IsDefault>false</IsDefault>
<Label>String</Label>
<Last4>String</Last4>
</CustomerAppCard>
</Cards>
<ContactId>0</ContactId>
<FirstName>String</FirstName>
<Invoices>
<CustomerAppInvoice>
<Balance>0</Balance>
<DateText>String</DateText>
<Number>String</Number>
<Paid>false</Paid>
<Total>0</Total>
<Uid>00000000-0000-0000-0000-000000000000</Uid>
</CustomerAppInvoice>
</Invoices>
<LastName>String</LastName>
<Name>String</Name>
<NeedsName>false</NeedsName>
<Notif>
<Promos>false</Promos>
<Push>false</Push>
<Texts>false</Texts>
</Notif>
<NowMin>0</NowMin>
<Orders>
<CustomerAppOrder>
<Active>false</Active>
<Address>String</Address>
<Amount>0</Amount>
<CardLast4>String</CardLast4>
<Charged>0</Charged>
<Code>String</Code>
<DateText>String</DateText>
<DayIx>0</DayIx>
<DriverFirstName>String</DriverFirstName>
<DropAddress>String</DropAddress>
<EndMin>0</EndMin>
<EtaMin>0</EtaMin>
<Handoff>String</Handoff>
<Id>0</Id>
<IsAsap>false</IsAsap>
<LevelCode>String</LevelCode>
<LevelName>String</LevelName>
<PayMode>String</PayMode>
<Promise>String</Promise>
<RecipientName>String</RecipientName>
<RecurrenceId>0</RecurrenceId>
<StartMin>0</StartMin>
<State>String</State>
<Status>String</Status>
<Steps>
<CustomerAppStep>
<Done>false</Done>
<Key>String</Key>
<Time>String</Time>
</CustomerAppStep>
</Steps>
<Tip>0</Tip>
<Unit>String</Unit>
<Units>0</Units>
<UnitsFound>0</UnitsFound>
<Zip>String</Zip>
</CustomerAppOrder>
</Orders>
<Phone>String</Phone>
<Recurring>
<CustomerAppRecurrence>
<Address>String</Address>
<AheadDays>0</AheadDays>
<Cadence>String</Cadence>
<CardLast4>String</CardLast4>
<EndMin>0</EndMin>
<Handoff>String</Handoff>
<Id>0</Id>
<LevelCode>String</LevelCode>
<NextDate>String</NextDate>
<Paused>false</Paused>
<PayMode>String</PayMode>
<SkippedDate>String</SkippedDate>
<StartMin>0</StartMin>
<Units>0</Units>
<Weekday>0</Weekday>
</CustomerAppRecurrence>
</Recurring>
<Today>String</Today>
</Customer>
<Customers>
<CourierCustomerRow>
<AccountCode>String</AccountCode>
<BillingMode>String</BillingMode>
<Cards>0</Cards>
<ContactId>0</ContactId>
<LastOrderAt>0001-01-01T00:00:00</LastOrderAt>
<Name>String</Name>
<Orders>0</Orders>
<Phone>String</Phone>
<Unbilled>0</Unbilled>
<UnbilledAmount>0</UnbilledAmount>
</CourierCustomerRow>
</Customers>
<Message>String</Message>
<Name>String</Name>
<NeedsName>false</NeedsName>
<Notif>
<Promos>false</Promos>
<Push>false</Push>
<Texts>false</Texts>
</Notif>
<PublishableKey>String</PublishableKey>
<Recurring>
<CustomerAppRecurrence>
<Address>String</Address>
<AheadDays>0</AheadDays>
<Cadence>String</Cadence>
<CardLast4>String</CardLast4>
<EndMin>0</EndMin>
<Handoff>String</Handoff>
<Id>0</Id>
<LevelCode>String</LevelCode>
<NextDate>String</NextDate>
<Paused>false</Paused>
<PayMode>String</PayMode>
<SkippedDate>String</SkippedDate>
<StartMin>0</StartMin>
<Units>0</Units>
<Weekday>0</Weekday>
</CustomerAppRecurrence>
</Recurring>
<ReopenStep>String</ReopenStep>
<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>
<Run>
<Invoices>0</Invoices>
<Orders>0</Orders>
<Skipped xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</Skipped>
<Total>0</Total>
</Run>
<Sent>false</Sent>
<Token>String</Token>
<Url>String</Url>
</CustomerAppResponse>