Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
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 .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
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/json
Content-Type: application/json
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","BillingMethodId":0,"Name":"String","Attention":"String","Street1":"String","Street2":"String","ZipCode":"String","City":"String","CountryId":"String","Email":"String","PaymentTermsDays":0,"VatRegistrationNumber":"String","GLN":"String","ReferenceLine1":"String","ReferenceLine2":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"BillingMethodId":0,"Name":"String","Attention":"String","Street1":"String","Street2":"String","ZipCode":"String","City":"String","CountryId":"String","Email":"String","GLN":"String","ReferenceLine1":"String","ReferenceLine2":"String","PaymentTermsDays":0,"VatRegistrationNumber":"String","BillingMethodOptions":[{"BillingMethodCountriesRelation":[{"BillingMethodId":0,"CountryId":"String","ModifiedDate":"0001-01-01T00:00:00.0000000+00:00"}],"Name":"String","Description":"String","ModifiedDate":"0001-01-01T00:00:00.0000000+00:00","Id":0}]}