POST, GET | /api/C2BPostContract |
---|
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
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseRequest:
# @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="Header")
api_key: Optional[str] = None
"""
This is your AIM API Key provided by Tri-Tech
"""
# @ApiMember(DataType="string", Description="The OAuthToken token return by AeServices30", IsRequired=true, Name="OAuthToken", ParameterType="Header")
o_auth_token: Optional[str] = None
"""
The OAuthToken token return by AeServices30
"""
# @ApiMember(DataType="string", Description="The Device ID of the Mobile Device. Not used for non-mobile devices.", Name="DeviceId", ParameterType="Header")
device_id: Optional[str] = None
"""
The Device ID of the Mobile Device. Not used for non-mobile devices.
"""
# @ApiMember(DataType="string", Description="An identifier for your integration", IsRequired=true, Name="AppId", ParameterType="Header")
app_id: Optional[str] = None
"""
An identifier for your integration
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseSecureRequest(BaseRequest):
# @ApiMember(DataType="string", Description="The Login Token return by the Security API. Required for secured calls.", Name="Token", ParameterType="Header")
token: Optional[str] = None
"""
The Login Token return by the Security API. Required for secured calls.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponseResult:
# @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
status_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
login: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
error_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
error_display_text: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
error_message: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
domain_name: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
ip_address: Optional[str] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponse:
# @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
status: Optional[BaseResponseResult] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BPostContractResponse(BaseResponse):
payment_required: bool = False
topic: Optional[str] = None
web_ref: Optional[str] = None
base_url: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Rate:
# @ApiMember(DataType="string", Description="Plan Code to be used for the contract", Name="PlanCode", ParameterType="body")
plan_code: Optional[str] = None
"""
Plan Code to be used for the contract
"""
# @ApiMember(DataType="int", Description="Level to be used for the contract", Name="Level", ParameterType="body")
level: Optional[int] = None
"""
Level to be used for the contract
"""
# @ApiMember(DataType="string", Description="Grade to be used for the contract", Name="Grade", ParameterType="body")
grade: Optional[str] = None
"""
Grade to be used for the contract
"""
# @ApiMember(DataType="decimal", Description="Down Payment to be collected. Does not include maintenance or lease fees.", Name="DownPay", ParameterType="body")
down_pay: Optional[Decimal] = None
"""
Down Payment to be collected. Does not include maintenance or lease fees.
"""
# @ApiMember(DataType="decimal", Description="Monthly amount to be collected for the contract. Does not include maintenance or lease fees.", Name="MoPay", ParameterType="body")
mo_pay: Optional[Decimal] = None
"""
Monthly amount to be collected for the contract. Does not include maintenance or lease fees.
"""
# @ApiMember(DataType="decimal", Description="Down Payment to be collected for maintenance.", Name="DownMaint", ParameterType="body")
down_maint: Optional[Decimal] = None
"""
Down Payment to be collected for maintenance.
"""
# @ApiMember(DataType="decimal", Description="Monthly amount to be collected for the maintenance.", Name="MoMaint", ParameterType="body")
mo_maint: Optional[Decimal] = None
"""
Monthly amount to be collected for the maintenance.
"""
# @ApiMember(DataType="int64", Description="If sent, the first Contract Default with this rental type will be used. Not used if ContractDefaultId is sent. Valid values are EW: Extended Warranty, RO: Rent to Rent, RF: Rent to Own, SF: Sales Contract, RV: Simple Intrst: Rent, SV: Simple Intrst: Sales", Name="RdfType", ParameterType="body")
rdf_type: Optional[str] = None
"""
If sent, the first Contract Default with this rental type will be used. Not used if ContractDefaultId is sent. Valid values are EW: Extended Warranty, RO: Rent to Rent, RF: Rent to Own, SF: Sales Contract, RV: Simple Intrst: Rent, SV: Simple Intrst: Sales
"""
# @ApiMember(DataType="int64", Description="The ID of the contract default to be used for this contract.", Name="ContractDefaultId", ParameterType="body")
contract_default_id: Optional[int] = None
"""
The ID of the contract default to be used for this contract.
"""
# @ApiMember(DataType="int", Description="The Number of Months covered by the downpayment", Name="Months", ParameterType="body")
months: Optional[int] = None
"""
The Number of Months covered by the downpayment
"""
# @ApiMember(DataType="decimal", Description="Down Payment to be collected for Lease Fees.", Name="DownMaint", ParameterType="body")
down_lease: Optional[Decimal] = None
"""
Down Payment to be collected for Lease Fees.
"""
# @ApiMember(DataType="decimal", Description="Monthly amount to be collected for lease fees.", Name="MoLease", ParameterType="body")
mo_lease: Optional[Decimal] = None
"""
Monthly amount to be collected for lease fees.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Accessory:
# @ApiMember(DataType="string", Description="The description to be used for the Accessory", IsRequired=true, Name="Desc", ParameterType="body")
desc: Optional[str] = None
"""
The description to be used for the Accessory
"""
# @ApiMember(DataType="decimal", Description="The price to be used for the Accessory", Name="Price", ParameterType="body")
price: Decimal = decimal.Decimal(0)
"""
The price to be used for the Accessory
"""
# @ApiMember(DataType="string", Description="The type of Accessory. A is Accessory, D is Delivery Option, and M is Maintenance", Name="Type", ParameterType="body")
type: Optional[str] = None
"""
The type of Accessory. A is Accessory, D is Delivery Option, and M is Maintenance
"""
# @ApiMember(DataType="int", Description="The category # in AIM to be linked to this accessory.", Name="CatNum", ParameterType="body")
cat_num: int = 0
"""
The category # in AIM to be linked to this accessory.
"""
# @ApiMember(DataType="string", Description="A SKU or Package Deal package SKU can be sent here to link the accessory to that SKU or package.", Name="Sku", ParameterType="body")
sku: Optional[str] = None
"""
A SKU or Package Deal package SKU can be sent here to link the accessory to that SKU or package.
"""
# @ApiMember(DataType="bool", Description="Internal Use Only", Name="Report", ParameterType="body")
report: Optional[bool] = None
"""
Internal Use Only
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FormInput:
# @ApiMember(DataType="string", Description="Field name of the Input Field. If linking to an Attribute, this should match the Tag value.", IsRequired=true, Name="Key", ParameterType="body")
key: Optional[str] = None
"""
Field name of the Input Field. If linking to an Attribute, this should match the Tag value.
"""
# @ApiMember(DataType="string", Description="Value of the Input Field.", IsRequired=true, Name="Value", ParameterType="body")
value: Optional[str] = None
"""
Value of the Input Field.
"""
# @ApiMember(DataType="boolean", Description="Whether or not the field is encryped with the C2B encryption key.", Name="Encrypted", ParameterType="body")
encrypted: bool = False
"""
Whether or not the field is encryped with the C2B encryption key.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CcInfo:
# @ApiMember(DataType="string", Description="Token returned from processor", IsRequired=true, Name="TokenStr", ParameterType="body")
token_str: Optional[str] = None
"""
Token returned from processor
"""
# @ApiMember(DataType="string", Description="Card Type (VISA, MCARD, AMEX, DSCVR)", IsRequired=true, Name="CardType", ParameterType="body")
card_type: Optional[str] = None
"""
Card Type (VISA, MCARD, AMEX, DSCVR)
"""
# @ApiMember(DataType="string", Description="Last four of the card", IsRequired=true, Name="LastFour", ParameterType="body")
last_four: Optional[str] = None
"""
Last four of the card
"""
# @ApiMember(DataType="string", Description="Expiration Date of the Card. (MM/YY)", Name="Expiration", ParameterType="body")
expiration: Optional[str] = None
"""
Expiration Date of the Card. (MM/YY)
"""
# @ApiMember(DataType="string", Description="Reason the card is on file.", Name="ReasonOnFile", ParameterType="body")
reason_on_file: Optional[str] = None
"""
Reason the card is on file.
"""
# @ApiMember(DataType="integer", Description="ID of the existing Token Record in AIM, if applicable", Format="int64", Name="TokenPk", ParameterType="body")
token_pk: Optional[int] = None
"""
ID of the existing Token Record in AIM, if applicable
"""
# @ApiMember(DataType="boolean", Description="Is this the customer's primary card? Defaults to false.", Name="Primary", ParameterType="body")
primary: Optional[bool] = None
"""
Is this the customer's primary card? Defaults to false.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerInfo:
# @ApiMember(DataType="integer", Description="The WebId of the customer. Optional.", Format="int32", Name="WebId", ParameterType="body")
web_id: Optional[int] = None
"""
The WebId of the customer. Optional.
"""
# @ApiMember(DataType="string", Description="Name of the customer.", IsRequired=true, Name="Name", ParameterType="body")
name: Optional[str] = None
"""
Name of the customer.
"""
# @ApiMember(DataType="string", Description="Address line 1 of the customer", Name="Addr1", ParameterType="body")
addr1: Optional[str] = None
"""
Address line 1 of the customer
"""
# @ApiMember(DataType="string", Description="Address line 2 of the customer", Name="Addr2", ParameterType="body")
addr2: Optional[str] = None
"""
Address line 2 of the customer
"""
# @ApiMember(DataType="string", Description="City of the customer", Name="City", ParameterType="body")
city: Optional[str] = None
"""
City of the customer
"""
# @ApiMember(DataType="string", Description="State/Province of the customer", Name="St", ParameterType="body")
st: Optional[str] = None
"""
State/Province of the customer
"""
# @ApiMember(DataType="string", Description="Zip code of the customer", Name="Zip", ParameterType="body")
zip: Optional[str] = None
"""
Zip code of the customer
"""
# @ApiMember(DataType="string", Description="Country of the customer", Name="Country", ParameterType="body")
country: Optional[str] = None
"""
Country of the customer
"""
# @ApiMember(DataType="string", Description="Phone number of the customer", Name="Phone", ParameterType="body")
phone: Optional[str] = None
"""
Phone number of the customer
"""
# @ApiMember(DataType="string", Description="Email address of the customer. Required.", IsRequired=true, Name="Email", ParameterType="body")
email: Optional[str] = None
"""
Email address of the customer. Required.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BPostContractRequest(BaseSecureRequest):
"""
C2BPostContractRequires active-e Contracts Service.
"""
# @ApiMember(DataType="integer", Description="ID of the teacher to associate the contract with.", Format="int64", Name="TeacherId", ParameterType="body")
teacher_id: Optional[int] = None
"""
ID of the teacher to associate the contract with.
"""
# @ApiMember(DataType="string", Description="Used to associate the contract with a school by school name.", Name="SchoolName", ParameterType="body")
school_name: Optional[str] = None
"""
Used to associate the contract with a school by school name.
"""
# @ApiMember(DataType="string", Description="Used to associate the contract with a school by the AIM School ID", Name="AIMSchoolId", ParameterType="body")
aim_school_id: Optional[int] = None
"""
Used to associate the contract with a school by the AIM School ID
"""
# @ApiMember(DataType="string", Description="Used to associate the contract with a location by location code.", Name="Stloc", ParameterType="body")
stloc: Optional[str] = None
"""
Used to associate the contract with a location by location code.
"""
# @ApiMember(DataType="integer", Description="ID of the instrument to associate the contract with.", Format="int64", Name="InstrumentId", ParameterType="body")
instrument_id: Optional[int] = None
"""
ID of the instrument to associate the contract with.
"""
# @ApiMember(DataType="string", Description="SKU to associate the contract with. Don't send if you send InstrumentId.", Name="Sku", ParameterType="body")
sku: Optional[str] = None
"""
SKU to associate the contract with. Don't send if you send InstrumentId.
"""
# @ApiMember(DataType="string", Description="Description to associate the contract with if a SKU is sent. Don't send if you send InstrumentId.", Name="Desc", ParameterType="body")
desc: Optional[str] = None
"""
Description to associate the contract with if a SKU is sent. Don't send if you send InstrumentId.
"""
# @ApiMember(DataType="integer", Description="The ID from the C2BGradeGeneric object", Format="int64", Name="RateId", ParameterType="body")
rate_id: Optional[int] = None
"""
The ID from the C2BGradeGeneric object
"""
# @ApiMember(DataType="object", Description="Rate object if you're not sending RateId. Don't send both.", Name="Rate", ParameterType="body")
rate: Optional[Rate] = None
"""
Rate object if you're not sending RateId. Don't send both.
"""
# @ApiMember(DataType="array", Description="List of Accessory/Delivery/Maintenance IDs.", Name="AccessoryIdList", ParameterType="body")
accessory_id_list: Optional[List[int]] = None
"""
List of Accessory/Delivery/Maintenance IDs.
"""
# @ApiMember(DataType="array", Description="List of Accessory/Delivery/Maintenance objects. This is for items not defined in AIM.", Name="AccessoryList", ParameterType="body")
accessory_list: Optional[List[Accessory]] = None
"""
List of Accessory/Delivery/Maintenance objects. This is for items not defined in AIM.
"""
# @ApiMember(DataType="array", Description="List of Key/Value pairs containing additional information about the customer. If the Key matches an attribute tag within AIM it will populate that attribute. The following Keys are also handled specially: RENTALNOTES, ONLINESIGNATURE, ATTENTION, EMPLOYER, SOCIALSECURITY, WORKPHONE, EXTENSION, EXTENSION2, CELLPHONE, FAX, BANKROUTINGNUMBER, BANKACCOUNTNUMBER, BANKTRANSACTIONTYPE, DRIVERSLICENSENUMBER, DRIVERSLICENSESTATE, BIRTHDAY, SIGCAPTURE, WORKPHONE_EXT, CELLPHONE_EXT, FAX_EXT, CREDITCHECKNAMEOVERRIDE, DELIVERYDATE", Name="FormInputList", ParameterType="body")
form_input_list: Optional[List[FormInput]] = None
"""
List of Key/Value pairs containing additional information about the customer. If the Key matches an attribute tag within AIM it will populate that attribute. The following Keys are also handled specially: RENTALNOTES, ONLINESIGNATURE, ATTENTION, EMPLOYER, SOCIALSECURITY, WORKPHONE, EXTENSION, EXTENSION2, CELLPHONE, FAX, BANKROUTINGNUMBER, BANKACCOUNTNUMBER, BANKTRANSACTIONTYPE, DRIVERSLICENSENUMBER, DRIVERSLICENSESTATE, BIRTHDAY, SIGCAPTURE, WORKPHONE_EXT, CELLPHONE_EXT, FAX_EXT, CREDITCHECKNAMEOVERRIDE, DELIVERYDATE
"""
# @ApiMember(DataType="object", Description="Credit Card Information", Name="CcInfo", ParameterType="body")
cc_info: Optional[CcInfo] = None
"""
Credit Card Information
"""
# @ApiMember(DataType="object", Description="Customer Information if the a CusAcct is not being passed in.", Name="CustomerInfo", ParameterType="body")
customer_info: Optional[CustomerInfo] = None
"""
Customer Information if the a CusAcct is not being passed in.
"""
# @ApiMember(DataType="integer", Description="AIM Customer Acct# to be linked to this contract. Do not pass in CustomerInfo if using CusAcct.", Format="int32", Name="CusAcct", ParameterType="body")
cus_acct: Optional[int] = None
"""
AIM Customer Acct# to be linked to this contract. Do not pass in CustomerInfo if using CusAcct.
"""
# @ApiMember(DataType="int", Description="Used to associate a contract with a Cat/Sub rather then a SKU. Don't send if you send InstrumentId or SKU.", Name="Cat", ParameterType="body")
cat: Optional[int] = None
"""
Used to associate a contract with a Cat/Sub rather then a SKU. Don't send if you send InstrumentId or SKU.
"""
# @ApiMember(DataType="int", Description="Used to associate a contract with a Cat/Sub rather then a SKU. Don't send if you send InstrumentId or SKU.", Name="Sub", ParameterType="body")
sub: Optional[int] = None
"""
Used to associate a contract with a Cat/Sub rather then a SKU. Don't send if you send InstrumentId or SKU.
"""
# @ApiMember(DataType="bool", Description="If TRUE is sent, a Topic will be returned with information from AIM. Usually not used.", Name="ReturnTopic", ParameterType="body")
return_topic: Optional[bool] = None
"""
If TRUE is sent, a Topic will be returned with information from AIM. Usually not used.
"""
# @ApiMember(DataType="int", Description="If sent, the Contract will have the specified status in AIM upon creation. Use ContractStatusListing to get the desired Id. Usually not used.", Name="StatusId", ParameterType="body")
status_id: Optional[int] = None
"""
If sent, the Contract will have the specified status in AIM upon creation. Use ContractStatusListing to get the desired Id. Usually not used.
"""
# @ApiMember(DataType="string", Description="Internal Use Only. Do not use.", Name="CardTerminalId", ParameterType="body")
card_terminal_id: Optional[str] = None
"""
Internal Use Only. Do not use.
"""
Python C2BPostContractRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/C2BPostContract HTTP/1.1
Host: active-ewebservice.biz
Accept: application/json
Content-Type: application/json
Content-Length: length
{"TeacherId":0,"SchoolName":"String","AIMSchoolId":0,"Stloc":"String","InstrumentId":0,"Sku":"String","Desc":"String","RateId":0,"Rate":{"PlanCode":"String","Level":0,"Grade":"String","DownPay":0,"MoPay":0,"DownMaint":0,"MoMaint":0,"RdfType":"String","ContractDefaultId":0,"Months":0,"DownLease":0,"MoLease":0},"AccessoryIdList":[0],"AccessoryList":[{"Desc":"String","Price":0,"Type":"String","CatNum":0,"Sku":"String","Report":false}],"FormInputList":[{"Key":"String","Value":"String","Encrypted":false}],"CcInfo":{"TokenStr":"String","CardType":"String","LastFour":"String","Expiration":"String","ReasonOnFile":"String","TokenPk":0,"Primary":false},"CustomerInfo":{"WebId":0,"Name":"String","Addr1":"String","Addr2":"String","City":"String","St":"String","Zip":"String","Country":"String","Phone":"String","Email":"String"},"CusAcct":0,"Cat":0,"Sub":0,"ReturnTopic":false,"StatusId":0,"CardTerminalId":"String","Token":"String","ApiKey":"String","OAuthToken":"String","DeviceId":"String","AppId":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"PaymentRequired":false,"Topic":"String","WebRef":"String","BaseUrl":"String","Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}