All Verbs | /buy/{Id} | ||
---|---|---|---|
GET | /Buy/{Id} | ||
All Verbs | /buy/{Id}/{Quantity} | ||
GET | /Buy |
import Foundation
import ServiceStack
public class Buy : IGet, Codable
{
public var id:String
public var coupon:String
public var quantity:Int?
public var renewalRef:String
public var upgradeRef:String
required public init(){}
}
public class BuyResponse : Codable
{
public var coupon:String
public var renewalRef:String
public var upgradeRef:String
public var sku:Sku
public var quote:QuoteResponse
public var responseStatus:ResponseStatus
required public init(){}
}
public class Sku : Codable
{
public var id:Int
public var productId:Int
public var type:SkuType
public var feature:LicenseFeature
public var code:String
public var name:String
public var notes:String
// @Ignore()
public var minQty:Int?
public var maxQty:Int?
public var price:Int
public var plan:String
public var discountOff:Int
public var discountLabelOff:String
public var actualPrice:Int
public var isPlan:Bool
public var isRenewal:Bool
public var subscriptionDurationDays:Int?
public var expiryDurationDays:Int?
public var trialPeriodDays:Int?
public var supportQty:Int
public var coresQty:Int?
public var createdDate:Date
public var modifiedDate:Date
public var licenseType:LicenseType
public var active:Bool
required public init(){}
}
public enum SkuType : String, Codable
{
case Product
case PerDev
case PerCore
case Site
case Support
case Training
case Register
case Payment
}
// @Flags()
public enum LicenseFeature : Int, Codable
{
case None = 0
case Free = 0
case Premium = 1
case Text = 2
case Client = 4
case Common = 8
case Redis = 16
case RedisSku = 18
case OrmLite = 32
case OrmLiteSku = 34
case ServiceStack = 64
case Server = 128
case Razor = 256
case Admin = 512
case Aws = 1024
case AwsSku = 1026
case All = 2047
}
public enum LicenseType : String, Codable
{
case Free
case FreeIndividual
case FreeOpenSource
case Indie
case Business
case Enterprise
case TextIndie
case TextBusiness
case OrmLiteIndie
case OrmLiteBusiness
case RedisIndie
case RedisBusiness
case AwsIndie
case AwsBusiness
case Trial
case Site
case TextSite
case RedisSite
case OrmLiteSite
}
public class QuoteResponse : Codable
{
public var skuId:Int
public var code:String
public var customerId:Int?
public var modifyingExistingSubscription:Bool
public var changingSubscriptions:Bool
public var switchingLicensingModels:Bool
public var replacesExistingQuantity:Bool
public var existingSubscriptionQuantity:Int?
public var newSubscriptionQuantity:Int?
public var unusedAmount:String
public var manualProrating:Bool
public var unusedDays:Int
public var quantity:Int
public var minQuantity:Int
public var maxQuantity:Int?
public var subtotal:String
public var discountDescription:String
public var discountReceived:String
public var discount:String
public var total:String
public var expiryDate:String
public var renewalDate:String
public var isReferrer:Bool
public var responseStatus:ResponseStatus
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /buy/{Id} HTTP/1.1
Host: account.servicestack.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
id: String,
coupon: String,
quantity: 0,
renewalRef: String,
upgradeRef: String
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { coupon: String, renewalRef: String, upgradeRef: String, sku: { id: 0, productId: 0, type: Product, feature: 0, code: String, name: String, notes: String, maxQty: 0, price: 0, plan: String, discountOff: 0, discountLabelOff: String, actualPrice: 0, isPlan: False, isRenewal: False, subscriptionDurationDays: 0, expiryDurationDays: 0, trialPeriodDays: 0, supportQty: 0, coresQty: 0, createdDate: 0001-01-01, modifiedDate: 0001-01-01, licenseType: Free, active: False }, quote: { skuId: 0, code: String, customerId: 0, modifyingExistingSubscription: False, changingSubscriptions: False, switchingLicensingModels: False, replacesExistingQuantity: False, existingSubscriptionQuantity: 0, newSubscriptionQuantity: 0, unusedAmount: String, manualProrating: False, unusedDays: 0, quantity: 0, minQuantity: 0, maxQuantity: 0, subtotal: String, discountDescription: String, discountReceived: String, discount: String, total: String, expiryDate: String, renewalDate: String, isReferrer: False, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } } }, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } } }