POST | /ClientTokenizeCard |
---|
import Foundation
import ServiceStack
// @DataContract
public class ClientTokenizeCardRequest : Codable
{
// @DataMember
public var version:String
// @DataMember
public var sessionId:String
// @DataMember
public var cardNumber:String
// @DataMember
public var expiration:String
// @DataMember
public var cvn:String
// @DataMember
public var avs:Avs
required public init(){}
}
public class Avs : Codable
{
public var address:String
public var city:String
public var state:String
public var zip:String
public var country:String
public var email:String
public var ipAddress:String
public var telephoneNumber:String
public var telephoneType:TelephoneType
public var deliveryMethod:Int
public var firstName:String
public var middleName:String
public var lastName:String
required public init(){}
}
public enum TelephoneType : String, Codable
{
case D
case H
case N
case W
}
// @DataContract
public class ClientTokenizeCard : PaysecureResponseInternal
{
// @DataMember
public var errorMessage:String
// @DataMember
public var errorCode:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case errorMessage
case errorCode
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
errorMessage = try container.decodeIfPresent(String.self, forKey: .errorMessage)
errorCode = try container.decodeIfPresent(String.self, forKey: .errorCode)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if errorMessage != nil { try container.encode(errorMessage, forKey: .errorMessage) }
if errorCode != nil { try container.encode(errorCode, forKey: .errorCode) }
}
}
// @DataContract
public class PaysecureResponseInternal : Codable
{
// @DataMember(EmitDefaultValue=false)
public var timestamps:RequestTimestamps
required public init(){}
}
// @DataContract
public class RequestTimestamps : Codable
{
// @DataMember(EmitDefaultValue=false)
public var appLayer:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var parentLookup:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var retryLookup:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var getCardData:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var cardTokenize:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var cardEncrypt:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var dbInsert:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var backendProcess:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var dbUpdate:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var parentUpdate:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var network:InOutTimes
required public init(){}
}
// @DataContract
public class InOutTimes : Codable
{
required public init(){}
}
Swift ClientTokenizeCardRequest 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 /ClientTokenizeCard HTTP/1.1
Host: api.paysecure.acculynk.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Version: String,
SessionId: String,
CardNumber: String,
Expiration: String,
CVN: String,
AVS:
{
Address: String,
City: String,
State: String,
Zip: String,
Country: String,
Email: String,
IPAddress: String,
TelephoneNumber: String,
TelephoneType: D,
DeliveryMethod: 0,
FirstName: String,
MiddleName: String,
LastName: String
}
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { ErrorMessage: String, ErrorCode: String, Timestamps: { AppLayer: { InTime: 0001-01-01, OutTime: 0001-01-01 }, ParentLookup: { InTime: 0001-01-01, OutTime: 0001-01-01 }, RetryLookup: { InTime: 0001-01-01, OutTime: 0001-01-01 }, GetCardData: { InTime: 0001-01-01, OutTime: 0001-01-01 }, CardTokenize: { InTime: 0001-01-01, OutTime: 0001-01-01 }, CardEncrypt: { InTime: 0001-01-01, OutTime: 0001-01-01 }, DBInsert: { InTime: 0001-01-01, OutTime: 0001-01-01 }, BackendProcess: { InTime: 0001-01-01, OutTime: 0001-01-01 }, DBUpdate: { InTime: 0001-01-01, OutTime: 0001-01-01 }, ParentUpdate: { InTime: 0001-01-01, OutTime: 0001-01-01 }, Network: { InTime: 0001-01-01, OutTime: 0001-01-01 } } }