/* Options:
Date: 2025-12-13 14:05:19
SwiftVersion: 5.0
Version: 6.50
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: https://clubready.com/api/current
//BaseClass:
//AddModelExtensions: True
//AddServiceStackTypes: True
IncludeTypes: AddPaymentAccount.*
//ExcludeTypes:
//ExcludeGenericBaseTypes: False
//AddResponseStatus: False
//AddImplicitVersion:
//AddDescriptionAsComments: True
//InitializeCollections: True
//TreatTypesAsStrings:
//DefaultImports: Foundation,ServiceStack
*/
import Foundation
import ServiceStack
// @Route("/sales/member/{MemberId}/payment/profile", "POST")
// @ApiResponse(Description="", ResponseType=typeof(AddPaymentProfileResponse), StatusCode=200)
public class AddPaymentAccount : AddPaymentProfileRequest, IReturn, IRestrictedApiRequest
{
public typealias Return = AddPaymentProfileResponse
/**
* IP address of the end user
*/
// @ApiMember(Description="IP address of the end user", Name="X-Forwarded-For", ParameterType="header")
public var xForwardedFor:String
/**
* Api Authentication Key
*/
// @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")
public var apiKey:String
/**
* Id of the store for the user
*/
// @ApiMember(Description="Id of the store for the user", IsRequired=true, ParameterType="query")
public var storeId:Int?
/**
* Member Id of the user to update their Payment Profile
*/
// @ApiMember(Description="Member Id of the user to update their Payment Profile", IsRequired=true, ParameterType="path")
public var memberId:Int
/**
* The AcctToken provided by creating a Payment Profile with the Vault Api
*/
// @ApiMember(Description="The AcctToken provided by creating a Payment Profile with the Vault Api", IsRequired=true)
public var acctToken:String
/**
* Last 4 digits of the Payment Profile
*/
// @ApiMember(Description="Last 4 digits of the Payment Profile")
public var last4:String
/**
* 2 digit expiration month **Required for Credit Card**
*/
// @ApiMember(Description="2 digit expiration month \n**Required for Credit Card**")
public var expMonth:Int?
/**
* 2 digit expiration year **Required for Credit Card**
*/
// @ApiMember(Description="2 digit expiration year \n**Required for Credit Card**")
public var expYear:Int?
/**
* The Account Type of the Payment Profile **Required when adding Gift Card**Common Values
You may use the Text or the Numerical value.
| Text | Numerical | Account Type |
| VISA | 1 | Visa |
| MC | 2 | MasterCard |
| Disc | 3 | Discover |
| Amex | 4 | American Express |
| PC | 11 | Personal Checking |
| PS | 12 | Personal Savings |
| BC | 13 | Business Checking |
| Factor4 | 42 | Factor4 Gift Card |
*/
// @ApiMember(Description="\r\nThe Account Type of the Payment Profile \r\n**Required when adding Gift Card**\r\nCommon Values\r\nYou may use the Text or the Numerical value.
\r\n\r\n| Text | Numerical | Account Type |
\r\n| VISA | 1 | Visa |
\r\n| MC | 2 | MasterCard |
\r\n| Disc | 3 | Discover |
\r\n| Amex | 4 | American Express |
\r\n| PC | 11 | Personal Checking |
\r\n| PS | 12 | Personal Savings |
\r\n| BC | 13 | Business Checking |
\r\n| Factor4 | 42 | Factor4 Gift Card |
\r\n
\r\n")
public var acctType:AcctType?
/**
* Bank Routing Number **Required for Bank Accounts**
*/
// @ApiMember(Description="Bank Routing Number \n**Required for Bank Accounts**")
public var bnkRoute:Int?
/**
* Set to `true` to not set the user's Payment Type Preference when adding an on-file profile
*/
// @ApiMember(Description="Set to `true` to not set the user's Payment Type Preference when adding an on-file profile")
public var doNotUpdatePaymentTypePreference:Bool
/**
* Whether the Payment Profile is Temporary (One time transactions and Gift Cards are IsTemp = `true`)
*/
// @ApiMember(Description="Whether the Payment Profile is Temporary (One time transactions and Gift Cards are IsTemp = `true`)")
public var isTemp:Bool
public var restrictedId:Int?
public var restrictedResourceType:RestrictedResourceType
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case xForwardedFor
case apiKey
case storeId
case memberId
case acctToken
case last4
case expMonth
case expYear
case acctType
case bnkRoute
case doNotUpdatePaymentTypePreference
case isTemp
case restrictedId
case restrictedResourceType
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
xForwardedFor = try container.decodeIfPresent(String.self, forKey: .xForwardedFor)
apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey)
storeId = try container.decodeIfPresent(Int.self, forKey: .storeId)
memberId = try container.decodeIfPresent(Int.self, forKey: .memberId)
acctToken = try container.decodeIfPresent(String.self, forKey: .acctToken)
last4 = try container.decodeIfPresent(String.self, forKey: .last4)
expMonth = try container.decodeIfPresent(Int.self, forKey: .expMonth)
expYear = try container.decodeIfPresent(Int.self, forKey: .expYear)
acctType = try container.decodeIfPresent(AcctType.self, forKey: .acctType)
bnkRoute = try container.decodeIfPresent(Int.self, forKey: .bnkRoute)
doNotUpdatePaymentTypePreference = try container.decodeIfPresent(Bool.self, forKey: .doNotUpdatePaymentTypePreference)
isTemp = try container.decodeIfPresent(Bool.self, forKey: .isTemp)
restrictedId = try container.decodeIfPresent(Int.self, forKey: .restrictedId)
restrictedResourceType = try container.decodeIfPresent(RestrictedResourceType.self, forKey: .restrictedResourceType)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if xForwardedFor != nil { try container.encode(xForwardedFor, forKey: .xForwardedFor) }
if apiKey != nil { try container.encode(apiKey, forKey: .apiKey) }
if storeId != nil { try container.encode(storeId, forKey: .storeId) }
if memberId != nil { try container.encode(memberId, forKey: .memberId) }
if acctToken != nil { try container.encode(acctToken, forKey: .acctToken) }
if last4 != nil { try container.encode(last4, forKey: .last4) }
if expMonth != nil { try container.encode(expMonth, forKey: .expMonth) }
if expYear != nil { try container.encode(expYear, forKey: .expYear) }
if acctType != nil { try container.encode(acctType, forKey: .acctType) }
if bnkRoute != nil { try container.encode(bnkRoute, forKey: .bnkRoute) }
if doNotUpdatePaymentTypePreference != nil { try container.encode(doNotUpdatePaymentTypePreference, forKey: .doNotUpdatePaymentTypePreference) }
if isTemp != nil { try container.encode(isTemp, forKey: .isTemp) }
if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
}
}
public class AddPaymentProfileResponse : Codable
{
public var success:String
public var message:String
required public init(){}
}
public enum RestrictedResourceType : String, Codable
{
case Store
case Chain
case User
case Undefined
}
public protocol IApiDtoBase
{
var apiKey:String { get set }
var storeId:Int? { get set }
var chainId:Int? { get set }
}
public protocol IRestrictedApiRequest : IApiKeyEndpoint
{
var restrictedId:Int? { get set }
var restrictedResourceType:RestrictedResourceType { get set }
}
public protocol IApiKeyEndpoint
{
var apiKey:String { get set }
}
public class ApiDtoBase : IApiDtoBase, Codable
{
public var apiKey:String
public var storeId:Int?
public var chainId:Int?
required public init(){}
}
// @DataContract
public enum AcctType : Int, Codable
{
case Uninitialized = 0
case Visa = 1
case MC = 2
case Disc = 3
case Amex = 4
case Diners = 5
case JCB = 6
case enRoute = 7
case PayPal = 8
case BillMe = 9
case PC = 11
case PS = 12
case BC = 13
case BS = 14
case Becs = 15
case Bacs = 16
case Maestro = 20
case Solo = 21
case VisaElectron = 22
case CIBC = 23
case RoyalBankCa = 24
case TDCaTrust = 25
case Scotia = 26
case BMO = 27
case HSBCCa = 28
case UnionPay = 29
case InterPayment = 30
case Laser = 31
case UnknownCredit = 40
case TransArmor = 41
case Factor4 = 42
case XPass = 43
case ConnectedAccount = 44
case UnknownBank = 45
case Error = -1
}
public class AddPaymentProfileRequest : ApiDtoBase
{
public var userId:Int
public var acctToken:String
public var last4:String
public var expMonth:Int?
public var expYear:Int?
public var acctType:AcctType?
public var bnkRoute:Int?
public var firstName:String
public var middleName:String
public var lastName:String
public var address1:String
public var address2:String
public var city:String
public var state:String
public var postalCode:String
public var countryCode:String
public var urbanization:String
public var doNotUpdatePaymentTypePreference:Bool
public var isTemp:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case userId
case acctToken
case last4
case expMonth
case expYear
case acctType
case bnkRoute
case firstName
case middleName
case lastName
case address1
case address2
case city
case state
case postalCode
case countryCode
case urbanization
case doNotUpdatePaymentTypePreference
case isTemp
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
userId = try container.decodeIfPresent(Int.self, forKey: .userId)
acctToken = try container.decodeIfPresent(String.self, forKey: .acctToken)
last4 = try container.decodeIfPresent(String.self, forKey: .last4)
expMonth = try container.decodeIfPresent(Int.self, forKey: .expMonth)
expYear = try container.decodeIfPresent(Int.self, forKey: .expYear)
acctType = try container.decodeIfPresent(AcctType.self, forKey: .acctType)
bnkRoute = try container.decodeIfPresent(Int.self, forKey: .bnkRoute)
firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
middleName = try container.decodeIfPresent(String.self, forKey: .middleName)
lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
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)
postalCode = try container.decodeIfPresent(String.self, forKey: .postalCode)
countryCode = try container.decodeIfPresent(String.self, forKey: .countryCode)
urbanization = try container.decodeIfPresent(String.self, forKey: .urbanization)
doNotUpdatePaymentTypePreference = try container.decodeIfPresent(Bool.self, forKey: .doNotUpdatePaymentTypePreference)
isTemp = try container.decodeIfPresent(Bool.self, forKey: .isTemp)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if userId != nil { try container.encode(userId, forKey: .userId) }
if acctToken != nil { try container.encode(acctToken, forKey: .acctToken) }
if last4 != nil { try container.encode(last4, forKey: .last4) }
if expMonth != nil { try container.encode(expMonth, forKey: .expMonth) }
if expYear != nil { try container.encode(expYear, forKey: .expYear) }
if acctType != nil { try container.encode(acctType, forKey: .acctType) }
if bnkRoute != nil { try container.encode(bnkRoute, forKey: .bnkRoute) }
if firstName != nil { try container.encode(firstName, forKey: .firstName) }
if middleName != nil { try container.encode(middleName, forKey: .middleName) }
if lastName != nil { try container.encode(lastName, forKey: .lastName) }
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 postalCode != nil { try container.encode(postalCode, forKey: .postalCode) }
if countryCode != nil { try container.encode(countryCode, forKey: .countryCode) }
if urbanization != nil { try container.encode(urbanization, forKey: .urbanization) }
if doNotUpdatePaymentTypePreference != nil { try container.encode(doNotUpdatePaymentTypePreference, forKey: .doNotUpdatePaymentTypePreference) }
if isTemp != nil { try container.encode(isTemp, forKey: .isTemp) }
}
}