| Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
| GET | /articles/payments | Query payment logs | Query payment logs |
|---|
import Foundation
import ServiceStack
// @ValidateRequest(Validator="IsAuthenticated")
public class PaymentLogQuery : QueryDb2<PaymentLog, PaymentLogQueryResponse>, ICompany
{
/**
* The company id, if empty will use the company id for the user you are logged in with.
*/
// @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
public var companyId:String?
/**
* Start of interval to query for payments when they where created. UTC+0 and parameter as defined by date-time - RFC3339
*/
// @ApiMember(DataType="dateTime", Description="Start of interval to query for payments when they where created. UTC+0 and parameter as defined by date-time - RFC3339", ParameterType="query")
public var createdFrom:Date?
/**
* End of interval to query for payments when they where created. UTC+0 and parameter as defined by date-time - RFC3339
*/
// @ApiMember(DataType="dateTime", Description="End of interval to query for payments when they where created. UTC+0 and parameter as defined by date-time - RFC3339", ParameterType="query")
public var createdTo:Date?
/**
* Article type (Could be Service, rebate code types, etc..
*/
// @ApiMember(Description="Article type (Could be Service, rebate code types, etc..", IsRequired=true)
public var articleTypeId:Int?
/**
*
*/
// @ApiMember(Description="")
public var includeArticleType:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case companyId
case createdFrom
case createdTo
case articleTypeId
case includeArticleType
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
createdFrom = try container.decodeIfPresent(Date.self, forKey: .createdFrom)
createdTo = try container.decodeIfPresent(Date.self, forKey: .createdTo)
articleTypeId = try container.decodeIfPresent(Int.self, forKey: .articleTypeId)
includeArticleType = try container.decodeIfPresent(Bool.self, forKey: .includeArticleType)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if companyId != nil { try container.encode(companyId, forKey: .companyId) }
if createdFrom != nil { try container.encode(createdFrom, forKey: .createdFrom) }
if createdTo != nil { try container.encode(createdTo, forKey: .createdTo) }
if articleTypeId != nil { try container.encode(articleTypeId, forKey: .articleTypeId) }
if includeArticleType != nil { try container.encode(includeArticleType, forKey: .includeArticleType) }
}
}
public class PaymentLog : BaseModel
{
// @References(typeof(Currency))
public var currencyId:String
public var currencyInfo:Currency
// @Required()
public var companyId:String?
public var id:Int
// @Required()
public var internalReferenceId:String?
// @Required()
public var articleTypeId:Int?
public var paymentReferenceId:String
public var paymentProviderId:Int?
public var orderItemReferenceId:String
public var amount:Double?
public var vat:Double?
public var amountCredited:Double?
public var comments:String
// @Required()
public var created:Date?
// @Required()
public var updated:Date?
public var modifiedDate:Date?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case currencyId
case currencyInfo
case companyId
case id
case internalReferenceId
case articleTypeId
case paymentReferenceId
case paymentProviderId
case orderItemReferenceId
case amount
case vat
case amountCredited
case comments
case created
case updated
case modifiedDate
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
currencyId = try container.decodeIfPresent(String.self, forKey: .currencyId)
currencyInfo = try container.decodeIfPresent(Currency.self, forKey: .currencyInfo)
companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
id = try container.decodeIfPresent(Int.self, forKey: .id)
internalReferenceId = try container.decodeIfPresent(String.self, forKey: .internalReferenceId)
articleTypeId = try container.decodeIfPresent(Int.self, forKey: .articleTypeId)
paymentReferenceId = try container.decodeIfPresent(String.self, forKey: .paymentReferenceId)
paymentProviderId = try container.decodeIfPresent(Int.self, forKey: .paymentProviderId)
orderItemReferenceId = try container.decodeIfPresent(String.self, forKey: .orderItemReferenceId)
amount = try container.decodeIfPresent(Double.self, forKey: .amount)
vat = try container.decodeIfPresent(Double.self, forKey: .vat)
amountCredited = try container.decodeIfPresent(Double.self, forKey: .amountCredited)
comments = try container.decodeIfPresent(String.self, forKey: .comments)
created = try container.decodeIfPresent(Date.self, forKey: .created)
updated = try container.decodeIfPresent(Date.self, forKey: .updated)
modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if currencyId != nil { try container.encode(currencyId, forKey: .currencyId) }
if currencyInfo != nil { try container.encode(currencyInfo, forKey: .currencyInfo) }
if companyId != nil { try container.encode(companyId, forKey: .companyId) }
if id != nil { try container.encode(id, forKey: .id) }
if internalReferenceId != nil { try container.encode(internalReferenceId, forKey: .internalReferenceId) }
if articleTypeId != nil { try container.encode(articleTypeId, forKey: .articleTypeId) }
if paymentReferenceId != nil { try container.encode(paymentReferenceId, forKey: .paymentReferenceId) }
if paymentProviderId != nil { try container.encode(paymentProviderId, forKey: .paymentProviderId) }
if orderItemReferenceId != nil { try container.encode(orderItemReferenceId, forKey: .orderItemReferenceId) }
if amount != nil { try container.encode(amount, forKey: .amount) }
if vat != nil { try container.encode(vat, forKey: .vat) }
if amountCredited != nil { try container.encode(amountCredited, forKey: .amountCredited) }
if comments != nil { try container.encode(comments, forKey: .comments) }
if created != nil { try container.encode(created, forKey: .created) }
if updated != nil { try container.encode(updated, forKey: .updated) }
if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
}
}
public class BaseModel : Codable
{
required public init(){}
}
public class Currency : BaseModel
{
// @Required()
public var name:String?
// @Required()
public var currencySign:String?
// @Required()
public var active:Bool?
public var modifiedDate:Date?
// @Required()
public var id:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case name
case currencySign
case active
case modifiedDate
case id
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
name = try container.decodeIfPresent(String.self, forKey: .name)
currencySign = try container.decodeIfPresent(String.self, forKey: .currencySign)
active = try container.decodeIfPresent(Bool.self, forKey: .active)
modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
id = try container.decodeIfPresent(String.self, forKey: .id)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if name != nil { try container.encode(name, forKey: .name) }
if currencySign != nil { try container.encode(currencySign, forKey: .currencySign) }
if active != nil { try container.encode(active, forKey: .active) }
if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
if id != nil { try container.encode(id, forKey: .id) }
}
}
public class PaymentLogQueryResponse : Codable
{
/**
* The payment log id
*/
// @ApiMember(Description="The payment log id")
public var id:Int
/**
* The internal reference id, could be reference to a booking, rebate code, gift card etc.
*/
// @ApiMember(Description="The internal reference id, could be reference to a booking, rebate code, gift card etc.")
public var internalReference:Int
/**
* The payment reference id
*/
// @ApiMember(Description="The payment reference id")
public var paymentReferenceId:String
/**
* The payment order item reference id
*/
// @ApiMember(Description="The payment order item reference id")
public var orderItemReferenceId:String
/**
* The payment reference id
*/
// @ApiMember(Description="The payment reference id")
public var paymentProviderId:Int?
/**
* The payment amount
*/
// @ApiMember(Description="The payment amount")
public var amount:Double
/**
* The article type
*/
// @ApiMember(Description="The article type")
public var articleType:ArticleType
/**
* The payment VAT in percent
*/
// @ApiMember(Description="The payment VAT in percent")
public var vat:Double
/**
* The payment amount that is credited
*/
// @ApiMember(Description="The payment amount that is credited")
public var amountCredited:Double
/**
* The payment currency id
*/
// @ApiMember(Description="The payment currency id")
public var currencyId:String
/**
* The payment currency info
*/
// @ApiMember(Description="The payment currency info")
public var currencyInfo:CurrencyInfoResponse
/**
* Comments that could be added to the event log item
*/
// @ApiMember(Description="Comments that could be added to the event log item")
public var comments:String
/**
* The date when the payment items was created
*/
// @ApiMember(Description="The date when the payment items was created")
public var created:Date
/**
* The date when the payment items were updated.
*/
// @ApiMember(Description="The date when the payment items were updated.")
public var updated:Date
required public init(){}
}
public class ArticleType : BaseModel
{
public var articleTypeId:Int
// @Required()
public var articleTypeName:String?
public var articleTypeDescription:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case articleTypeId
case articleTypeName
case articleTypeDescription
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
articleTypeId = try container.decodeIfPresent(Int.self, forKey: .articleTypeId)
articleTypeName = try container.decodeIfPresent(String.self, forKey: .articleTypeName)
articleTypeDescription = try container.decodeIfPresent(String.self, forKey: .articleTypeDescription)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if articleTypeId != nil { try container.encode(articleTypeId, forKey: .articleTypeId) }
if articleTypeName != nil { try container.encode(articleTypeName, forKey: .articleTypeName) }
if articleTypeDescription != nil { try container.encode(articleTypeDescription, forKey: .articleTypeDescription) }
}
}
public class CurrencyInfoResponse : Codable
{
/**
* The currency id
*/
// @ApiMember(Description="The currency id")
public var id:String
/**
* The currency id
*/
// @ApiMember(Description="The currency id")
public var name:String
/**
* The currency id
*/
// @ApiMember(Description="The currency id")
public var currencySign:String
required public init(){}
}
public class AccessKeyTypeResponse : Codable
{
public var id:Int
public var keyType:String
public var Description:String
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /articles/payments HTTP/1.1 Host: api.bokamera.se Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"Offset":0,"Total":0,"Results":[{"Id":0,"InternalReference":0,"PaymentReferenceId":"String","OrderItemReferenceId":"String","PaymentProviderId":0,"Amount":0,"ArticleType":{"ArticleTypeId":0,"ArticleTypeName":"String","ArticleTypeDescription":"String"},"VAT":0,"AmountCredited":0,"CurrencyId":"String","CurrencyInfo":{"Id":"String","Name":"String","CurrencySign":"String"},"Comments":"String"}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}