import Foundation
import ServiceStack
public class ccPaymentByGroup : ccPaymentByGroup, ICanBeRecurring
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
// @DataContract(Namespace="www.billhighway.com/api")
public class ccPaymentByGroupResponse : LegacyApiResponse
{
// @DataMember(Name="ccPaymentByGroupResult")
public var results:SoapArrayList?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case results
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
results = try container.decodeIfPresent(SoapArrayList.self, forKey: .results)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if results != nil { try container.encode(results, forKey: .results) }
}
}
// @DataContract(Namespace="www.billhighway.com/api")
public class LegacyApiResponse : IHaveErrorField, Codable
{
// @DataMember
public var amount:Double?
// @DataMember
public var confirmationNumber:String?
// @DataMember
public var responseCode:String?
// @DataMember
public var responseDescription:String?
// @DataMember
public var resultCode:ResultCode?
required public init(){}
}
public enum ResultCode : Int, Codable
{
case Success = 0
case Duplicate = -7
case NotAvailable = -6
case NotFound = -5
case GeneralError = -4
case UnexpectedError = -3
case CreditCardDeclined = -2
case DataValidationFailure = -1
}
public class SoapArrayList : ArrayList
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
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 /jsv/reply/ccPaymentByGroup HTTP/1.1
Host: devapi.billhighway.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
apiKey: String,
featureID: 0,
clientID: 0,
groupID: 0,
Amount: 0,
nameOnCard: String,
cardType: String,
cardNumber: String,
expMonth: String,
expYear: String,
cvv: String,
address: String,
city: String,
state: String,
postalCode: String,
email: String,
memo: String,
occurs: String,
numberOfOccurrences: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ccPaymentByGroupResult:
[
0,
0,
0,
String,
String,
0
],
amount: 0,
confirmationNumber: String,
responseCode: String,
responseDescription: String,
resultCode: 0
}