BokaMera.API.Host

<back to all web services

CompanyCreditCardInformation

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, bookingsupplier-administrator-read, superadmin
The following routes are available for this service:
GET/billing/company/creditcardGet saved credit card information for the company.Get saved credit card information for the company.
import Foundation
import ServiceStack

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class CompanyCreditCardInformation : QueryDb2<CreditCard, CompanyCreditCardQueryResponse>, 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?

    /**
    * If you want to include only active credit cards
    */
    // @ApiMember(DataType="boolean", Description="If you want to include only active credit cards", ParameterType="query")
    public var active:Bool

    /**
    * If you want to include only valid credit cards (not expired and valid)
    */
    // @ApiMember(DataType="boolean", Description="If you want to include only valid credit cards (not expired and valid)", ParameterType="query")
    public var isValid:Bool

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case companyId
        case active
        case isValid
    }

    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)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        isValid = try container.decodeIfPresent(Bool.self, forKey: .isValid)
    }

    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 active != nil { try container.encode(active, forKey: .active) }
        if isValid != nil { try container.encode(isValid, forKey: .isValid) }
    }
}

public class CreditCard : BaseModel
{
    // @Ignore()
    public var isValid:Bool

    // @Required()
    public var companyId:String?

    public var id:Int
    // @Required()
    public var name:String?

    // @Required()
    public var active:Bool?

    // @Required()
    public var type:String?

    // @Required()
    public var expYear:String?

    // @Required()
    public var expMonth:String?

    // @Required()
    public var ticketId:String?

    public var updated:Date?
    public var created:Date?
    public var modifiedDate:Date?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case isValid
        case companyId
        case id
        case name
        case active
        case type
        case expYear
        case expMonth
        case ticketId
        case updated
        case created
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        isValid = try container.decodeIfPresent(Bool.self, forKey: .isValid)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        type = try container.decodeIfPresent(String.self, forKey: .type)
        expYear = try container.decodeIfPresent(String.self, forKey: .expYear)
        expMonth = try container.decodeIfPresent(String.self, forKey: .expMonth)
        ticketId = try container.decodeIfPresent(String.self, forKey: .ticketId)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        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 isValid != nil { try container.encode(isValid, forKey: .isValid) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if name != nil { try container.encode(name, forKey: .name) }
        if active != nil { try container.encode(active, forKey: .active) }
        if type != nil { try container.encode(type, forKey: .type) }
        if expYear != nil { try container.encode(expYear, forKey: .expYear) }
        if expMonth != nil { try container.encode(expMonth, forKey: .expMonth) }
        if ticketId != nil { try container.encode(ticketId, forKey: .ticketId) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class BaseModel : Codable
{
    required public init(){}
}

public class CompanyCreditCardQueryResponse : Codable
{
    /**
    * The credit card id
    */
    // @ApiMember(Description="The credit card id")
    public var id:Int

    /**
    * The credit card name
    */
    // @ApiMember(Description="The credit card name")
    public var name:String

    /**
    * If the credit card is active
    */
    // @ApiMember(Description="If the credit card is active")
    public var active:Bool

    /**
    * If the credit card is valid (active and not expired)
    */
    // @ApiMember(Description="If the credit card is valid (active and not expired)")
    public var isValid:Bool

    /**
    * The credit card type
    */
    // @ApiMember(Description="The credit card type")
    public var type:String

    /**
    * The credit card expiration Year
    */
    // @ApiMember(Description="The credit card expiration Year")
    public var expYear:String

    /**
    * The credit card expiration month
    */
    // @ApiMember(Description="The credit card expiration month")
    public var expMonth:String

    /**
    * The credit card ticket name. This is secret information and won't be displayed
    */
    // @ApiMember(Description="The credit card ticket name. This is secret information and won't be displayed")
    public var ticketId:String

    /**
    * The date when the credit card was saved.
    */
    // @ApiMember(Description="The date when the credit card was saved.")
    public var created:Date?

    /**
    * The date when the credit card was updated.
    */
    // @ApiMember(Description="The date when the credit card was updated.")
    public var updated:Date?

    required public init(){}
}

public class AccessKeyTypeResponse : Codable
{
    public var id:Int
    public var keyType:String
    public var Description:String

    required public init(){}
}


Swift CompanyCreditCardInformation DTOs

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

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /billing/company/creditcard 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,"Name":"String","Active":false,"IsValid":false,"Type":"String","ExpYear":"String","ExpMonth":"String","TicketId":"String","Created":"0001-01-01T00:00:00","Updated":"0001-01-01T00:00:00"}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}