| Requires any of the roles: | Admin, TeamAdmin | Requires the permission: | ReadData |
| POST | /OrderOwnerCards/upgrade/quote | Side-effect-free price of an owner-card upgrade: the exact delta POST /OrderOwnerCards/upgrade will charge |
|---|
import Foundation
import ServiceStack
public class OwnerCardsUpgradeQuoteRequest : Codable
{
public var buyerPhone:String?
public var sourceOwnerCardId:Int?
public var targetOwnerCardTypeId:Int?
public var tenders:[OrderTender] = []
required public init(){}
}
public class OrderTender : Codable
{
public var kind:String?
public var code:String?
public var amountMinor:Int?
public var idempotencyKey:String?
public var holdId:Int?
public var appliedMinor:Int?
required public init(){}
}
public class OwnerCardsUpgradeQuoteResult : OwnerCardUpgradeResultBase
{
public var sourceOwnerCardId:Int?
public var sourceOwnerCardTypeId:Int?
public var sourceTypeName:String?
public var targetOwnerCardTypeId:Int?
public var targetTypeName:String?
public var pricePaidOriginal:Int?
public var targetPrice:Int?
public var priceTotal:Int?
public var discountAmount:Int?
public var giftCardAmount:Int?
public var donationAmount:Int?
public var transactionFee:Int?
public var chargedAmount:Int?
public var chargedAmountMinor:Int?
public var fullyCovered:Bool?
public var validFromUTC:Date?
public var validToUTC:Date?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case sourceOwnerCardId
case sourceOwnerCardTypeId
case sourceTypeName
case targetOwnerCardTypeId
case targetTypeName
case pricePaidOriginal
case targetPrice
case priceTotal
case discountAmount
case giftCardAmount
case donationAmount
case transactionFee
case chargedAmount
case chargedAmountMinor
case fullyCovered
case validFromUTC
case validToUTC
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
sourceOwnerCardId = try container.decodeIfPresent(Int.self, forKey: .sourceOwnerCardId)
sourceOwnerCardTypeId = try container.decodeIfPresent(Int.self, forKey: .sourceOwnerCardTypeId)
sourceTypeName = try container.decodeIfPresent(String.self, forKey: .sourceTypeName)
targetOwnerCardTypeId = try container.decodeIfPresent(Int.self, forKey: .targetOwnerCardTypeId)
targetTypeName = try container.decodeIfPresent(String.self, forKey: .targetTypeName)
pricePaidOriginal = try container.decodeIfPresent(Int.self, forKey: .pricePaidOriginal)
targetPrice = try container.decodeIfPresent(Int.self, forKey: .targetPrice)
priceTotal = try container.decodeIfPresent(Int.self, forKey: .priceTotal)
discountAmount = try container.decodeIfPresent(Int.self, forKey: .discountAmount)
giftCardAmount = try container.decodeIfPresent(Int.self, forKey: .giftCardAmount)
donationAmount = try container.decodeIfPresent(Int.self, forKey: .donationAmount)
transactionFee = try container.decodeIfPresent(Int.self, forKey: .transactionFee)
chargedAmount = try container.decodeIfPresent(Int.self, forKey: .chargedAmount)
chargedAmountMinor = try container.decodeIfPresent(Int.self, forKey: .chargedAmountMinor)
fullyCovered = try container.decodeIfPresent(Bool.self, forKey: .fullyCovered)
validFromUTC = try container.decodeIfPresent(Date.self, forKey: .validFromUTC)
validToUTC = try container.decodeIfPresent(Date.self, forKey: .validToUTC)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if sourceOwnerCardId != nil { try container.encode(sourceOwnerCardId, forKey: .sourceOwnerCardId) }
if sourceOwnerCardTypeId != nil { try container.encode(sourceOwnerCardTypeId, forKey: .sourceOwnerCardTypeId) }
if sourceTypeName != nil { try container.encode(sourceTypeName, forKey: .sourceTypeName) }
if targetOwnerCardTypeId != nil { try container.encode(targetOwnerCardTypeId, forKey: .targetOwnerCardTypeId) }
if targetTypeName != nil { try container.encode(targetTypeName, forKey: .targetTypeName) }
if pricePaidOriginal != nil { try container.encode(pricePaidOriginal, forKey: .pricePaidOriginal) }
if targetPrice != nil { try container.encode(targetPrice, forKey: .targetPrice) }
if priceTotal != nil { try container.encode(priceTotal, forKey: .priceTotal) }
if discountAmount != nil { try container.encode(discountAmount, forKey: .discountAmount) }
if giftCardAmount != nil { try container.encode(giftCardAmount, forKey: .giftCardAmount) }
if donationAmount != nil { try container.encode(donationAmount, forKey: .donationAmount) }
if transactionFee != nil { try container.encode(transactionFee, forKey: .transactionFee) }
if chargedAmount != nil { try container.encode(chargedAmount, forKey: .chargedAmount) }
if chargedAmountMinor != nil { try container.encode(chargedAmountMinor, forKey: .chargedAmountMinor) }
if fullyCovered != nil { try container.encode(fullyCovered, forKey: .fullyCovered) }
if validFromUTC != nil { try container.encode(validFromUTC, forKey: .validFromUTC) }
if validToUTC != nil { try container.encode(validToUTC, forKey: .validToUTC) }
}
}
public class OwnerCardUpgradeResultBase : Codable
{
public var statusCode:Int?
public var message:String?
public var reason:String?
required public init(){}
}
Swift OwnerCardsUpgradeQuoteRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /OrderOwnerCards/upgrade/quote HTTP/1.1
Host: stubbur-app.azurewebsites.net
Accept: application/json
Content-Type: application/json
Content-Length: length
{"buyerPhone":"String","sourceOwnerCardId":0,"targetOwnerCardTypeId":0,"tenders":[{"kind":"String","code":"String","amountMinor":0,"idempotencyKey":"String","holdId":0,"appliedMinor":0}]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"sourceOwnerCardId":0,"sourceOwnerCardTypeId":0,"sourceTypeName":"String","targetOwnerCardTypeId":0,"targetTypeName":"String","pricePaidOriginal":0,"targetPrice":0,"priceTotal":0,"discountAmount":0,"giftCardAmount":0,"donationAmount":0,"transactionFee":0,"chargedAmount":0,"chargedAmountMinor":0,"fullyCovered":false,"validFromUTC":"0001-01-01T00:00:00.0000000","validToUTC":"0001-01-01T00:00:00.0000000","statusCode":0,"message":"String","reason":"String"}