/* Options: Date: 2025-07-19 18:44:57 SwiftVersion: 5.0 Version: 6.50 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://www.clubready.com/api/current //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: ContractSoldNewUserEndpoint.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/sales/contract/sold/new/user", "POST") // @ApiResponse(Description="", ResponseType=typeof(ContractSoldNewUserResponse), StatusCode=200) public class ContractSoldNewUserEndpoint : IContractSoldNewUserEndpoint, IRestrictedApiRequest, Codable { /** * IP address of the end user */ // @ApiMember(Description="IP address of the end user", Name="X-Forwarded-For", ParameterType="header") public var xForwardedFor:String /** * Api Authentication Key */ // @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query") public var apiKey:String /** * Id for the chain of the Api Key */ // @ApiMember(Description="Id for the chain of the Api Key", ParameterType="query") public var chainId:Int? /** * Id of the store for the user */ // @ApiMember(Description="Id of the store for the user", IsRequired=true, ParameterType="query") public var storeId:Int? /** * Package Id being sold */ // @ApiMember(Description="Package Id being sold", IsRequired=true) public var packageId:Int /** * Installment Plan Id being sold */ // @ApiMember(Description="Installment Plan Id being sold", IsRequired=true) public var installmentPlanId:Int /** * Amount being paid */ // @ApiMember(Description="Amount being paid", IsRequired=true) public var paymentAmount:Double /** * Date contract takes affect */ // @ApiMember(Description="Date contract takes affect") public var startDate:Date? /** * First Name */ // @ApiMember(Description="First Name", IsRequired=true) public var firstName:String /** * Last Name */ // @ApiMember(Description="Last Name", IsRequired=true) public var lastName:String /** * Email Address */ // @ApiMember(Description="Email Address", IsRequired=true) public var email:String /** * Gender */ // @ApiMember(Description="Gender") public var gender:String /** * Address */ // @ApiMember(Description="Address") public var address:String /** * City */ // @ApiMember(Description="City") public var city:String /** * State */ // @ApiMember(Description="State") public var state:String /** * Zip Code */ // @ApiMember(Description="Zip Code") public var zip:String /** * Home phone */ // @ApiMember(Description="Home phone") public var phone:String /** * Work phone */ // @ApiMember(Description="Work phone") public var workPhone:String /** * Date of Birth */ // @ApiMember(Description="Date of Birth") public var dateOfBirth:Date? /** * Cell phone */ // @ApiMember(Description="Cell phone") public var cellPhone:String /** * Add an internal note for the new prospect */ // @ApiMember(Description="Add an internal note for the new prospect") public var note:String /** * Unique Id for the user from your system. We store internally as ExternalUserId */ // @ApiMember(Description="Unique Id for the user from your system. We store internally as ExternalUserId") public var externalId:String /** * Promo code to apply a discount. */ // @ApiMember(Description="Promo code to apply a discount.") public var promoCode:String /** * Username should be between 4 and 255 characters long */ // @ApiMember(Description="Username should be between 4 and 255 characters long") public var username:String /** * ReferralTypeId */ // @ApiMember(Description="ReferralTypeId") public var referralTypeId:Int? /** * Emergency contact name */ // @ApiMember(Description="Emergency contact name") public var emergencyContactName:String /** * Emergency contact phone number */ // @ApiMember(Description="Emergency contact phone number") public var emergencyContactPhone:String /** * Emergency contact relationship */ // @ApiMember(Description="Emergency contact relationship") public var emergencyContactType:String /** * An array of PaymentMethod objects to be used for this purchase. A null array (or omitted property) will use thePreferred method for the total amount.Each object of the array may contain properties:| Property | Description || --- | --- || PaymentAmount | The maximum amount to be attempted for this PaymentMethod. When null or omitted, the remaining PaymentAmount will be attempted. || **Use only one of the following three** | **UsePreferred** or **AcctToken** or **ProfileToken [DoNotUpdatePaymentTypePreference]** || UsePreferred | Set to `true` to use the Preferred method, otherwise omit the value or set to `null` or `false` || AcctToken | The AcctToken to attempt payment || ProfileToken | When provided, a PaymentMethod will be created (this will prevent the requirement to call `/sales/paymentprofile/import`) || DoNotUpdatePaymentTypePreference | [Optional] When creating a PaymentMethod (ProfileToken), it is set as the preferred method. To not create as preferred, set `DoNotUpdatePaymentTypePreference` to `true`. (for more information, see `/sales/paymentprofile/import`) || | |Only one of `UsePreferred`, `AcctToken`, `ProfileToken` or is needed. `DoNotUpdatePaymentTypePreference` is optionaland only valid with `ProfileToken`.* Scenario #1: Sell $3 contract using an existing PaymentMethod (i.e. AcctToken) for $1 and the Preferred method for $2.JSON:```json{ ... "PaymentAmount": 3.00, "PaymentMethods": [ { "PaymentAmount": "1.00", "AcctToken": "eyJ..." }, { "PaymentAmount": "2.00", "UsePreferred": true } ]}```JSV:```...,PaymentAmount:3.00,PaymentMethods:[{PaymentAmount:1.00,AcctToken:eyJ...NdQ},{PaymentAmount:2.00,UsePreferred:true}]```* Scenario #2: Sell $3 contract using a new PaymentMethod (i.e. ProfileToken) for $1 and the Preferred method for the remaining.Note, the sum of the PaymentMethod's PaymentAmount ($4) is greater than the agreement amount ($3). PaymentAmount is the maximum amount.This allows the first PaymentMethod to decline or partially approve (common with gift cards). Therefore, if the first PaymentMethod approvesfor $0.75, the second will be attempted for $2.25.JSON:```json{ ... "PaymentAmount": 3.00, "PaymentMethods": [ { "PaymentAmount": "1.00", "ProfileToken": "eyJ..." }, { "PaymentAmount": "3.00", "UsePreferred": true } ]}```JSV:```jsv...,PaymentAmount:3.00,PaymentMethods:[{PaymentAmount:1.00,ProfileToken:eyj...NdQ},{PaymentAmount:3.00,UsePreferred:true}]```Notes: * AcctTokens should not be parsed or persisted in the client application. They are currently jsonbased, but can be updated without notice.* ProfileToken is used to create a PaymentMethod in the ClubReady system. For more information, see `/sales/paymentprofile/import`.* If `PaymentMethods` is missing or `null`, the Preferred method will be used.* If a `PaymentMethods` `PaymentAmount` is not specified, the remaining amount will be attempted.* If a PaymentMethod is partially approved (common for gift cards), the PaymentMethod with anunspecified PaymentAmount will be charged the remaining amount, including the unapproved amount not.* When testing with this website, the PaymentMethods textbox needs JSV and only the square brackets and contents(e.g. `[{PaymentAmount:1.00,UsePreferred:true}]`). */ // @ApiMember(Description="An array of PaymentMethod objects to be used for this purchase. A null array (or omitted property) will use the\r\nPreferred method for the total amount.\r\n\r\nEach object of the array may contain properties:\r\n\r\n| Property | Description |\r\n| --- | --- |\r\n| PaymentAmount | The maximum amount to be attempted for this PaymentMethod. When null or omitted, the remaining PaymentAmount will be attempted. |\r\n| **Use only one of the following three** | **UsePreferred** or **AcctToken** or **ProfileToken [DoNotUpdatePaymentTypePreference]** |\r\n| UsePreferred | Set to `true` to use the Preferred method, otherwise omit the value or set to `null` or `false` |\r\n| AcctToken | The AcctToken to attempt payment |\r\n| ProfileToken | When provided, a PaymentMethod will be created (this will prevent the requirement to call `/sales/paymentprofile/import`) |\r\n| DoNotUpdatePaymentTypePreference | [Optional] When creating a PaymentMethod (ProfileToken), it is set as the preferred method. To not create as preferred, set `DoNotUpdatePaymentTypePreference` to `true`. (for more information, see `/sales/paymentprofile/import`) |\r\n| | |\r\n\r\nOnly one of `UsePreferred`, `AcctToken`, `ProfileToken` or is needed. `DoNotUpdatePaymentTypePreference` is optional\r\nand only valid with `ProfileToken`.\r\n\r\n* Scenario #1: Sell $3 contract using an existing PaymentMethod (i.e. AcctToken) for $1 and the Preferred method for $2.\r\n\r\nJSON:\r\n```json\r\n{\r\n ...\r\n \"PaymentAmount\": 3.00,\r\n \"PaymentMethods\": [\r\n {\r\n \"PaymentAmount\": \"1.00\",\r\n \"AcctToken\": \"eyJ...\"\r\n },\r\n {\r\n \"PaymentAmount\": \"2.00\",\r\n \"UsePreferred\": true\r\n }\r\n ]\r\n}\r\n```\r\nJSV:\r\n```\r\n...,PaymentAmount:3.00,PaymentMethods:[{PaymentAmount:1.00,AcctToken:eyJ...NdQ},{PaymentAmount:2.00,UsePreferred:true}]\r\n```\r\n\r\n* Scenario #2: Sell $3 contract using a new PaymentMethod (i.e. ProfileToken) for $1 and the Preferred method for the remaining.\r\nNote, the sum of the PaymentMethod's PaymentAmount ($4) is greater than the agreement amount ($3). PaymentAmount is the maximum amount.\r\nThis allows the first PaymentMethod to decline or partially approve (common with gift cards). Therefore, if the first PaymentMethod approves\r\nfor $0.75, the second will be attempted for $2.25.\r\n\r\nJSON:\r\n```json\r\n{ \r\n ...\r\n \"PaymentAmount\": 3.00,\r\n \"PaymentMethods\": [\r\n {\r\n \"PaymentAmount\": \"1.00\",\r\n \"ProfileToken\": \"eyJ...\"\r\n },\r\n {\r\n \"PaymentAmount\": \"3.00\",\r\n \"UsePreferred\": true\r\n }\r\n ]\r\n}\r\n```\r\nJSV:\r\n```jsv\r\n...,PaymentAmount:3.00,PaymentMethods:[{PaymentAmount:1.00,ProfileToken:eyj...NdQ},{PaymentAmount:3.00,UsePreferred:true}]\r\n```\r\n\r\nNotes: \r\n\r\n* AcctTokens should not be parsed or persisted in the client application. They are currently json\r\nbased, but can be updated without notice.\r\n\r\n* ProfileToken is used to create a PaymentMethod in the ClubReady system. For more information, \r\nsee `/sales/paymentprofile/import`.\r\n\r\n* If `PaymentMethods` is missing or `null`, the Preferred method will be used.\r\n\r\n* If a `PaymentMethods` `PaymentAmount` is not specified, the remaining amount will be attempted.\r\n\r\n* If a PaymentMethod is partially approved (common for gift cards), the PaymentMethod with an\r\nunspecified PaymentAmount will be charged the remaining amount, including the unapproved amount not.\r\n\r\n* When testing with this website, the PaymentMethods textbox needs JSV and only the square brackets and contents\r\n(e.g. `[{PaymentAmount:1.00,UsePreferred:true}]`).") public var paymentMethods:[PaymentMethodDto] = [] public var restrictedId:Int? public var restrictedResourceType:RestrictedResourceType required public init(){} } public enum RestrictedResourceType : String, Codable { case Store case Chain case User case Undefined } public protocol IApiDtoBase { var apiKey:String { get set } var storeId:Int? { get set } var chainId:Int? { get set } } public protocol IRestrictedApiRequest : IApiKeyEndpoint { var restrictedId:Int? { get set } var restrictedResourceType:RestrictedResourceType { get set } } public protocol IApiKeyEndpoint { var apiKey:String { get set } } // @DataContract public class PaymentMethodDto : Codable { // @DataMember public var acctToken:String // @DataMember public var profileToken:String // @DataMember public var paymentProfileId:String // @DataMember public var paymentAmount:Double? // @DataMember public var usePreferred:Bool? // @DataMember public var doNotUpdatePaymentTypePreference:Bool? required public init(){} } // @DataContract public enum AcctType : Int, Codable { case Uninitialized = 0 case Visa = 1 case MC = 2 case Disc = 3 case Amex = 4 case Diners = 5 case JCB = 6 case enRoute = 7 case PayPal = 8 case BillMe = 9 case PC = 11 case PS = 12 case BC = 13 case BS = 14 case Becs = 15 case Bacs = 16 case Maestro = 20 case Solo = 21 case VisaElectron = 22 case CIBC = 23 case RoyalBankCa = 24 case TDCaTrust = 25 case Scotia = 26 case BMO = 27 case HSBCCa = 28 case UnionPay = 29 case InterPayment = 30 case Laser = 31 case UnknownCredit = 40 case TransArmor = 41 case Factor4 = 42 case XPass = 43 case ConnectedAccount = 44 case UnknownBank = 45 case Error = -1 } public protocol IContractSoldNewUserEndpoint : IApiDtoBase { var acctToken:String { get set } var last4:String { get set } var expMonth:Int? { get set } var expYear:Int? { get set } var acctType:AcctType? { get set } var bnkRoute:Int? { get set } var isTemp:Bool { get set } var packageId:Int { get set } var installmentPlanId:Int { get set } var paymentAmount:Double { get set } var startDate:Date? { get set } var firstName:String { get set } var lastName:String { get set } var address:String { get set } var city:String { get set } var state:String { get set } var zip:String { get set } var email:String { get set } var gender:String { get set } var phone:String { get set } var workPhone:String { get set } var dateOfBirth:Date? { get set } var cellPhone:String { get set } var note:String { get set } var externalId:String { get set } var promoCode:String { get set } var username:String { get set } var referralTypeId:Int? { get set } var emergencyContactName:String { get set } var emergencyContactPhone:String { get set } var emergencyContactType:String { get set } var paymentMethods:[PaymentMethodDto] { get set } }