BokaMera.API.Host

<back to all web services

CreateCompanyCreditCard

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/billing/company/creditcardAdd a new credit card with Ticket Id from payment solution.Add new credit card from payment solution with their ticket id.
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class CompanyCreditCardQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The credit card id */
        // @ApiMember(Description="The credit card id")
        /** @var int */
        public int $Id=0,

        /** @description The credit card name */
        // @ApiMember(Description="The credit card name")
        /** @var string|null */
        public ?string $Name=null,

        /** @description If the credit card is active */
        // @ApiMember(Description="If the credit card is active")
        /** @var bool|null */
        public ?bool $Active=null,

        /** @description If the credit card is valid (active and not expired) */
        // @ApiMember(Description="If the credit card is valid (active and not expired)")
        /** @var bool|null */
        public ?bool $IsValid=null,

        /** @description The credit card type */
        // @ApiMember(Description="The credit card type")
        /** @var string|null */
        public ?string $Type=null,

        /** @description The credit card expiration Year */
        // @ApiMember(Description="The credit card expiration Year")
        /** @var string|null */
        public ?string $ExpYear=null,

        /** @description The credit card expiration month */
        // @ApiMember(Description="The credit card expiration month")
        /** @var string|null */
        public ?string $ExpMonth=null,

        /** @description 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")
        /** @var string|null */
        public ?string $TicketId=null,

        /** @description The date when the credit card was saved. */
        // @ApiMember(Description="The date when the credit card was saved.")
        /** @var DateTime|null */
        public ?DateTime $Created=null,

        /** @description The date when the credit card was updated. */
        // @ApiMember(Description="The date when the credit card was updated.")
        /** @var DateTime|null */
        public ?DateTime $Updated=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['IsValid'])) $this->IsValid = $o['IsValid'];
        if (isset($o['Type'])) $this->Type = $o['Type'];
        if (isset($o['ExpYear'])) $this->ExpYear = $o['ExpYear'];
        if (isset($o['ExpMonth'])) $this->ExpMonth = $o['ExpMonth'];
        if (isset($o['TicketId'])) $this->TicketId = $o['TicketId'];
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->IsValid)) $o['IsValid'] = $this->IsValid;
        if (isset($this->Type)) $o['Type'] = $this->Type;
        if (isset($this->ExpYear)) $o['ExpYear'] = $this->ExpYear;
        if (isset($this->ExpMonth)) $o['ExpMonth'] = $this->ExpMonth;
        if (isset($this->TicketId)) $o['TicketId'] = $this->TicketId;
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateCompanyCreditCard implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description 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.")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description The credit card name */
        // @ApiMember(Description="The credit card name")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The credit card type. In example Mastercard, Visa */
        // @ApiMember(Description="The credit card type. In example Mastercard, Visa")
        /** @var string|null */
        public ?string $Type=null,

        /** @description The credit card expiration Year */
        // @ApiMember(Description="The credit card expiration Year")
        /** @var string|null */
        public ?string $ExpYear=null,

        /** @description The credit card expiration month */
        // @ApiMember(Description="The credit card expiration month")
        /** @var string|null */
        public ?string $ExpMonth=null,

        /** @description 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")
        /** @var string|null */
        public ?string $TicketId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Type'])) $this->Type = $o['Type'];
        if (isset($o['ExpYear'])) $this->ExpYear = $o['ExpYear'];
        if (isset($o['ExpMonth'])) $this->ExpMonth = $o['ExpMonth'];
        if (isset($o['TicketId'])) $this->TicketId = $o['TicketId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Type)) $o['Type'] = $this->Type;
        if (isset($this->ExpYear)) $o['ExpYear'] = $this->ExpYear;
        if (isset($this->ExpMonth)) $o['ExpMonth'] = $this->ExpMonth;
        if (isset($this->TicketId)) $o['TicketId'] = $this->TicketId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateCompanyCreditCard 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.

POST /billing/company/creditcard HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Name":"String","Type":"String","ExpYear":"String","ExpMonth":"String","TicketId":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"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"}