POST, GET | /api/C2BPostContract |
---|
import Foundation
import ServiceStack
/**
* C2BPostContractRequires active-e Contracts Service.
*/
// @DataContract
public class C2BPostContractRequest : BaseSecureRequest
{
/**
* ID of the teacher to associate the contract with.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="ID of the teacher to associate the contract with.", Format="int64", Name="TeacherId", ParameterType="query")
public var teacherId:Int?
/**
* Used to associate the contract with a school by school name.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Used to associate the contract with a school by school name.", Name="SchoolName", ParameterType="query")
public var schoolName:String
/**
* Used to associate the contract with a school by the AIM School ID
*/
// @DataMember
// @ApiMember(DataType="string", Description="Used to associate the contract with a school by the AIM School ID", Name="AIMSchoolId", ParameterType="query")
public var aimSchoolId:Int?
/**
* Used to associate the contract with a location by location code.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Used to associate the contract with a location by location code.", Name="Stloc", ParameterType="query")
public var stloc:String
/**
* ID of the instrument to associate the contract with.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="ID of the instrument to associate the contract with.", Format="int64", Name="InstrumentId", ParameterType="query")
public var instrumentId:Int?
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Sku", ParameterType="query")
public var sku:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Desc", ParameterType="query")
public var desc:String
/**
* The ID from the C2BGradeGeneric object
*/
// @DataMember
// @ApiMember(DataType="integer", Description="The ID from the C2BGradeGeneric object", Format="int64", Name="RateId", ParameterType="query")
public var rateId:Int?
/**
*
*/
// @DataMember
// @ApiMember(DataType="object", Description="", Name="Rate", ParameterType="query")
public var rate:Rate
/**
*
*/
// @DataMember
// @ApiMember(DataType="array", Description="", Name="AccessoryIdList", ParameterType="query")
public var accessoryIdList:[Int] = []
/**
*
*/
// @DataMember
// @ApiMember(DataType="array", Description="", Name="AccessoryList", ParameterType="query")
public var accessoryList:[Accessory] = []
/**
*
*/
// @DataMember
// @ApiMember(DataType="array", Description="", Name="FormInputList", ParameterType="query")
public var formInputList:[FormInput] = []
/**
*
*/
// @DataMember
// @ApiMember(DataType="object", Description="", Name="CcInfo", ParameterType="query")
public var ccInfo:CcInfo
/**
*
*/
// @DataMember
// @ApiMember(DataType="object", Description="", Name="CustomerInfo", ParameterType="query")
public var customerInfo:CustomerInfo
/**
*
*/
// @DataMember
// @ApiMember(DataType="integer", Description="", Format="int32", Name="CusAcct", ParameterType="query")
public var cusAcct:Int?
/**
*
*/
// @DataMember
// @ApiMember(DataType="int", Description="", Name="Cat", ParameterType="query")
public var cat:Int?
/**
*
*/
// @DataMember
// @ApiMember(DataType="int", Description="", Name="Sub", ParameterType="query")
public var sub:Int?
// @DataMember
public var returnTopic:Bool?
// @DataMember
public var statusId:Int?
// @DataMember
public var cardTerminalId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case teacherId
case schoolName
case aimSchoolId
case stloc
case instrumentId
case sku
case desc
case rateId
case rate
case accessoryIdList
case accessoryList
case formInputList
case ccInfo
case customerInfo
case cusAcct
case cat
case sub
case returnTopic
case statusId
case cardTerminalId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
teacherId = try container.decodeIfPresent(Int.self, forKey: .teacherId)
schoolName = try container.decodeIfPresent(String.self, forKey: .schoolName)
aimSchoolId = try container.decodeIfPresent(Int.self, forKey: .aimSchoolId)
stloc = try container.decodeIfPresent(String.self, forKey: .stloc)
instrumentId = try container.decodeIfPresent(Int.self, forKey: .instrumentId)
sku = try container.decodeIfPresent(String.self, forKey: .sku)
desc = try container.decodeIfPresent(String.self, forKey: .desc)
rateId = try container.decodeIfPresent(Int.self, forKey: .rateId)
rate = try container.decodeIfPresent(Rate.self, forKey: .rate)
accessoryIdList = try container.decodeIfPresent([Int].self, forKey: .accessoryIdList) ?? []
accessoryList = try container.decodeIfPresent([Accessory].self, forKey: .accessoryList) ?? []
formInputList = try container.decodeIfPresent([FormInput].self, forKey: .formInputList) ?? []
ccInfo = try container.decodeIfPresent(CcInfo.self, forKey: .ccInfo)
customerInfo = try container.decodeIfPresent(CustomerInfo.self, forKey: .customerInfo)
cusAcct = try container.decodeIfPresent(Int.self, forKey: .cusAcct)
cat = try container.decodeIfPresent(Int.self, forKey: .cat)
sub = try container.decodeIfPresent(Int.self, forKey: .sub)
returnTopic = try container.decodeIfPresent(Bool.self, forKey: .returnTopic)
statusId = try container.decodeIfPresent(Int.self, forKey: .statusId)
cardTerminalId = try container.decodeIfPresent(String.self, forKey: .cardTerminalId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if teacherId != nil { try container.encode(teacherId, forKey: .teacherId) }
if schoolName != nil { try container.encode(schoolName, forKey: .schoolName) }
if aimSchoolId != nil { try container.encode(aimSchoolId, forKey: .aimSchoolId) }
if stloc != nil { try container.encode(stloc, forKey: .stloc) }
if instrumentId != nil { try container.encode(instrumentId, forKey: .instrumentId) }
if sku != nil { try container.encode(sku, forKey: .sku) }
if desc != nil { try container.encode(desc, forKey: .desc) }
if rateId != nil { try container.encode(rateId, forKey: .rateId) }
if rate != nil { try container.encode(rate, forKey: .rate) }
if accessoryIdList.count > 0 { try container.encode(accessoryIdList, forKey: .accessoryIdList) }
if accessoryList.count > 0 { try container.encode(accessoryList, forKey: .accessoryList) }
if formInputList.count > 0 { try container.encode(formInputList, forKey: .formInputList) }
if ccInfo != nil { try container.encode(ccInfo, forKey: .ccInfo) }
if customerInfo != nil { try container.encode(customerInfo, forKey: .customerInfo) }
if cusAcct != nil { try container.encode(cusAcct, forKey: .cusAcct) }
if cat != nil { try container.encode(cat, forKey: .cat) }
if sub != nil { try container.encode(sub, forKey: .sub) }
if returnTopic != nil { try container.encode(returnTopic, forKey: .returnTopic) }
if statusId != nil { try container.encode(statusId, forKey: .statusId) }
if cardTerminalId != nil { try container.encode(cardTerminalId, forKey: .cardTerminalId) }
}
}
// @DataContract
public class BaseSecureRequest : BaseRequest
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Token", ParameterType="Header")
public var token:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="DeviceId", ParameterType="Header")
public var deviceId:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppId", ParameterType="Header")
public var appId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case token
case deviceId
case appId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
token = try container.decodeIfPresent(String.self, forKey: .token)
deviceId = try container.decodeIfPresent(String.self, forKey: .deviceId)
appId = try container.decodeIfPresent(String.self, forKey: .appId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if token != nil { try container.encode(token, forKey: .token) }
if deviceId != nil { try container.encode(deviceId, forKey: .deviceId) }
if appId != nil { try container.encode(appId, forKey: .appId) }
}
}
// @DataContract
public class BaseRequest : Codable
{
/**
* This is your AIM API Key provided by Tri-Tech
*/
// @DataMember
// @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
public var apiKey:String
// @DataMember
// @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
public var oAuthToken:String
required public init(){}
}
// @DataContract(Name="Rate")
public class Rate : Codable
{
// @DataMember
public var planCode:String
// @DataMember
public var level:Int?
// @DataMember
public var grade:String
// @DataMember
public var downPay:Double?
// @DataMember
public var moPay:Double?
// @DataMember
public var downMaint:Double?
// @DataMember
public var moMaint:Double?
// @DataMember
public var rdfType:String
// @DataMember
public var contractDefaultId:Int?
/**
* The Number of Months covered by the downpayment
*/
// @DataMember
// @ApiMember(DataType="int", Description="The Number of Months covered by the downpayment", Name="Months")
public var months:Int?
// @DataMember
public var downLease:Double?
// @DataMember
public var moLease:Double?
required public init(){}
}
// @DataContract(Name="Accessory")
public class Accessory : Codable
{
// @DataMember
public var desc:String
// @DataMember
public var price:Double
// @DataMember
public var type:String
// @DataMember
public var catNum:Int
// @DataMember
public var sku:String
// @DataMember
public var report:Bool?
required public init(){}
}
// @DataContract(Name="FormInput")
public class FormInput : Codable
{
/**
* Field Name of the Input Field
*/
// @DataMember
// @ApiMember(DataType="string", Description="Field Name of the Input Field", IsRequired=true, Name="Key", ParameterType="query")
public var key:String
/**
* Value of the Input Field.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Value of the Input Field.", IsRequired=true, Name="Value", ParameterType="query")
public var value:String
/**
* Whether or not the field is encryped with the C2B encryption key.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="Whether or not the field is encryped with the C2B encryption key.", IsRequired=true, Name="Encrypted", ParameterType="query")
public var encrypted:Bool
required public init(){}
}
// @DataContract(Name="CCInfo")
public class CcInfo : Codable
{
/**
* Token returned from processor
*/
// @DataMember
// @ApiMember(DataType="string", Description="Token returned from processor", IsRequired=true, Name="TokenStr", ParameterType="query")
public var tokenStr:String
/**
* Card Type (VISA, MCARD, AMEX, DSCVR)
*/
// @DataMember
// @ApiMember(DataType="string", Description="Card Type (VISA, MCARD, AMEX, DSCVR)", IsRequired=true, Name="CardType", ParameterType="query")
public var cardType:String
/**
* Last four of the card
*/
// @DataMember
// @ApiMember(DataType="string", Description="Last four of the card", IsRequired=true, Name="LastFour", ParameterType="query")
public var lastFour:String
/**
* Expiration Date of the Card. (MM/YY)
*/
// @DataMember
// @ApiMember(DataType="string", Description="Expiration Date of the Card. (MM/YY)", Name="Expiration", ParameterType="query")
public var expiration:String
/**
* Reason the card is on file.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Reason the card is on file.", Name="ReasonOnFile", ParameterType="query")
public var reasonOnFile:String
/**
* ID of the existing Token Record in AIM, if applicable
*/
// @DataMember
// @ApiMember(DataType="integer", Description="ID of the existing Token Record in AIM, if applicable", Format="int64", Name="TokenPk", ParameterType="query")
public var tokenPk:Int?
/**
* Is this the customer's primary card? Defaults to false.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="Is this the customer's primary card? Defaults to false.", Name="Primary", ParameterType="query")
public var primary:Bool?
required public init(){}
}
// @DataContract(Name="CustomerInfo")
public class CustomerInfo : Codable
{
/**
* The WebId of the customer. Optional.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="The WebId of the customer. Optional.", Format="int32", IsRequired=true, Name="WebId", ParameterType="query")
public var webId:Int?
/**
* Name of the customer.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Name of the customer.", IsRequired=true, Name="Name", ParameterType="query")
public var name:String
/**
* Address line 1 of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Address line 1 of the customer", Name="Addr1", ParameterType="query")
public var addr1:String
/**
* Address line 2 of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Address line 2 of the customer", Name="Addr2", ParameterType="query")
public var addr2:String
/**
* City of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="City of the customer", Name="City", ParameterType="query")
public var city:String
/**
* State/Province of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="State/Province of the customer", Name="St", ParameterType="query")
public var st:String
/**
* Zip code of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Zip code of the customer", Name="Zip", ParameterType="query")
public var zip:String
/**
* Country of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Country of the customer", Name="Country", ParameterType="query")
public var country:String
/**
* Phone number of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Phone number of the customer", Name="Phone", ParameterType="query")
public var phone:String
/**
* Email address of the customer. Required.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Email address of the customer. Required.", IsRequired=true, Name="Email", ParameterType="query")
public var email:String
required public init(){}
}
// @DataContract
public class C2BPostContractResponse : BaseResponse
{
// @DataMember
public var paymentRequired:Bool
// @DataMember
public var topic:String
// @DataMember
public var webRef:String
// @DataMember
public var baseUrl:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case paymentRequired
case topic
case webRef
case baseUrl
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
paymentRequired = try container.decodeIfPresent(Bool.self, forKey: .paymentRequired)
topic = try container.decodeIfPresent(String.self, forKey: .topic)
webRef = try container.decodeIfPresent(String.self, forKey: .webRef)
baseUrl = try container.decodeIfPresent(String.self, forKey: .baseUrl)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if paymentRequired != nil { try container.encode(paymentRequired, forKey: .paymentRequired) }
if topic != nil { try container.encode(topic, forKey: .topic) }
if webRef != nil { try container.encode(webRef, forKey: .webRef) }
if baseUrl != nil { try container.encode(baseUrl, forKey: .baseUrl) }
}
}
// @DataContract
public class BaseResponse : Codable
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
public var status:BaseResponseResult
required public init(){}
}
// @DataContract
public class BaseResponseResult : Codable
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
public var statusCode:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
public var login:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
public var errorCode:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
public var errorDisplayText:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
public var errorMessage:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
public var domainName:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
public var ipAddress:String
required public init(){}
}
Swift C2BPostContractRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
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: text/jsonl
Content-Type: text/jsonl
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","DeviceId":"String","AppId":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK Content-Type: text/jsonl 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"}}