AIM Web Services

<back to all web services

AddCustomerRequest

AddCustomer
Requires active-e Customer Service.

The following routes are available for this service:
POST/api/AddCustomer
import Foundation
import ServiceStack

/**
* AddCustomerRequires active-e Customer Service.
*/
// @DataContract
public class AddCustomerRequest : BaseSecureRequest
{
    /**
    * Location ID
    */
    // @DataMember
    // @ApiMember(DataType="integer", Description="Location ID", Format="int64", IsRequired=true, Name="LocationId", ParameterType="query")
    public var locationId:Int?

    /**
    * Customer Default Id
    */
    // @DataMember
    // @ApiMember(DataType="integer", Description="Customer Default Id", Format="int64", IsRequired=true, Name="CustomerDefaultId", ParameterType="query")
    public var customerDefaultId:Int?

    /**
    * Tax Authority Id
    */
    // @DataMember
    // @ApiMember(DataType="integer", Description="Tax Authority Id", Format="int64", IsRequired=true, Name="TaxAuthorityId", ParameterType="query")
    public var taxAuthorityId:Int?

    // @DataMember
    public var name:String

    // @DataMember
    public var attn:String

    // @DataMember
    public var address1:String

    // @DataMember
    public var address2:String

    // @DataMember
    public var city:String

    // @DataMember
    public var state:String

    // @DataMember
    public var zip:String

    // @DataMember
    public var country:String

    // @DataMember
    public var homePhone:String

    // @DataMember
    public var workPhone:String

    // @DataMember
    public var cellPhone:String

    // @DataMember
    public var employer:String

    // @DataMember
    public var ss:String

    // @DataMember
    public var email:String

    /**
    * Email Method. Set this to Word, PDF, HTML, or None
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Email Method. Set this to Word, PDF, HTML, or None", Name="EmailMethod", ParameterType="query")
    public var emailMethod:String

    // @DataMember
    public var notes:String

    // @DataMember
    public var driversLicenseInfo:LicenseInfo

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="array", Description="", Name="FormInputList", ParameterType="query")
    public var formInputList:[FormInput] = []

    /**
    * Can be SKIP, CHECK, or CHECKONLY. Defaults to SKIP. SKIP will not do a duplicate check. CHECK will do a duplicate check and the customer will not added if duplicates are found. CHECKONLY will just do a duplicate check; the customer will not be added. Duplicate check logic is based on the AIM system variable CustDupCheck.
    */
    // @DataMember
    // @ApiMember(Description="Can be SKIP, CHECK, or CHECKONLY. Defaults to SKIP. SKIP will not do a duplicate check. CHECK will do a duplicate check and the customer will not added if duplicates are found. CHECKONLY will just do a duplicate check; the customer will not be added. Duplicate check logic is based on the AIM system variable CustDupCheck.", Name="DuplicateCheckMode")
    public var duplicateCheckMode:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case locationId
        case customerDefaultId
        case taxAuthorityId
        case name
        case attn
        case address1
        case address2
        case city
        case state
        case zip
        case country
        case homePhone
        case workPhone
        case cellPhone
        case employer
        case ss
        case email
        case emailMethod
        case notes
        case driversLicenseInfo
        case formInputList
        case duplicateCheckMode
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        locationId = try container.decodeIfPresent(Int.self, forKey: .locationId)
        customerDefaultId = try container.decodeIfPresent(Int.self, forKey: .customerDefaultId)
        taxAuthorityId = try container.decodeIfPresent(Int.self, forKey: .taxAuthorityId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        attn = try container.decodeIfPresent(String.self, forKey: .attn)
        address1 = try container.decodeIfPresent(String.self, forKey: .address1)
        address2 = try container.decodeIfPresent(String.self, forKey: .address2)
        city = try container.decodeIfPresent(String.self, forKey: .city)
        state = try container.decodeIfPresent(String.self, forKey: .state)
        zip = try container.decodeIfPresent(String.self, forKey: .zip)
        country = try container.decodeIfPresent(String.self, forKey: .country)
        homePhone = try container.decodeIfPresent(String.self, forKey: .homePhone)
        workPhone = try container.decodeIfPresent(String.self, forKey: .workPhone)
        cellPhone = try container.decodeIfPresent(String.self, forKey: .cellPhone)
        employer = try container.decodeIfPresent(String.self, forKey: .employer)
        ss = try container.decodeIfPresent(String.self, forKey: .ss)
        email = try container.decodeIfPresent(String.self, forKey: .email)
        emailMethod = try container.decodeIfPresent(String.self, forKey: .emailMethod)
        notes = try container.decodeIfPresent(String.self, forKey: .notes)
        driversLicenseInfo = try container.decodeIfPresent(LicenseInfo.self, forKey: .driversLicenseInfo)
        formInputList = try container.decodeIfPresent([FormInput].self, forKey: .formInputList) ?? []
        duplicateCheckMode = try container.decodeIfPresent(String.self, forKey: .duplicateCheckMode)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if locationId != nil { try container.encode(locationId, forKey: .locationId) }
        if customerDefaultId != nil { try container.encode(customerDefaultId, forKey: .customerDefaultId) }
        if taxAuthorityId != nil { try container.encode(taxAuthorityId, forKey: .taxAuthorityId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if attn != nil { try container.encode(attn, forKey: .attn) }
        if address1 != nil { try container.encode(address1, forKey: .address1) }
        if address2 != nil { try container.encode(address2, forKey: .address2) }
        if city != nil { try container.encode(city, forKey: .city) }
        if state != nil { try container.encode(state, forKey: .state) }
        if zip != nil { try container.encode(zip, forKey: .zip) }
        if country != nil { try container.encode(country, forKey: .country) }
        if homePhone != nil { try container.encode(homePhone, forKey: .homePhone) }
        if workPhone != nil { try container.encode(workPhone, forKey: .workPhone) }
        if cellPhone != nil { try container.encode(cellPhone, forKey: .cellPhone) }
        if employer != nil { try container.encode(employer, forKey: .employer) }
        if ss != nil { try container.encode(ss, forKey: .ss) }
        if email != nil { try container.encode(email, forKey: .email) }
        if emailMethod != nil { try container.encode(emailMethod, forKey: .emailMethod) }
        if notes != nil { try container.encode(notes, forKey: .notes) }
        if driversLicenseInfo != nil { try container.encode(driversLicenseInfo, forKey: .driversLicenseInfo) }
        if formInputList.count > 0 { try container.encode(formInputList, forKey: .formInputList) }
        if duplicateCheckMode != nil { try container.encode(duplicateCheckMode, forKey: .duplicateCheckMode) }
    }
}

// @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
public class LicenseInfo : Codable
{
    // @DataMember
    public var number:String

    // @DataMember
    public var height:String

    // @DataMember
    public var weight:String

    // @DataMember
    public var hair:String

    // @DataMember
    public var eyes:String

    // @DataMember
    public var expiration:String

    // @DataMember
    public var birthday:String

    // @DataMember
    public var ethnicity:String

    // @DataMember
    public var gender:String

    // @DataMember
    public var state:String

    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
public class AddCustomerResponse : BaseResponse
{
    // @DataMember
    public var id:Int?

    /**
    * Only returned if PerformDuplicateCheck parameter was passed in and possible duplicates were found. If this is returned, the customer record was *not* created.
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Only returned if PerformDuplicateCheck parameter was passed in and possible duplicates were found. If this is returned, the customer record was *not* created.", Name="PossibleDuplicates")
    public var possibleDuplicates:[CustomerSearchRecord] = []

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case id
        case possibleDuplicates
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        possibleDuplicates = try container.decodeIfPresent([CustomerSearchRecord].self, forKey: .possibleDuplicates) ?? []
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
        if possibleDuplicates.count > 0 { try container.encode(possibleDuplicates, forKey: .possibleDuplicates) }
    }
}

// @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(){}
}

// @DataContract
public class CustomerSearchRecord : BindableObject
{
    // @DataMember
    public var pk:Int

    // @DataMember
    public var acct:Int

    // @DataMember
    public var last:String

    // @DataMember
    public var name:String

    // @DataMember
    public var addr1:String

    // @DataMember
    public var addr2:String

    // @DataMember
    public var city:String

    // @DataMember
    public var st:String

    // @DataMember
    public var zip:String

    // @DataMember
    public var phone:String

    // @DataMember
    public var email:String

    // @DataMember
    public var openInvoices:Bool

    // @DataMember
    public var rentalActivity:Bool

    // @DataMember
    public var stLoc:String

    // @DataMember
    public var hold:Bool

    // @DataMember
    public var barcode:String

    // @DataMember
    public var color:Int

    // @DataMember
    public var dependantInfo:[DependantRecord] = []

    // @DataMember
    public var additionalDetails:AdditionalDetail

    // @DataMember
    public var matchedOn:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case pk
        case acct
        case last
        case name
        case addr1
        case addr2
        case city
        case st
        case zip
        case phone
        case email
        case openInvoices
        case rentalActivity
        case stLoc
        case hold
        case barcode
        case color
        case dependantInfo
        case additionalDetails
        case matchedOn
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        pk = try container.decodeIfPresent(Int.self, forKey: .pk)
        acct = try container.decodeIfPresent(Int.self, forKey: .acct)
        last = try container.decodeIfPresent(String.self, forKey: .last)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        addr1 = try container.decodeIfPresent(String.self, forKey: .addr1)
        addr2 = try container.decodeIfPresent(String.self, forKey: .addr2)
        city = try container.decodeIfPresent(String.self, forKey: .city)
        st = try container.decodeIfPresent(String.self, forKey: .st)
        zip = try container.decodeIfPresent(String.self, forKey: .zip)
        phone = try container.decodeIfPresent(String.self, forKey: .phone)
        email = try container.decodeIfPresent(String.self, forKey: .email)
        openInvoices = try container.decodeIfPresent(Bool.self, forKey: .openInvoices)
        rentalActivity = try container.decodeIfPresent(Bool.self, forKey: .rentalActivity)
        stLoc = try container.decodeIfPresent(String.self, forKey: .stLoc)
        hold = try container.decodeIfPresent(Bool.self, forKey: .hold)
        barcode = try container.decodeIfPresent(String.self, forKey: .barcode)
        color = try container.decodeIfPresent(Int.self, forKey: .color)
        dependantInfo = try container.decodeIfPresent([DependantRecord].self, forKey: .dependantInfo) ?? []
        additionalDetails = try container.decodeIfPresent(AdditionalDetail.self, forKey: .additionalDetails)
        matchedOn = try container.decodeIfPresent(String.self, forKey: .matchedOn)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if pk != nil { try container.encode(pk, forKey: .pk) }
        if acct != nil { try container.encode(acct, forKey: .acct) }
        if last != nil { try container.encode(last, forKey: .last) }
        if name != nil { try container.encode(name, forKey: .name) }
        if addr1 != nil { try container.encode(addr1, forKey: .addr1) }
        if addr2 != nil { try container.encode(addr2, forKey: .addr2) }
        if city != nil { try container.encode(city, forKey: .city) }
        if st != nil { try container.encode(st, forKey: .st) }
        if zip != nil { try container.encode(zip, forKey: .zip) }
        if phone != nil { try container.encode(phone, forKey: .phone) }
        if email != nil { try container.encode(email, forKey: .email) }
        if openInvoices != nil { try container.encode(openInvoices, forKey: .openInvoices) }
        if rentalActivity != nil { try container.encode(rentalActivity, forKey: .rentalActivity) }
        if stLoc != nil { try container.encode(stLoc, forKey: .stLoc) }
        if hold != nil { try container.encode(hold, forKey: .hold) }
        if barcode != nil { try container.encode(barcode, forKey: .barcode) }
        if color != nil { try container.encode(color, forKey: .color) }
        if dependantInfo.count > 0 { try container.encode(dependantInfo, forKey: .dependantInfo) }
        if additionalDetails != nil { try container.encode(additionalDetails, forKey: .additionalDetails) }
        if matchedOn != nil { try container.encode(matchedOn, forKey: .matchedOn) }
    }
}

// @DataContract
public class BindableObject : Codable
{
    required public init(){}
}

// @DataContract
public class DependantRecord : Codable
{
    // @DataMember
    public var name:String

    // @DataMember
    public var onlineId:String

    // @DataMember
    public var schoolDistrict:String

    // @DataMember
    public var school:String

    // @DataMember
    public var id:Int

    required public init(){}
}

// @DataContract
public class AdditionalDetail : Codable
{
    // @DataMember
    public var creationDate:Date

    // @DataMember
    public var lastModifiedDate:Date

    // @DataMember
    public var notes:String

    // @DataMember
    public var customerDefault:CustomerDefaultInfo

    // @DataMember
    public var taxAuthority:TaxAuthorityInfo

    // @DataMember
    public var canCharge:Bool

    // @DataMember
    public var popupNotes:String

    // @DataMember
    public var dlNumber:String

    // @DataMember
    public var phone2:String

    // @DataMember
    public var phone3:String

    // @DataMember
    public var phone4:String

    // @DataMember
    public var location:LocationInfo

    required public init(){}
}

// @DataContract
public class CustomerDefaultInfo : Codable
{
    // @DataMember
    public var id:Int

    // @DataMember
    public var desc:String

    // @DataMember
    public var shortDesc:String

    required public init(){}
}

// @DataContract
public class TaxAuthorityInfo : Codable
{
    // @DataMember
    public var id:Int

    // @DataMember
    public var desc:String

    // @DataMember
    public var shortDesc:String

    required public init(){}
}

// @DataContract
public class LocationInfo : Codable
{
    // @DataMember
    public var id:Int

    // @DataMember
    public var desc:String

    // @DataMember
    public var shortDesc:String

    // @DataMember
    public var region:String

    // @DataMember
    public var latitude:Double

    // @DataMember
    public var longitude:Double

    // @DataMember
    public var inStorePickup:String

    // @DataMember
    public var active:Bool

    // @DataMember
    public var cashSaleAcct:Int?

    required public init(){}
}


Swift AddCustomerRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/AddCustomer HTTP/1.1 
Host: active-ewebservice.biz 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"LocationId":0,"CustomerDefaultId":0,"TaxAuthorityId":0,"Name":"String","Attn":"String","Address1":"String","Address2":"String","City":"String","State":"String","Zip":"String","Country":"String","HomePhone":"String","WorkPhone":"String","CellPhone":"String","Employer":"String","SS":"String","Email":"String","EmailMethod":"String","Notes":"String","DriversLicenseInfo":{"Number":"String","Height":"String","Weight":"String","Hair":"String","Eyes":"String","Expiration":"String","Birthday":"String","Ethnicity":"String","Gender":"String","State":"String"},"FormInputList":[{"Key":"String","Value":"String","Encrypted":false}],"DuplicateCheckMode":"String","Token":"String","DeviceId":"String","AppId":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Id":0,"PossibleDuplicates":[{"Pk":0,"Acct":0,"Last":"String","Name":"String","Addr1":"String","Addr2":"String","City":"String","St":"String","Zip":"String","Phone":"String","Email":"String","OpenInvoices":false,"RentalActivity":false,"StLoc":"String","Hold":false,"Barcode":"String","Color":0,"DependantInfo":[{"Name":"String","OnlineId":"String","SchoolDistrict":"String","School":"String","Id":0}],"AdditionalDetails":{"Notes":"String","CustomerDefault":{"Id":0,"Desc":"String","ShortDesc":"String"},"TaxAuthority":{"Id":0,"Desc":"String","ShortDesc":"String"},"CanCharge":false,"PopupNotes":"String","DlNumber":"String","Phone2":"String","Phone3":"String","Phone4":"String","Location":{"Id":0,"Desc":"String","ShortDesc":"String","Region":"String","Latitude":0,"Longitude":0,"InStorePickup":"String","Active":false,"CashSaleAcct":0}},"MatchedOn":"String"}],"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}