BokaMera.API.Host

<back to all web services

CompanyBillingInformation

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class CompanyBillingInformation : QueryDb2<BillingInformation, BillingMethodQueryResponse>
{
    /**
    * 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 the billing methods to select from
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the billing methods to select from", ParameterType="query")
    public var includeBillingMethodOptions:Bool

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case includeBillingMethodOptions
    }

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

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

public class BillingInformation : BaseModel
{
    public var billingMethod:BillingMethod
    // @Required()
    public var billingMethodId:Int?

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

    public var attention:String
    public var street1:String
    public var street2:String
    public var zipCode:String
    public var city:String
    public var email:String
    public var creditCard:String
    public var creditCardHolder:String
    public var creditCardNumber:String
    public var validToYear:Int16?
    public var validToMonth:Int16?
    public var csv:String
    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

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

    // @Required()
    public var paymentTermsDays:Int?

    public var vatRegistrationNumber:String
    public var gln:String
    public var referenceLine1:String
    public var referenceLine2:String
    public var modifiedDate:Date?
    // @Required()
    public var id:String?

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

    private enum CodingKeys : String, CodingKey {
        case billingMethod
        case billingMethodId
        case name
        case attention
        case street1
        case street2
        case zipCode
        case city
        case email
        case creditCard
        case creditCardHolder
        case creditCardNumber
        case validToYear
        case validToMonth
        case csv
        case updated
        case created
        case countryId
        case paymentTermsDays
        case vatRegistrationNumber
        case gln
        case referenceLine1
        case referenceLine2
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        billingMethod = try container.decodeIfPresent(BillingMethod.self, forKey: .billingMethod)
        billingMethodId = try container.decodeIfPresent(Int.self, forKey: .billingMethodId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        attention = try container.decodeIfPresent(String.self, forKey: .attention)
        street1 = try container.decodeIfPresent(String.self, forKey: .street1)
        street2 = try container.decodeIfPresent(String.self, forKey: .street2)
        zipCode = try container.decodeIfPresent(String.self, forKey: .zipCode)
        city = try container.decodeIfPresent(String.self, forKey: .city)
        email = try container.decodeIfPresent(String.self, forKey: .email)
        creditCard = try container.decodeIfPresent(String.self, forKey: .creditCard)
        creditCardHolder = try container.decodeIfPresent(String.self, forKey: .creditCardHolder)
        creditCardNumber = try container.decodeIfPresent(String.self, forKey: .creditCardNumber)
        validToYear = try container.decodeIfPresent(Int16.self, forKey: .validToYear)
        validToMonth = try container.decodeIfPresent(Int16.self, forKey: .validToMonth)
        csv = try container.decodeIfPresent(String.self, forKey: .csv)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
        paymentTermsDays = try container.decodeIfPresent(Int.self, forKey: .paymentTermsDays)
        vatRegistrationNumber = try container.decodeIfPresent(String.self, forKey: .vatRegistrationNumber)
        gln = try container.decodeIfPresent(String.self, forKey: .gln)
        referenceLine1 = try container.decodeIfPresent(String.self, forKey: .referenceLine1)
        referenceLine2 = try container.decodeIfPresent(String.self, forKey: .referenceLine2)
        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 billingMethod != nil { try container.encode(billingMethod, forKey: .billingMethod) }
        if billingMethodId != nil { try container.encode(billingMethodId, forKey: .billingMethodId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if attention != nil { try container.encode(attention, forKey: .attention) }
        if street1 != nil { try container.encode(street1, forKey: .street1) }
        if street2 != nil { try container.encode(street2, forKey: .street2) }
        if zipCode != nil { try container.encode(zipCode, forKey: .zipCode) }
        if city != nil { try container.encode(city, forKey: .city) }
        if email != nil { try container.encode(email, forKey: .email) }
        if creditCard != nil { try container.encode(creditCard, forKey: .creditCard) }
        if creditCardHolder != nil { try container.encode(creditCardHolder, forKey: .creditCardHolder) }
        if creditCardNumber != nil { try container.encode(creditCardNumber, forKey: .creditCardNumber) }
        if validToYear != nil { try container.encode(validToYear, forKey: .validToYear) }
        if validToMonth != nil { try container.encode(validToMonth, forKey: .validToMonth) }
        if csv != nil { try container.encode(csv, forKey: .csv) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if countryId != nil { try container.encode(countryId, forKey: .countryId) }
        if paymentTermsDays != nil { try container.encode(paymentTermsDays, forKey: .paymentTermsDays) }
        if vatRegistrationNumber != nil { try container.encode(vatRegistrationNumber, forKey: .vatRegistrationNumber) }
        if gln != nil { try container.encode(gln, forKey: .gln) }
        if referenceLine1 != nil { try container.encode(referenceLine1, forKey: .referenceLine1) }
        if referenceLine2 != nil { try container.encode(referenceLine2, forKey: .referenceLine2) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

public class BillingMethod : BaseModel
{
    public var billingMethodCountriesRelation:[BillingMethodCountriesRelation] = []
    // @Required()
    public var name:String?

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case billingMethodCountriesRelation
        case name
        case Description
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        billingMethodCountriesRelation = try container.decodeIfPresent([BillingMethodCountriesRelation].self, forKey: .billingMethodCountriesRelation) ?? []
        name = try container.decodeIfPresent(String.self, forKey: .name)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if billingMethodCountriesRelation.count > 0 { try container.encode(billingMethodCountriesRelation, forKey: .billingMethodCountriesRelation) }
        if name != nil { try container.encode(name, forKey: .name) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class BillingMethodCountriesRelation : BaseModel
{
    // @Required()
    public var billingMethodId:Int?

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

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case billingMethodId
        case countryId
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        billingMethodId = try container.decodeIfPresent(Int.self, forKey: .billingMethodId)
        countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
        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 billingMethodId != nil { try container.encode(billingMethodId, forKey: .billingMethodId) }
        if countryId != nil { try container.encode(countryId, forKey: .countryId) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class BillingMethodQueryResponse : Codable
{
    /**
    * The billing method id
    */
    // @ApiMember(Description="The billing method id")
    public var id:Int

    /**
    * The billing method name
    */
    // @ApiMember(Description="The billing method name")
    public var name:String

    /**
    * The billing method description
    */
    // @ApiMember(Description="The billing method description")
    public var Description:String

    /**
    * The billing method is valid for the following countries
    */
    // @ApiMember(Description="The billing method is valid for the following countries")
    public var countries:[String] = []

    required public init(){}
}

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

    required public init(){}
}


Swift CompanyBillingInformation DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

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

GET /billing/company HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Offset":0,"Total":0,"Results":[{"Id":0,"Name":"String","Description":"String","Countries":["String"]}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}