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 .xml suffix or ?format=xml

HTTP + XML

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/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QueryResponseOfCompanyCreditCardQueryResponseWg5EthtI xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Offset>0</Offset>
  <Total>0</Total>
  <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
    <d2p1:CompanyCreditCardQueryResponse>
      <d2p1:Active>false</d2p1:Active>
      <d2p1:Created>0001-01-01T00:00:00</d2p1:Created>
      <d2p1:ExpMonth>String</d2p1:ExpMonth>
      <d2p1:ExpYear>String</d2p1:ExpYear>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:IsValid>false</d2p1:IsValid>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:TicketId>String</d2p1:TicketId>
      <d2p1:Type>String</d2p1:Type>
      <d2p1:Updated>0001-01-01T00:00:00</d2p1:Updated>
    </d2p1:CompanyCreditCardQueryResponse>
  </Results>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
  <ResponseStatus>
    <ErrorCode>String</ErrorCode>
    <Message>String</Message>
    <StackTrace>String</StackTrace>
    <Errors>
      <ResponseError>
        <ErrorCode>String</ErrorCode>
        <FieldName>String</FieldName>
        <Message>String</Message>
        <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Meta>
      </ResponseError>
    </Errors>
    <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Meta>
  </ResponseStatus>
</QueryResponseOfCompanyCreditCardQueryResponseWg5EthtI>