/* Options: Date: 2024-11-24 13:52:48 SwiftVersion: 5.0 Version: 6.50 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://clubready.com/api/current //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: CalculatePaymentPlanRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/sales/packages/{PackageId}/installments/calculate/{InstallmentPlanId}", "GET") public class CalculatePaymentPlanRequest : CalculatePaymentPlanRequestDto, IReturn, IRestrictedApiRequest { public typealias Return = CalculatePaymentPlanResultDto /** * Api Key - grants access to resources */ // @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query") public var apiKey:String /** * ID # of store to calculate plan for */ // @ApiMember(DataType="integer", Description="ID # of store to calculate plan for", IsRequired=true, Name="StoreId", ParameterType="query") public var storeId:Int? /** * Installment Plan to calculate a scheduel for */ // @ApiMember(DataType="integer", Description="Installment Plan to calculate a scheduel for", IsRequired=true, Name="InstallmentPlanId", ParameterType="path") public var installmentPlanId:Int /** * The package to calculate for */ // @ApiMember(DataType="integer", Description="The package to calculate for", IsRequired=true, Name="PackageId", ParameterType="path") public var packageId:Int /** * Date to calculate schedule from. If not provided, will use today. */ // @ApiMember(DataType="datetime", Description="Date to calculate schedule from. If not provided, will use today.", Name="StartDate", ParameterType="query") public var startDate:Date? /** * Promo code to apply a discount. */ // @ApiMember(DataType="string", Description="Promo code to apply a discount.", Name="PromoCode", ParameterType="query") public var promoCode:String public var restrictedId:Int? public var restrictedResourceType:RestrictedResourceType required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case apiKey case storeId case installmentPlanId case packageId case startDate case promoCode case restrictedId case restrictedResourceType } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) storeId = try container.decodeIfPresent(Int.self, forKey: .storeId) installmentPlanId = try container.decodeIfPresent(Int.self, forKey: .installmentPlanId) packageId = try container.decodeIfPresent(Int.self, forKey: .packageId) startDate = try container.decodeIfPresent(Date.self, forKey: .startDate) promoCode = try container.decodeIfPresent(String.self, forKey: .promoCode) restrictedId = try container.decodeIfPresent(Int.self, forKey: .restrictedId) restrictedResourceType = try container.decodeIfPresent(RestrictedResourceType.self, forKey: .restrictedResourceType) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if apiKey != nil { try container.encode(apiKey, forKey: .apiKey) } if storeId != nil { try container.encode(storeId, forKey: .storeId) } if installmentPlanId != nil { try container.encode(installmentPlanId, forKey: .installmentPlanId) } if packageId != nil { try container.encode(packageId, forKey: .packageId) } if startDate != nil { try container.encode(startDate, forKey: .startDate) } if promoCode != nil { try container.encode(promoCode, forKey: .promoCode) } if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) } if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) } } } public class CalculatePaymentPlanResultDto : Codable { public var planTotal:String public var subTotal:String public var taxRate:Float? public var enhancementFee:String public var enhancementFeeTaxAmount:String public var taxEnhFee:Bool public var tax:String public var totalDueToday:String public var payments:[PaymentPlanInstallment] = [] public var fees:[PaymentPlanInstallment] = [] public var isEvergreen:Bool public var requirePaymentProfile:Bool required public init(){} } public enum RestrictedResourceType : String, Codable { case Store case Chain case User case Undefined } public protocol IRestrictedApiRequest : IApiKeyEndpoint { var restrictedId:Int? { get set } var restrictedResourceType:RestrictedResourceType { get set } } public protocol IApiKeyEndpoint { var apiKey:String { get set } } public class ApiDtoBase : Codable { public var apiKey:String public var storeId:Int? public var chainId:Int? required public init(){} } public class CalculatePaymentPlanRequestDto : ApiDtoBase { public var installmentPlanId:Int public var packageId:Int public var startDate:Date? public var promoCode:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case installmentPlanId case packageId case startDate case promoCode } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) installmentPlanId = try container.decodeIfPresent(Int.self, forKey: .installmentPlanId) packageId = try container.decodeIfPresent(Int.self, forKey: .packageId) startDate = try container.decodeIfPresent(Date.self, forKey: .startDate) promoCode = try container.decodeIfPresent(String.self, forKey: .promoCode) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if installmentPlanId != nil { try container.encode(installmentPlanId, forKey: .installmentPlanId) } if packageId != nil { try container.encode(packageId, forKey: .packageId) } if startDate != nil { try container.encode(startDate, forKey: .startDate) } if promoCode != nil { try container.encode(promoCode, forKey: .promoCode) } } } public class PaymentPlanInstallment : Codable { public var payToday:Bool public var amount:Double public var taxed:Bool public var taxRate:Float? public var taxAmount:Double? public var feeName:String public var dueDate:Date public var total:String public var setupFeeId:Int? required public init(){} }