""" Options: Date: 2025-07-19 18:29:45 Version: 6.50 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://www.clubready.com/api/current #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: ContractSoldNewUserEndpoint.* #ExcludeTypes: #DefaultImports: datetime,decimal,marshmallow.fields:*,servicestack:*,typing:*,dataclasses:dataclass/field,dataclasses_json:dataclass_json/LetterCase/Undefined/config,enum:Enum/IntEnum #DataClass: #DataClassJson: """ import datetime import decimal from marshmallow.fields import * from servicestack import * from typing import * from dataclasses import dataclass, field from dataclasses_json import dataclass_json, LetterCase, Undefined, config from enum import Enum, IntEnum class RestrictedResourceType(str, Enum): STORE = 'Store' CHAIN = 'Chain' USER = 'User' UNDEFINED = 'Undefined' class IApiDtoBase: api_key: Optional[str] = None store_id: Optional[int] = None chain_id: Optional[int] = None class IRestrictedApiRequest(IApiKeyEndpoint): restricted_id: Optional[int] = None restricted_resource_type: Optional[RestrictedResourceType] = None class IApiKeyEndpoint: api_key: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class PaymentMethodDto: acct_token: Optional[str] = None profile_token: Optional[str] = None payment_profile_id: Optional[str] = None payment_amount: Optional[Decimal] = None use_preferred: Optional[bool] = None do_not_update_payment_type_preference: Optional[bool] = None class AcctType(IntEnum): UNINITIALIZED = 0 VISA = 1 MC = 2 DISC = 3 AMEX = 4 DINERS = 5 JCB = 6 EN_ROUTE = 7 PAY_PAL = 8 BILL_ME = 9 PC = 11 PS = 12 BC = 13 BS = 14 BECS = 15 BACS = 16 MAESTRO = 20 SOLO = 21 VISA_ELECTRON = 22 CIBC = 23 ROYAL_BANK_CA = 24 TD_CA_TRUST = 25 SCOTIA = 26 BMO = 27 HSBC_CA = 28 UNION_PAY = 29 INTER_PAYMENT = 30 LASER = 31 UNKNOWN_CREDIT = 40 TRANS_ARMOR = 41 FACTOR4 = 42 X_PASS = 43 CONNECTED_ACCOUNT = 44 UNKNOWN_BANK = 45 ERROR = -1 class IContractSoldNewUserEndpoint(IApiDtoBase): acct_token: Optional[str] = None last4: Optional[str] = None exp_month: Optional[int] = None exp_year: Optional[int] = None acct_type: Optional[AcctType] = None bnk_route: Optional[int] = None is_temp: bool = False package_id: int = 0 installment_plan_id: int = 0 payment_amount: Decimal = decimal.Decimal(0) start_date: Optional[datetime.datetime] = None first_name: Optional[str] = None last_name: Optional[str] = None address: Optional[str] = None city: Optional[str] = None state: Optional[str] = None zip: Optional[str] = None email: Optional[str] = None gender: Optional[str] = None phone: Optional[str] = None work_phone: Optional[str] = None date_of_birth: Optional[datetime.datetime] = None cell_phone: Optional[str] = None note: Optional[str] = None external_id: Optional[str] = None promo_code: Optional[str] = None username: Optional[str] = None referral_type_id: Optional[int] = None emergency_contact_name: Optional[str] = None emergency_contact_phone: Optional[str] = None emergency_contact_type: Optional[str] = None payment_methods: Optional[List[PaymentMethodDto]] = None # @Route("/sales/contract/sold/new/user", "POST") # @ApiResponse(Description="", ResponseType=typeof(ContractSoldNewUserResponse), StatusCode=200) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ContractSoldNewUserEndpoint(IContractSoldNewUserEndpoint, IRestrictedApiRequest): # @ApiMember(Description="IP address of the end user", Name="X-Forwarded-For", ParameterType="header") x_forwarded_for: Optional[str] = None """ IP address of the end user """ # @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query") api_key: Optional[str] = None """ Api Authentication Key """ # @ApiMember(Description="Id for the chain of the Api Key", ParameterType="query") chain_id: Optional[int] = None """ Id for the chain of the Api Key """ # @ApiMember(Description="Id of the store for the user", IsRequired=true, ParameterType="query") store_id: Optional[int] = None """ Id of the store for the user """ # @ApiMember(Description="Package Id being sold", IsRequired=true) package_id: int = 0 """ Package Id being sold """ # @ApiMember(Description="Installment Plan Id being sold", IsRequired=true) installment_plan_id: int = 0 """ Installment Plan Id being sold """ # @ApiMember(Description="Amount being paid", IsRequired=true) payment_amount: Decimal = decimal.Decimal(0) """ Amount being paid """ # @ApiMember(Description="Date contract takes affect") start_date: Optional[datetime.datetime] = None """ Date contract takes affect """ # @ApiMember(Description="First Name", IsRequired=true) first_name: Optional[str] = None """ First Name """ # @ApiMember(Description="Last Name", IsRequired=true) last_name: Optional[str] = None """ Last Name """ # @ApiMember(Description="Email Address", IsRequired=true) email: Optional[str] = None """ Email Address """ # @ApiMember(Description="Gender") gender: Optional[str] = None """ Gender """ # @ApiMember(Description="Address") address: Optional[str] = None """ Address """ # @ApiMember(Description="City") city: Optional[str] = None """ City """ # @ApiMember(Description="State") state: Optional[str] = None """ State """ # @ApiMember(Description="Zip Code") zip: Optional[str] = None """ Zip Code """ # @ApiMember(Description="Home phone") phone: Optional[str] = None """ Home phone """ # @ApiMember(Description="Work phone") work_phone: Optional[str] = None """ Work phone """ # @ApiMember(Description="Date of Birth") date_of_birth: Optional[datetime.datetime] = None """ Date of Birth """ # @ApiMember(Description="Cell phone") cell_phone: Optional[str] = None """ Cell phone """ # @ApiMember(Description="Add an internal note for the new prospect") note: Optional[str] = None """ Add an internal note for the new prospect """ # @ApiMember(Description="Unique Id for the user from your system. We store internally as ExternalUserId") external_id: Optional[str] = None """ Unique Id for the user from your system. We store internally as ExternalUserId """ # @ApiMember(Description="Promo code to apply a discount.") promo_code: Optional[str] = None """ Promo code to apply a discount. """ # @ApiMember(Description="Username should be between 4 and 255 characters long") username: Optional[str] = None """ Username should be between 4 and 255 characters long """ # @ApiMember(Description="ReferralTypeId") referral_type_id: Optional[int] = None """ ReferralTypeId """ # @ApiMember(Description="Emergency contact name") emergency_contact_name: Optional[str] = None """ Emergency contact name """ # @ApiMember(Description="Emergency contact phone number") emergency_contact_phone: Optional[str] = None """ Emergency contact phone number """ # @ApiMember(Description="Emergency contact relationship") emergency_contact_type: Optional[str] = None """ Emergency contact relationship """ # @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}]`).") payment_methods: Optional[List[PaymentMethodDto]] = None """ 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}]`). """ restricted_id: Optional[int] = None restricted_resource_type: Optional[RestrictedResourceType] = None