POST | /TransactionStatus |
---|
import Foundation
import ServiceStack
// @DataContract
public class TransactionStatusRequest : Codable
{
// @DataMember
public var credentials:RequestorCredentials
// @DataMember
public var originalData:OriginalTransaction
required public init(){}
}
public class RequestorCredentials : Codable
{
// @Required()
public var merchantId:String?
// @Required()
public var userName:String?
// @Required()
public var password:String?
// @Required()
public var version:String?
required public init(){}
}
public class OriginalTransaction : Codable
{
public var originalIdentifierType:OriginalDataType
public var originalDataIdentifier:String
required public init(){}
}
public enum OriginalDataType : Int, Codable
{
case TransactionId = 1
case ReferenceKey = 2
case ExternalId = 3
case InternalTransactionId = 4
}
// @DataContract
public class TransactionStatus : PaysecureResponseInternal
{
// @DataMember
public var history:Transaction
// @DataMember
public var errorMessage:String
// @DataMember
public var errorCode:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case history
case errorMessage
case errorCode
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
history = try container.decodeIfPresent(Transaction.self, forKey: .history)
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 history != nil { try container.encode(history, forKey: .history) }
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(){}
}
public class Transaction : Codable
{
public var tranId:String
public var status:String
public var approvalCode:String
public var responseCode:String
public var transactionDT:String
public var transactionAmount:Int
public var network:String
public var approvedAmount:Int
public var openAmount:Int
public var parentTranId:String
public var externalIds:[String] = []
public var localDateTime:String
public var currencyCode:String
public var avs:String
public var cvn:String
required public init(){}
}
Swift TransactionStatusRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /TransactionStatus HTTP/1.1
Host: api.paysecure.acculynk.net
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<TransactionStatusRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<Credentials>
<MerchantId>String</MerchantId>
<Password>String</Password>
<UserName>String</UserName>
<Version>String</Version>
</Credentials>
<OriginalData>
<OriginalDataIdentifier>String</OriginalDataIdentifier>
<OriginalIdentifierType>TransactionId</OriginalIdentifierType>
</OriginalData>
</TransactionStatusRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <TransactionStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> <Timestamps> <AppLayer> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </AppLayer> <BackendProcess> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </BackendProcess> <CardEncrypt> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </CardEncrypt> <CardTokenize> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </CardTokenize> <DBInsert> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </DBInsert> <DBUpdate> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </DBUpdate> <GetCardData> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </GetCardData> <Network> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </Network> <ParentLookup> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </ParentLookup> <ParentUpdate> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </ParentUpdate> <RetryLookup> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </RetryLookup> </Timestamps> <ErrorCode>String</ErrorCode> <ErrorMessage>String</ErrorMessage> <History> <AVS>String</AVS> <ApprovalCode>String</ApprovalCode> <ApprovedAmount>0</ApprovedAmount> <CVN>String</CVN> <CurrencyCode>String</CurrencyCode> <ExternalIds xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:string>String</d3p1:string> </ExternalIds> <LocalDateTime>String</LocalDateTime> <Network>String</Network> <OpenAmount>0</OpenAmount> <ParentTranId>String</ParentTranId> <ResponseCode>String</ResponseCode> <Status>String</Status> <TranId>String</TranId> <TransactionAmount>0</TransactionAmount> <TransactionDT>String</TransactionDT> </History> </TransactionStatus>