BokaMera.API.Host

<back to all web services

UpdateBillingInformation

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/billing/company/Update billing information.Update billing information.
<?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 BaseModel implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

class BillingMethodCountriesRelation extends BaseModel implements JsonSerializable
{
    public function __construct(
        // @Required()
        /** @var int */
        public int $BillingMethodId=0,

        // @Required()
        /** @var string */
        public string $CountryId='',

        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['BillingMethodId'])) $this->BillingMethodId = $o['BillingMethodId'];
        if (isset($o['CountryId'])) $this->CountryId = $o['CountryId'];
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->BillingMethodId)) $o['BillingMethodId'] = $this->BillingMethodId;
        if (isset($this->CountryId)) $o['CountryId'] = $this->CountryId;
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
        return empty($o) ? new class(){} : $o;
    }
}

class BillingMethod extends BaseModel implements JsonSerializable
{
    public function __construct(
        /** @var array<BillingMethodCountriesRelation>|null */
        public ?array $BillingMethodCountriesRelation=null,
        // @Required()
        /** @var string */
        public string $Name='',

        // @Required()
        /** @var string */
        public string $Description='',

        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null,
        /** @var int */
        public int $Id=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['BillingMethodCountriesRelation'])) $this->BillingMethodCountriesRelation = JsonConverters::fromArray('BillingMethodCountriesRelation', $o['BillingMethodCountriesRelation']);
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
        if (isset($o['Id'])) $this->Id = $o['Id'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->BillingMethodCountriesRelation)) $o['BillingMethodCountriesRelation'] = JsonConverters::toArray('BillingMethodCountriesRelation', $this->BillingMethodCountriesRelation);
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
        if (isset($this->Id)) $o['Id'] = $this->Id;
        return empty($o) ? new class(){} : $o;
    }
}

class BillingInformationResponse implements JsonSerializable
{
    public function __construct(
        /** @description The company id. */
        // @ApiMember(Description="The company id.")
        /** @var string */
        public string $CompanyId='',

        /** @description The prefered billing method. */
        // @ApiMember(Description="The prefered billing method.", IsRequired=true)
        /** @var int */
        public int $BillingMethodId=0,

        /** @description The name that should be printed on the billing information, normally this would be your company name. */
        // @ApiMember(Description="The name that should be printed on the billing information, normally this would be your company name.")
        /** @var string|null */
        public ?string $Name=null,

        /** @description If you want to add the attention to the billing address. */
        // @ApiMember(Description="If you want to add the attention to the billing address.")
        /** @var string|null */
        public ?string $Attention=null,

        /** @description The street for the billing adress. This is required when having postal invoice as billing method. */
        // @ApiMember(Description="The street for the billing adress. This is required when having postal invoice as billing method.")
        /** @var string|null */
        public ?string $Street1=null,

        /** @description The street for the billing adress. */
        // @ApiMember(Description="The street for the billing adress.")
        /** @var string|null */
        public ?string $Street2=null,

        /** @description The zip code (postal code) for the billing adress. This is required when having postal invoice as billing method. */
        // @ApiMember(Description="The zip code (postal code) for the billing adress. This is required when having postal invoice as billing method.")
        /** @var string|null */
        public ?string $ZipCode=null,

        /** @description The city for the billing adress. This is required when having postal invoice as billing method. */
        // @ApiMember(Description="The city for the billing adress. This is required when having postal invoice as billing method.")
        /** @var string|null */
        public ?string $City=null,

        /** @description The country for the billing adress. This is required when having postal invoice as billing method. */
        // @ApiMember(Description="The country for the billing adress. This is required when having postal invoice as billing method.")
        /** @var string|null */
        public ?string $CountryId=null,

        /** @description The billing email. This is required when having email invoice as billing method. */
        // @ApiMember(Description="The billing email. This is required when having email invoice as billing method.")
        /** @var string|null */
        public ?string $Email=null,

        /** @description The company global location number. */
        // @ApiMember(Description="The company global location number.")
        /** @var string|null */
        public ?string $GLN=null,

        /** @description You're internal rereference. */
        // @ApiMember(Description="You're internal rereference.")
        /** @var string|null */
        public ?string $ReferenceLine1=null,

        /** @description You're internal rereference. */
        // @ApiMember(Description="You're internal rereference.")
        /** @var string|null */
        public ?string $ReferenceLine2=null,

        /** @description The billing payment terms in days. This is default 15 days. */
        // @ApiMember(Description="The billing payment terms in days. This is default 15 days.")
        /** @var int */
        public int $PaymentTermsDays=0,

        /** @description The company vat registration number. */
        // @ApiMember(Description="The company vat registration number.")
        /** @var string|null */
        public ?string $VatRegistrationNumber=null,

        /** @description The billing method options to choose from */
        // @ApiMember(Description="The billing method options to choose from")
        /** @var array<BillingMethod>|null */
        public ?array $BillingMethodOptions=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['BillingMethodId'])) $this->BillingMethodId = $o['BillingMethodId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Attention'])) $this->Attention = $o['Attention'];
        if (isset($o['Street1'])) $this->Street1 = $o['Street1'];
        if (isset($o['Street2'])) $this->Street2 = $o['Street2'];
        if (isset($o['ZipCode'])) $this->ZipCode = $o['ZipCode'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['CountryId'])) $this->CountryId = $o['CountryId'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['GLN'])) $this->GLN = $o['GLN'];
        if (isset($o['ReferenceLine1'])) $this->ReferenceLine1 = $o['ReferenceLine1'];
        if (isset($o['ReferenceLine2'])) $this->ReferenceLine2 = $o['ReferenceLine2'];
        if (isset($o['PaymentTermsDays'])) $this->PaymentTermsDays = $o['PaymentTermsDays'];
        if (isset($o['VatRegistrationNumber'])) $this->VatRegistrationNumber = $o['VatRegistrationNumber'];
        if (isset($o['BillingMethodOptions'])) $this->BillingMethodOptions = JsonConverters::fromArray('BillingMethod', $o['BillingMethodOptions']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->BillingMethodId)) $o['BillingMethodId'] = $this->BillingMethodId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Attention)) $o['Attention'] = $this->Attention;
        if (isset($this->Street1)) $o['Street1'] = $this->Street1;
        if (isset($this->Street2)) $o['Street2'] = $this->Street2;
        if (isset($this->ZipCode)) $o['ZipCode'] = $this->ZipCode;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->CountryId)) $o['CountryId'] = $this->CountryId;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->GLN)) $o['GLN'] = $this->GLN;
        if (isset($this->ReferenceLine1)) $o['ReferenceLine1'] = $this->ReferenceLine1;
        if (isset($this->ReferenceLine2)) $o['ReferenceLine2'] = $this->ReferenceLine2;
        if (isset($this->PaymentTermsDays)) $o['PaymentTermsDays'] = $this->PaymentTermsDays;
        if (isset($this->VatRegistrationNumber)) $o['VatRegistrationNumber'] = $this->VatRegistrationNumber;
        if (isset($this->BillingMethodOptions)) $o['BillingMethodOptions'] = JsonConverters::toArray('BillingMethod', $this->BillingMethodOptions);
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateBillingInformation 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 prefered billing method. */
        // @ApiMember(Description="The prefered billing method.", IsRequired=true)
        /** @var int */
        public int $BillingMethodId=0,

        /** @description The name that should be printed on the billing information, normally this would be your company name. */
        // @ApiMember(Description="The name that should be printed on the billing information, normally this would be your company name.")
        /** @var string|null */
        public ?string $Name=null,

        /** @description If you want to add the attention to the billing address. */
        // @ApiMember(Description="If you want to add the attention to the billing address.")
        /** @var string|null */
        public ?string $Attention=null,

        /** @description The street for the billing adress. This is required when having postal invoice as billing method. */
        // @ApiMember(Description="The street for the billing adress. This is required when having postal invoice as billing method.")
        /** @var string|null */
        public ?string $Street1=null,

        /** @description The street for the billing adress. */
        // @ApiMember(Description="The street for the billing adress.")
        /** @var string|null */
        public ?string $Street2=null,

        /** @description The zip code (postal code) for the billing adress. This is required when having postal invoice as billing method. */
        // @ApiMember(Description="The zip code (postal code) for the billing adress. This is required when having postal invoice as billing method.")
        /** @var string|null */
        public ?string $ZipCode=null,

        /** @description The city for the billing adress. This is required when having postal invoice as billing method. */
        // @ApiMember(Description="The city for the billing adress. This is required when having postal invoice as billing method.")
        /** @var string|null */
        public ?string $City=null,

        /** @description The country for the billing adress. This is required when having postal invoice as billing method. */
        // @ApiMember(Description="The country for the billing adress. This is required when having postal invoice as billing method.")
        /** @var string|null */
        public ?string $CountryId=null,

        /** @description The billing email. This is required when having email invoice as billing method. */
        // @ApiMember(Description="The billing email. This is required when having email invoice as billing method.")
        /** @var string|null */
        public ?string $Email=null,

        /** @description The billing payment terms in days. This is default 15 days. */
        // @ApiMember(Description="The billing payment terms in days. This is default 15 days.")
        /** @var int|null */
        public ?int $PaymentTermsDays=null,

        /** @description The company vat registration number. */
        // @ApiMember(Description="The company vat registration number.")
        /** @var string|null */
        public ?string $VatRegistrationNumber=null,

        /** @description The company global location number. */
        // @ApiMember(Description="The company global location number.")
        /** @var string|null */
        public ?string $GLN=null,

        /** @description You're internal rereference. */
        // @ApiMember(Description="You're internal rereference.")
        /** @var string|null */
        public ?string $ReferenceLine1=null,

        /** @description You're internal rereference. */
        // @ApiMember(Description="You're internal rereference.")
        /** @var string|null */
        public ?string $ReferenceLine2=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['BillingMethodId'])) $this->BillingMethodId = $o['BillingMethodId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Attention'])) $this->Attention = $o['Attention'];
        if (isset($o['Street1'])) $this->Street1 = $o['Street1'];
        if (isset($o['Street2'])) $this->Street2 = $o['Street2'];
        if (isset($o['ZipCode'])) $this->ZipCode = $o['ZipCode'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['CountryId'])) $this->CountryId = $o['CountryId'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['PaymentTermsDays'])) $this->PaymentTermsDays = $o['PaymentTermsDays'];
        if (isset($o['VatRegistrationNumber'])) $this->VatRegistrationNumber = $o['VatRegistrationNumber'];
        if (isset($o['GLN'])) $this->GLN = $o['GLN'];
        if (isset($o['ReferenceLine1'])) $this->ReferenceLine1 = $o['ReferenceLine1'];
        if (isset($o['ReferenceLine2'])) $this->ReferenceLine2 = $o['ReferenceLine2'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->BillingMethodId)) $o['BillingMethodId'] = $this->BillingMethodId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Attention)) $o['Attention'] = $this->Attention;
        if (isset($this->Street1)) $o['Street1'] = $this->Street1;
        if (isset($this->Street2)) $o['Street2'] = $this->Street2;
        if (isset($this->ZipCode)) $o['ZipCode'] = $this->ZipCode;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->CountryId)) $o['CountryId'] = $this->CountryId;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->PaymentTermsDays)) $o['PaymentTermsDays'] = $this->PaymentTermsDays;
        if (isset($this->VatRegistrationNumber)) $o['VatRegistrationNumber'] = $this->VatRegistrationNumber;
        if (isset($this->GLN)) $o['GLN'] = $this->GLN;
        if (isset($this->ReferenceLine1)) $o['ReferenceLine1'] = $this->ReferenceLine1;
        if (isset($this->ReferenceLine2)) $o['ReferenceLine2'] = $this->ReferenceLine2;
        return empty($o) ? new class(){} : $o;
    }
}

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

PUT /billing/company/ HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UpdateBillingInformation xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Attention>String</Attention>
  <BillingMethodId>0</BillingMethodId>
  <City>String</City>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <CountryId>String</CountryId>
  <Email>String</Email>
  <GLN>String</GLN>
  <Name>String</Name>
  <PaymentTermsDays>0</PaymentTermsDays>
  <ReferenceLine1>String</ReferenceLine1>
  <ReferenceLine2>String</ReferenceLine2>
  <Street1>String</Street1>
  <Street2>String</Street2>
  <VatRegistrationNumber>String</VatRegistrationNumber>
  <ZipCode>String</ZipCode>
</UpdateBillingInformation>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<BillingInformationResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Attention>String</Attention>
  <BillingMethodId>0</BillingMethodId>
  <BillingMethodOptions xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Db">
    <d2p1:BillingMethod>
      <d2p1:BillingMethodCountriesRelation>
        <d2p1:BillingMethodCountriesRelation>
          <d2p1:BillingMethodId>0</d2p1:BillingMethodId>
          <d2p1:CountryId>String</d2p1:CountryId>
          <d2p1:ModifiedDate xmlns:d6p1="http://schemas.datacontract.org/2004/07/System">
            <d6p1:DateTime>0001-01-01T00:00:00Z</d6p1:DateTime>
            <d6p1:OffsetMinutes>0</d6p1:OffsetMinutes>
          </d2p1:ModifiedDate>
        </d2p1:BillingMethodCountriesRelation>
      </d2p1:BillingMethodCountriesRelation>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:ModifiedDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
        <d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
        <d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
      </d2p1:ModifiedDate>
      <d2p1:Name>String</d2p1:Name>
    </d2p1:BillingMethod>
  </BillingMethodOptions>
  <City>String</City>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <CountryId>String</CountryId>
  <Email>String</Email>
  <GLN>String</GLN>
  <Name>String</Name>
  <PaymentTermsDays>0</PaymentTermsDays>
  <ReferenceLine1>String</ReferenceLine1>
  <ReferenceLine2>String</ReferenceLine2>
  <Street1>String</Street1>
  <Street2>String</Street2>
  <VatRegistrationNumber>String</VatRegistrationNumber>
  <ZipCode>String</ZipCode>
</BillingInformationResponse>