POST | /sales/agreement/addNewUser | Set up a package that will be sold to an existing user | Set up a package that will be sold to an existing user. The header `X-Forwarded-For` is required and should be set to the IP address of the end user. |
---|
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'
# @ApiResponse(Description="", ResponseType=typeof(AddNewUserResponse), StatusCode=200)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddNewUserEndpoint(IAddNewUserEndpoint, IRestrictedApiRequest):
# @ApiMember(Description="IP address of the end user", IsRequired=true, 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="Member Id of the user buying the Package", IsRequired=true, ParameterType="query")
member_id: int = 0
"""
Member Id of the user buying the Package
"""
# @ApiMember(Description="Id of the store for the user", IsRequired=true)
store_id: Optional[int] = None
"""
Id of the store for the user
"""
chain_id: Optional[int] = None
# @ApiMember(Description="Package Id number of the package being purchased", IsRequired=true)
package_id: int = 0
"""
Package Id number of the package being purchased
"""
# @ApiMember(Description="Installment Plan Id being purchased. If empty, the default package will be selected.")
installment_id: Optional[int] = None
"""
Installment Plan Id being purchased. If empty, the default package will be selected.
"""
# @ApiMember(Description="Date contract takes affect")
start_date: Optional[datetime.datetime] = None
"""
Date contract takes affect
"""
# @ApiMember(Description="Promo code to apply a discount.")
promo_code: Optional[str] = None
"""
Promo code to apply a discount.
"""
# @ApiMember(Description="Staff Id of salesperson who sold the agreement.")
staff_id: Optional[int] = None
"""
Staff Id of salesperson who sold the agreement.
"""
restricted_id: Optional[int] = None
restricted_resource_type: Optional[RestrictedResourceType] = None
# @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="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
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApiResponse2Base:
success: bool = False
message: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddNewUserResponse(ApiResponse2Base):
incomplete_agreement_token: Optional[str] = None
member_id: Optional[int] = None
contract_id: Optional[int] = None
Python AddNewUserEndpoint DTOs
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 /sales/agreement/addNewUser HTTP/1.1
Host: www.clubready.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
XForwardedFor: String,
ApiKey: String,
MemberId: 0,
StoreId: 0,
ChainId: 0,
PackageId: 0,
InstallmentId: 0,
StartDate: 0001-01-01,
PromoCode: String,
StaffId: 0,
RestrictedId: 0,
RestrictedResourceType: Store,
FirstName: String,
LastName: String,
Email: String,
Gender: String,
Address: String,
City: String,
State: String,
Zip: String,
Phone: String,
WorkPhone: String,
DateOfBirth: 0001-01-01,
CellPhone: String,
Note: String,
ExternalId: String,
Username: String,
ReferralTypeId: 0,
EmergencyContactName: String,
EmergencyContactPhone: String,
EmergencyContactType: String
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { incompleteAgreementToken: String, memberId: 0, contractId: 0, success: False, message: String }