POST | /v1/copinflightpricing | Corporate Outright Pricing Inflight Pricing for supplied Order Guids |
---|
import Foundation
import ServiceStack
// @ApiResponse(Description="In Flight pricing generated", StatusCode=200)
public class CopInflightPricingRequest : CopInflightPricingOrderRequest, IPost
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public class CopInflightPricingOrderRequest : InflightPricingOrderRequest
{
public var noCustomerContract:[String] = []
public var noVehicleDiscount:[String] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case noCustomerContract
case noVehicleDiscount
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
noCustomerContract = try container.decodeIfPresent([String].self, forKey: .noCustomerContract) ?? []
noVehicleDiscount = try container.decodeIfPresent([String].self, forKey: .noVehicleDiscount) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if noCustomerContract.count > 0 { try container.encode(noCustomerContract, forKey: .noCustomerContract) }
if noVehicleDiscount.count > 0 { try container.encode(noVehicleDiscount, forKey: .noVehicleDiscount) }
}
}
public class InflightPricingOrderRequest : Codable
{
public var invalidFormatGuids:[String] = []
public var orderNotFoundGuids:[String] = []
public var inflightPricingOrders:[InflightPricingOrder] = []
public var isMotability:Bool
required public init(){}
}
public class InflightPricingOrder : Codable
{
public var guid:String
public var vin:String
public var advanceRentalPaymentType:Int
public var offer:[OrderOffer] = []
public var outrightPurchase:OutrightPurchase
public var motabilityAdvancePayment:MotabilityAdvancePayment
required public init(){}
}
public class OrderOffer : Codable
{
public var id:Int
public var offerTypeId:Int
public var offerTypeDescription:String
public var offerId:String
public var offerDescription:String
public var net:Double
public var vat:Double
public var gross:Double
public var governmentGrant:Bool
public var promoCode:String
public var expiry:String
public var affectsPrice:Bool
public var product:Int?
public var parentId:String
public var creationDate:Date
public var productTypeDescription:String
public var productTypeNegativeDescription:String
public var certificateRequired:Bool?
required public init(){}
}
public class OutrightPurchase : Codable
{
public var isOutrightPurchase:Bool
public var reference:String
public var discountRate:Double
public var bm7NST:String
public var isBackOrder:Bool
public var isCOPConverter:Bool
required public init(){}
}
public class MotabilityAdvancePayment : Codable
{
public var advancePaymentRentalType:String
public var advancePaymentValueGross:Double
public var advancePaymentValueVAT:Double
public var advancePaymentValueNet:Double
required public init(){}
}
public class InflightPricingResponse : Codable
{
public var vehiclesInflightPrices:[VehicleInflightPrice] = []
required public init(){}
}
public class VehicleInflightPrice : Codable
{
public var guid:String
public var status:String
public var success:Bool
public var prices:[SalesforcePrice] = []
public var totalOTRFees:SalesforceTotalPrice
public var totalOTRPrice:SalesforceTotalPrice
public var totalActualPrice:SalesforceTotalPrice
public var offers:SalesforceOffers
public var outrightPurchase:SalesforceOutrightPurchase
public var motability:MotabilityAdvancePayment
required public init(){}
}
public class SalesforcePrice : Codable
{
public var id:String
public var Description:String
public var net:Double
public var vat:Double
public var gross:Double
public var product:String
required public init(){}
}
public class SalesforceTotalPrice : Codable
{
public var net:Double
public var vat:Double
public var gross:Double
required public init(){}
}
public class SalesforceOffers : Codable
{
public var personalised:[SalesforceOffer] = []
public var nonDiscretionary:[SalesforceOffer] = []
public var nonCampaign:[SalesforceOffer] = []
public var outrightPurchaseDiscount:[SalesforceOffer] = []
public var motabilityDiscount:[SalesforceOffer] = []
public var integratedProducts:[SalesforceOffer] = []
required public init(){}
}
public class SalesforceOffer : Codable
{
public var id:String
public var Description:String
public var net:Double
public var vat:Double
public var gross:Double
public var expiry:String
public var product:String
public var requiresCertification:Bool?
required public init(){}
}
public class SalesforceOutrightPurchase : Codable
{
public var isOutrightPurchase:Bool
public var reference:String
public var discountPercentage:Double
public var modelId:String
required public init(){}
}
Swift CopInflightPricingRequest 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/copinflightpricing HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CopInflightPricingRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.ServiceModel.InflightPricing">
<InflightPricingOrders xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO">
<InflightPricingOrder>
<AdvanceRentalPaymentType>0</AdvanceRentalPaymentType>
<Guid>00000000-0000-0000-0000-000000000000</Guid>
<MotabilityAdvancePayment>
<AdvancePaymentRentalType>String</AdvancePaymentRentalType>
<AdvancePaymentValueGross>0</AdvancePaymentValueGross>
<AdvancePaymentValueNet>0</AdvancePaymentValueNet>
<AdvancePaymentValueVAT>0</AdvancePaymentValueVAT>
</MotabilityAdvancePayment>
<Offer>
<OrderOffer>
<AffectsPrice>false</AffectsPrice>
<CertificateRequired>false</CertificateRequired>
<CreationDate>0001-01-01T00:00:00</CreationDate>
<Expiry>String</Expiry>
<GovernmentGrant>false</GovernmentGrant>
<Gross>0</Gross>
<Id>0</Id>
<Net>0</Net>
<OfferDescription>String</OfferDescription>
<OfferId>String</OfferId>
<OfferTypeDescription>String</OfferTypeDescription>
<OfferTypeId>0</OfferTypeId>
<ParentId>String</ParentId>
<Product>0</Product>
<ProductTypeDescription>String</ProductTypeDescription>
<ProductTypeNegativeDescription>String</ProductTypeNegativeDescription>
<PromoCode>String</PromoCode>
<VAT>0</VAT>
</OrderOffer>
</Offer>
<OutrightPurchase>
<Bm7NST>String</Bm7NST>
<DiscountRate>0</DiscountRate>
<IsBackOrder>false</IsBackOrder>
<IsCOPConverter>false</IsCOPConverter>
<IsOutrightPurchase>false</IsOutrightPurchase>
<Reference>String</Reference>
</OutrightPurchase>
<Vin>String</Vin>
</InflightPricingOrder>
</InflightPricingOrders>
<InvalidFormatGuids xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO">
<d2p1:string>String</d2p1:string>
</InvalidFormatGuids>
<IsMotability xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO">false</IsMotability>
<OrderNotFoundGuids xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO">
<d2p1:guid>00000000-0000-0000-0000-000000000000</d2p1:guid>
</OrderNotFoundGuids>
<NoCustomerContract xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO">
<d2p1:guid>00000000-0000-0000-0000-000000000000</d2p1:guid>
</NoCustomerContract>
<NoVehicleDiscount xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO">
<d2p1:guid>00000000-0000-0000-0000-000000000000</d2p1:guid>
</NoVehicleDiscount>
</CopInflightPricingRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <InflightPricingResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO"> <VehiclesInflightPrices> <VehicleInflightPrice> <Guid>String</Guid> <Motability> <AdvancePaymentRentalType>String</AdvancePaymentRentalType> <AdvancePaymentValueGross>0</AdvancePaymentValueGross> <AdvancePaymentValueNet>0</AdvancePaymentValueNet> <AdvancePaymentValueVAT>0</AdvancePaymentValueVAT> </Motability> <Offers> <IntegratedProducts> <SalesforceOffer> <Description>String</Description> <Expiry>String</Expiry> <Gross>0</Gross> <Id>String</Id> <Net>0</Net> <Product>String</Product> <RequiresCertification>false</RequiresCertification> <VAT>0</VAT> </SalesforceOffer> </IntegratedProducts> <MotabilityDiscount> <SalesforceOffer> <Description>String</Description> <Expiry>String</Expiry> <Gross>0</Gross> <Id>String</Id> <Net>0</Net> <Product>String</Product> <RequiresCertification>false</RequiresCertification> <VAT>0</VAT> </SalesforceOffer> </MotabilityDiscount> <NonCampaign> <SalesforceOffer> <Description>String</Description> <Expiry>String</Expiry> <Gross>0</Gross> <Id>String</Id> <Net>0</Net> <Product>String</Product> <RequiresCertification>false</RequiresCertification> <VAT>0</VAT> </SalesforceOffer> </NonCampaign> <NonDiscretionary> <SalesforceOffer> <Description>String</Description> <Expiry>String</Expiry> <Gross>0</Gross> <Id>String</Id> <Net>0</Net> <Product>String</Product> <RequiresCertification>false</RequiresCertification> <VAT>0</VAT> </SalesforceOffer> </NonDiscretionary> <OutrightPurchaseDiscount> <SalesforceOffer> <Description>String</Description> <Expiry>String</Expiry> <Gross>0</Gross> <Id>String</Id> <Net>0</Net> <Product>String</Product> <RequiresCertification>false</RequiresCertification> <VAT>0</VAT> </SalesforceOffer> </OutrightPurchaseDiscount> <Personalised> <SalesforceOffer> <Description>String</Description> <Expiry>String</Expiry> <Gross>0</Gross> <Id>String</Id> <Net>0</Net> <Product>String</Product> <RequiresCertification>false</RequiresCertification> <VAT>0</VAT> </SalesforceOffer> </Personalised> </Offers> <OutrightPurchase> <DiscountPercentage>0</DiscountPercentage> <IsOutrightPurchase>false</IsOutrightPurchase> <ModelId>String</ModelId> <Reference>String</Reference> </OutrightPurchase> <Prices> <SalesforcePrice> <Description>String</Description> <Gross>0</Gross> <Id>String</Id> <Net>0</Net> <Product>String</Product> <VAT>0</VAT> </SalesforcePrice> </Prices> <Status>String</Status> <Success>false</Success> <TotalActualPrice> <Gross>0</Gross> <Net>0</Net> <VAT>0</VAT> </TotalActualPrice> <TotalOTRFees> <Gross>0</Gross> <Net>0</Net> <VAT>0</VAT> </TotalOTRFees> <TotalOTRPrice> <Gross>0</Gross> <Net>0</Net> <VAT>0</VAT> </TotalOTRPrice> </VehicleInflightPrice> </VehiclesInflightPrices> </InflightPricingResponse>