BokaMera.API.Host

<back to all web services

CreateInvoice

The following routes are available for this service:
POST/eaccounting/invoice
<?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 InvoiceAddress implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CorporateIdentityNumber=null,
        /** @var string|null */
        public ?string $InvoiceAddress1=null,
        /** @var string|null */
        public ?string $InvoiceAddress2=null,
        /** @var string|null */
        public ?string $InvoiceCity=null,
        /** @var string|null */
        public ?string $InvoicePostalCode=null,
        /** @var string|null */
        public ?string $InvoiceCountryCode=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CorporateIdentityNumber'])) $this->CorporateIdentityNumber = $o['CorporateIdentityNumber'];
        if (isset($o['InvoiceAddress1'])) $this->InvoiceAddress1 = $o['InvoiceAddress1'];
        if (isset($o['InvoiceAddress2'])) $this->InvoiceAddress2 = $o['InvoiceAddress2'];
        if (isset($o['InvoiceCity'])) $this->InvoiceCity = $o['InvoiceCity'];
        if (isset($o['InvoicePostalCode'])) $this->InvoicePostalCode = $o['InvoicePostalCode'];
        if (isset($o['InvoiceCountryCode'])) $this->InvoiceCountryCode = $o['InvoiceCountryCode'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CorporateIdentityNumber)) $o['CorporateIdentityNumber'] = $this->CorporateIdentityNumber;
        if (isset($this->InvoiceAddress1)) $o['InvoiceAddress1'] = $this->InvoiceAddress1;
        if (isset($this->InvoiceAddress2)) $o['InvoiceAddress2'] = $this->InvoiceAddress2;
        if (isset($this->InvoiceCity)) $o['InvoiceCity'] = $this->InvoiceCity;
        if (isset($this->InvoicePostalCode)) $o['InvoicePostalCode'] = $this->InvoicePostalCode;
        if (isset($this->InvoiceCountryCode)) $o['InvoiceCountryCode'] = $this->InvoiceCountryCode;
        return empty($o) ? new class(){} : $o;
    }
}

enum GreenTechnologyType : string
{
    case None = 'None';
    case SolarCellInstallation = 'SolarCellInstallation';
    case ElectricEnergyStorageInstallation = 'ElectricEnergyStorageInstallation';
    case ElectricVehicleChargingPointInstallation = 'ElectricVehicleChargingPointInstallation';
}

class ContributionMargin implements JsonSerializable
{
    public function __construct(
        /** @var int|null */
        public ?int $Amount=null,
        /** @var int|null */
        public ?int $Percentage=null
    ) {
    }

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

class InvoiceLineQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ArticleNumber=null,
        /** @var string|null */
        public ?string $ArticleId=null,
        /** @var bool|null */
        public ?bool $IsServiceArticle=null,
        /** @var float */
        public float $AmountNoVat=0.0,
        /** @var float|null */
        public ?float $PercentVat=null,
        /** @var int */
        public int $LineNumber=0,
        /** @var bool|null */
        public ?bool $IsTextRow=null,
        /** @var string|null */
        public ?string $Text=null,
        /** @var float */
        public float $UnitPrice=0.0,
        /** @var string|null */
        public ?string $UnitAbbreviation=null,
        /** @var string|null */
        public ?string $UnitAbbreviationEnglish=null,
        /** @var float */
        public float $DiscountPercentage=0.0,
        /** @var float */
        public float $Quantity=0.0,
        /** @var bool|null */
        public ?bool $IsWorkCost=null,
        /** @var bool|null */
        public ?bool $IsVatFree=null,
        /** @var string|null */
        public ?string $CostCenterItemId1=null,
        /** @var string|null */
        public ?string $CostCenterItemId2=null,
        /** @var string|null */
        public ?string $CostCenterItemId3=null,
        /** @var string|null */
        public ?string $UnitId=null,
        /** @var string|null */
        public ?string $ProjectId=null,
        /** @var int|null */
        public ?int $WorkCostType=null,
        /** @var float|null */
        public ?float $WorkHours=null,
        /** @var float|null */
        public ?float $MaterialCosts=null,
        /** @var GreenTechnologyType|null */
        public ?GreenTechnologyType $GreenTechnologyType=null,
        /** @var ContributionMargin|null */
        public ?ContributionMargin $ContributionMargin=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ArticleNumber'])) $this->ArticleNumber = $o['ArticleNumber'];
        if (isset($o['ArticleId'])) $this->ArticleId = $o['ArticleId'];
        if (isset($o['IsServiceArticle'])) $this->IsServiceArticle = $o['IsServiceArticle'];
        if (isset($o['AmountNoVat'])) $this->AmountNoVat = $o['AmountNoVat'];
        if (isset($o['PercentVat'])) $this->PercentVat = $o['PercentVat'];
        if (isset($o['LineNumber'])) $this->LineNumber = $o['LineNumber'];
        if (isset($o['IsTextRow'])) $this->IsTextRow = $o['IsTextRow'];
        if (isset($o['Text'])) $this->Text = $o['Text'];
        if (isset($o['UnitPrice'])) $this->UnitPrice = $o['UnitPrice'];
        if (isset($o['UnitAbbreviation'])) $this->UnitAbbreviation = $o['UnitAbbreviation'];
        if (isset($o['UnitAbbreviationEnglish'])) $this->UnitAbbreviationEnglish = $o['UnitAbbreviationEnglish'];
        if (isset($o['DiscountPercentage'])) $this->DiscountPercentage = $o['DiscountPercentage'];
        if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
        if (isset($o['IsWorkCost'])) $this->IsWorkCost = $o['IsWorkCost'];
        if (isset($o['IsVatFree'])) $this->IsVatFree = $o['IsVatFree'];
        if (isset($o['CostCenterItemId1'])) $this->CostCenterItemId1 = $o['CostCenterItemId1'];
        if (isset($o['CostCenterItemId2'])) $this->CostCenterItemId2 = $o['CostCenterItemId2'];
        if (isset($o['CostCenterItemId3'])) $this->CostCenterItemId3 = $o['CostCenterItemId3'];
        if (isset($o['UnitId'])) $this->UnitId = $o['UnitId'];
        if (isset($o['ProjectId'])) $this->ProjectId = $o['ProjectId'];
        if (isset($o['WorkCostType'])) $this->WorkCostType = $o['WorkCostType'];
        if (isset($o['WorkHours'])) $this->WorkHours = $o['WorkHours'];
        if (isset($o['MaterialCosts'])) $this->MaterialCosts = $o['MaterialCosts'];
        if (isset($o['GreenTechnologyType'])) $this->GreenTechnologyType = JsonConverters::from('GreenTechnologyType', $o['GreenTechnologyType']);
        if (isset($o['ContributionMargin'])) $this->ContributionMargin = JsonConverters::from('ContributionMargin', $o['ContributionMargin']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ArticleNumber)) $o['ArticleNumber'] = $this->ArticleNumber;
        if (isset($this->ArticleId)) $o['ArticleId'] = $this->ArticleId;
        if (isset($this->IsServiceArticle)) $o['IsServiceArticle'] = $this->IsServiceArticle;
        if (isset($this->AmountNoVat)) $o['AmountNoVat'] = $this->AmountNoVat;
        if (isset($this->PercentVat)) $o['PercentVat'] = $this->PercentVat;
        if (isset($this->LineNumber)) $o['LineNumber'] = $this->LineNumber;
        if (isset($this->IsTextRow)) $o['IsTextRow'] = $this->IsTextRow;
        if (isset($this->Text)) $o['Text'] = $this->Text;
        if (isset($this->UnitPrice)) $o['UnitPrice'] = $this->UnitPrice;
        if (isset($this->UnitAbbreviation)) $o['UnitAbbreviation'] = $this->UnitAbbreviation;
        if (isset($this->UnitAbbreviationEnglish)) $o['UnitAbbreviationEnglish'] = $this->UnitAbbreviationEnglish;
        if (isset($this->DiscountPercentage)) $o['DiscountPercentage'] = $this->DiscountPercentage;
        if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
        if (isset($this->IsWorkCost)) $o['IsWorkCost'] = $this->IsWorkCost;
        if (isset($this->IsVatFree)) $o['IsVatFree'] = $this->IsVatFree;
        if (isset($this->CostCenterItemId1)) $o['CostCenterItemId1'] = $this->CostCenterItemId1;
        if (isset($this->CostCenterItemId2)) $o['CostCenterItemId2'] = $this->CostCenterItemId2;
        if (isset($this->CostCenterItemId3)) $o['CostCenterItemId3'] = $this->CostCenterItemId3;
        if (isset($this->UnitId)) $o['UnitId'] = $this->UnitId;
        if (isset($this->ProjectId)) $o['ProjectId'] = $this->ProjectId;
        if (isset($this->WorkCostType)) $o['WorkCostType'] = $this->WorkCostType;
        if (isset($this->WorkHours)) $o['WorkHours'] = $this->WorkHours;
        if (isset($this->MaterialCosts)) $o['MaterialCosts'] = $this->MaterialCosts;
        if (isset($this->GreenTechnologyType)) $o['GreenTechnologyType'] = JsonConverters::to('GreenTechnologyType', $this->GreenTechnologyType);
        if (isset($this->ContributionMargin)) $o['ContributionMargin'] = JsonConverters::to('ContributionMargin', $this->ContributionMargin);
        return empty($o) ? new class(){} : $o;
    }
}

class VatSpecificationQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var float */
        public float $AmountInvoiceCurrency=0.0,
        /** @var float */
        public float $VatAmountInvoiceCurrency=0.0,
        /** @var float */
        public float $VatPercent=0.0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AmountInvoiceCurrency'])) $this->AmountInvoiceCurrency = $o['AmountInvoiceCurrency'];
        if (isset($o['VatAmountInvoiceCurrency'])) $this->VatAmountInvoiceCurrency = $o['VatAmountInvoiceCurrency'];
        if (isset($o['VatPercent'])) $this->VatPercent = $o['VatPercent'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AmountInvoiceCurrency)) $o['AmountInvoiceCurrency'] = $this->AmountInvoiceCurrency;
        if (isset($this->VatAmountInvoiceCurrency)) $o['VatAmountInvoiceCurrency'] = $this->VatAmountInvoiceCurrency;
        if (isset($this->VatPercent)) $o['VatPercent'] = $this->VatPercent;
        return empty($o) ? new class(){} : $o;
    }
}

class Person implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Ssn=null,
        /** @var int */
        public int $Amount=0
    ) {
    }

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

class EAccountingTermsOfPaymentQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Id=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $NameEnglish=null,
        /** @var int */
        public int $NumberOfDays=0,
        /** @var int */
        public int $TermsOfPaymentTypeId=0,
        /** @var string|null */
        public ?string $TermsOfPaymentTypeText=null,
        /** @var bool|null */
        public ?bool $AvailableForSales=null,
        /** @var bool|null */
        public ?bool $AvailableForPurchase=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['NameEnglish'])) $this->NameEnglish = $o['NameEnglish'];
        if (isset($o['NumberOfDays'])) $this->NumberOfDays = $o['NumberOfDays'];
        if (isset($o['TermsOfPaymentTypeId'])) $this->TermsOfPaymentTypeId = $o['TermsOfPaymentTypeId'];
        if (isset($o['TermsOfPaymentTypeText'])) $this->TermsOfPaymentTypeText = $o['TermsOfPaymentTypeText'];
        if (isset($o['AvailableForSales'])) $this->AvailableForSales = $o['AvailableForSales'];
        if (isset($o['AvailableForPurchase'])) $this->AvailableForPurchase = $o['AvailableForPurchase'];
    }
    
    /** @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->NameEnglish)) $o['NameEnglish'] = $this->NameEnglish;
        if (isset($this->NumberOfDays)) $o['NumberOfDays'] = $this->NumberOfDays;
        if (isset($this->TermsOfPaymentTypeId)) $o['TermsOfPaymentTypeId'] = $this->TermsOfPaymentTypeId;
        if (isset($this->TermsOfPaymentTypeText)) $o['TermsOfPaymentTypeText'] = $this->TermsOfPaymentTypeText;
        if (isset($this->AvailableForSales)) $o['AvailableForSales'] = $this->AvailableForSales;
        if (isset($this->AvailableForPurchase)) $o['AvailableForPurchase'] = $this->AvailableForPurchase;
        return empty($o) ? new class(){} : $o;
    }
}

class NoteQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Id=null,
        /** @var string|null */
        public ?string $Text=null,
        /** @var DateTime */
        public DateTime $CreatedUtc=new DateTime(),
        /** @var DateTime */
        public DateTime $ModifiedUtc=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Text'])) $this->Text = $o['Text'];
        if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
        if (isset($o['ModifiedUtc'])) $this->ModifiedUtc = JsonConverters::from('DateTime', $o['ModifiedUtc']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Text)) $o['Text'] = $this->Text;
        if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
        if (isset($this->ModifiedUtc)) $o['ModifiedUtc'] = JsonConverters::to('DateTime', $this->ModifiedUtc);
        return empty($o) ? new class(){} : $o;
    }
}

enum EAccountingInvoiceSendTypes : string
{
    case None = 'None';
    case AutoInvoiceElectronic = 'AutoInvoiceElectronic';
    case AutoInvoicePrint = 'AutoInvoicePrint';
    case AutoInvoiceB2C = 'AutoInvoiceB2C';
}

enum PaymentStatus : string
{
    case Paid = 'Paid';
    case Unpaid = 'Unpaid';
    case Overdue = 'Overdue';
}

class CreditedBy implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CreditInvoiceId=null
    ) {
    }

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

class InvoiceQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $InvoiceId='',
        /** @var DateTime */
        public DateTime $CreatedDate=new DateTime(),
        /** @var float */
        public float $TotalAmount=0.0,
        /** @var float */
        public float $TotalVatAmount=0.0,
        /** @var string|null */
        public ?string $CustomerId=null,
        /** @var array<InvoiceLineQueryResponse>|null */
        public ?array $Rows=null,
        /** @var array<VatSpecificationQueryResponse>|null */
        public ?array $VatSpecification=null,
        /** @var string|null */
        public ?string $InvoiceDate=null,
        /** @var string|null */
        public ?string $DueDate=null,
        /** @var DateTime|null */
        public ?DateTime $DeliveryDate=null,
        /** @var array<Person>|null */
        public ?array $Persons=null,
        /** @var string|null */
        public ?string $InvoiceCustomerName=null,
        /** @var InvoiceAddress|null */
        public ?InvoiceAddress $InvoiceAddress=null,
        /** @var bool|null */
        public ?bool $CustomerIsPrivatePerson=null,
        /** @var string|null */
        public ?string $TermsOfPaymentId=null,
        /** @var EAccountingTermsOfPaymentQueryResponse|null */
        public ?EAccountingTermsOfPaymentQueryResponse $TermsOfPaymentData=null,
        /** @var string|null */
        public ?string $CustomerEmail=null,
        /** @var int */
        public int $InvoiceNumber=0,
        /** @var string|null */
        public ?string $CustomerNumber=null,
        /** @var array<NoteQueryResponse>|null */
        public ?array $Notes=null,
        /** @var array<string>|null */
        public ?array $NoteIds=null,
        /** @var DateTime */
        public DateTime $CreatedUtc=new DateTime(),
        /** @var DateTime */
        public DateTime $ModifiedUtc=new DateTime(),
        /** @var bool|null */
        public ?bool $IncludesVat=null,
        /** @var EAccountingInvoiceSendTypes|null */
        public ?EAccountingInvoiceSendTypes $SendType=null,
        /** @var bool|null */
        public ?bool $IsSold=null,
        /** @var DateTime|null */
        public ?DateTime $PaymentDate=null,
        /** @var PaymentStatus|null */
        public ?PaymentStatus $PaymentStatus=null,
        /** @var string|null */
        public ?string $PaymentStatusTitle=null,
        /** @var array<CreditedBy>|null */
        public ?array $CreditedBy=null,
        /** @var string|null */
        public ?string $PriceSign=null,
        /** @var string|null */
        public ?string $BookingId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['InvoiceId'])) $this->InvoiceId = $o['InvoiceId'];
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['TotalAmount'])) $this->TotalAmount = $o['TotalAmount'];
        if (isset($o['TotalVatAmount'])) $this->TotalVatAmount = $o['TotalVatAmount'];
        if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
        if (isset($o['Rows'])) $this->Rows = JsonConverters::fromArray('InvoiceLineQueryResponse', $o['Rows']);
        if (isset($o['VatSpecification'])) $this->VatSpecification = JsonConverters::fromArray('VatSpecificationQueryResponse', $o['VatSpecification']);
        if (isset($o['InvoiceDate'])) $this->InvoiceDate = $o['InvoiceDate'];
        if (isset($o['DueDate'])) $this->DueDate = $o['DueDate'];
        if (isset($o['DeliveryDate'])) $this->DeliveryDate = JsonConverters::from('DateTime', $o['DeliveryDate']);
        if (isset($o['Persons'])) $this->Persons = JsonConverters::fromArray('Person', $o['Persons']);
        if (isset($o['InvoiceCustomerName'])) $this->InvoiceCustomerName = $o['InvoiceCustomerName'];
        if (isset($o['InvoiceAddress'])) $this->InvoiceAddress = JsonConverters::from('InvoiceAddress', $o['InvoiceAddress']);
        if (isset($o['CustomerIsPrivatePerson'])) $this->CustomerIsPrivatePerson = $o['CustomerIsPrivatePerson'];
        if (isset($o['TermsOfPaymentId'])) $this->TermsOfPaymentId = $o['TermsOfPaymentId'];
        if (isset($o['TermsOfPaymentData'])) $this->TermsOfPaymentData = JsonConverters::from('EAccountingTermsOfPaymentQueryResponse', $o['TermsOfPaymentData']);
        if (isset($o['CustomerEmail'])) $this->CustomerEmail = $o['CustomerEmail'];
        if (isset($o['InvoiceNumber'])) $this->InvoiceNumber = $o['InvoiceNumber'];
        if (isset($o['CustomerNumber'])) $this->CustomerNumber = $o['CustomerNumber'];
        if (isset($o['Notes'])) $this->Notes = JsonConverters::fromArray('NoteQueryResponse', $o['Notes']);
        if (isset($o['NoteIds'])) $this->NoteIds = JsonConverters::fromArray('string', $o['NoteIds']);
        if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
        if (isset($o['ModifiedUtc'])) $this->ModifiedUtc = JsonConverters::from('DateTime', $o['ModifiedUtc']);
        if (isset($o['IncludesVat'])) $this->IncludesVat = $o['IncludesVat'];
        if (isset($o['SendType'])) $this->SendType = JsonConverters::from('EAccountingInvoiceSendTypes', $o['SendType']);
        if (isset($o['IsSold'])) $this->IsSold = $o['IsSold'];
        if (isset($o['PaymentDate'])) $this->PaymentDate = JsonConverters::from('DateTime', $o['PaymentDate']);
        if (isset($o['PaymentStatus'])) $this->PaymentStatus = JsonConverters::from('PaymentStatus', $o['PaymentStatus']);
        if (isset($o['PaymentStatusTitle'])) $this->PaymentStatusTitle = $o['PaymentStatusTitle'];
        if (isset($o['CreditedBy'])) $this->CreditedBy = JsonConverters::fromArray('CreditedBy', $o['CreditedBy']);
        if (isset($o['PriceSign'])) $this->PriceSign = $o['PriceSign'];
        if (isset($o['BookingId'])) $this->BookingId = $o['BookingId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->InvoiceId)) $o['InvoiceId'] = $this->InvoiceId;
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->TotalAmount)) $o['TotalAmount'] = $this->TotalAmount;
        if (isset($this->TotalVatAmount)) $o['TotalVatAmount'] = $this->TotalVatAmount;
        if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
        if (isset($this->Rows)) $o['Rows'] = JsonConverters::toArray('InvoiceLineQueryResponse', $this->Rows);
        if (isset($this->VatSpecification)) $o['VatSpecification'] = JsonConverters::toArray('VatSpecificationQueryResponse', $this->VatSpecification);
        if (isset($this->InvoiceDate)) $o['InvoiceDate'] = $this->InvoiceDate;
        if (isset($this->DueDate)) $o['DueDate'] = $this->DueDate;
        if (isset($this->DeliveryDate)) $o['DeliveryDate'] = JsonConverters::to('DateTime', $this->DeliveryDate);
        if (isset($this->Persons)) $o['Persons'] = JsonConverters::toArray('Person', $this->Persons);
        if (isset($this->InvoiceCustomerName)) $o['InvoiceCustomerName'] = $this->InvoiceCustomerName;
        if (isset($this->InvoiceAddress)) $o['InvoiceAddress'] = JsonConverters::to('InvoiceAddress', $this->InvoiceAddress);
        if (isset($this->CustomerIsPrivatePerson)) $o['CustomerIsPrivatePerson'] = $this->CustomerIsPrivatePerson;
        if (isset($this->TermsOfPaymentId)) $o['TermsOfPaymentId'] = $this->TermsOfPaymentId;
        if (isset($this->TermsOfPaymentData)) $o['TermsOfPaymentData'] = JsonConverters::to('EAccountingTermsOfPaymentQueryResponse', $this->TermsOfPaymentData);
        if (isset($this->CustomerEmail)) $o['CustomerEmail'] = $this->CustomerEmail;
        if (isset($this->InvoiceNumber)) $o['InvoiceNumber'] = $this->InvoiceNumber;
        if (isset($this->CustomerNumber)) $o['CustomerNumber'] = $this->CustomerNumber;
        if (isset($this->Notes)) $o['Notes'] = JsonConverters::toArray('NoteQueryResponse', $this->Notes);
        if (isset($this->NoteIds)) $o['NoteIds'] = JsonConverters::toArray('string', $this->NoteIds);
        if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
        if (isset($this->ModifiedUtc)) $o['ModifiedUtc'] = JsonConverters::to('DateTime', $this->ModifiedUtc);
        if (isset($this->IncludesVat)) $o['IncludesVat'] = $this->IncludesVat;
        if (isset($this->SendType)) $o['SendType'] = JsonConverters::to('EAccountingInvoiceSendTypes', $this->SendType);
        if (isset($this->IsSold)) $o['IsSold'] = $this->IsSold;
        if (isset($this->PaymentDate)) $o['PaymentDate'] = JsonConverters::to('DateTime', $this->PaymentDate);
        if (isset($this->PaymentStatus)) $o['PaymentStatus'] = JsonConverters::to('PaymentStatus', $this->PaymentStatus);
        if (isset($this->PaymentStatusTitle)) $o['PaymentStatusTitle'] = $this->PaymentStatusTitle;
        if (isset($this->CreditedBy)) $o['CreditedBy'] = JsonConverters::toArray('CreditedBy', $this->CreditedBy);
        if (isset($this->PriceSign)) $o['PriceSign'] = $this->PriceSign;
        if (isset($this->BookingId)) $o['BookingId'] = $this->BookingId;
        return empty($o) ? new class(){} : $o;
    }
}

class CreateInvoiceQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var InvoiceQueryResponse|null */
        public ?InvoiceQueryResponse $Invoice=null,
        /** @var string|null */
        public ?string $InvoiceUri=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

enum RotPropertyTypes : int
{
    case Apartment = 1;
    case Property = 2;
}

enum RotReducedInvoicingTypes : string
{
    case Normal = 'Normal';
    case Rot = 'Rot';
    case Rut = 'Rut';
}

class CreateInvoice extends InvoiceAddress implements ICompany, JsonSerializable
{
    /**
     * @param string|null $CorporateIdentityNumber
     * @param string|null $InvoiceAddress1
     * @param string|null $InvoiceAddress2
     * @param string|null $InvoiceCity
     * @param string|null $InvoicePostalCode
     * @param string|null $InvoiceCountryCode
     */
    public function __construct(
        ?string $CorporateIdentityNumber=null,
        ?string $InvoiceAddress1=null,
        ?string $InvoiceAddress2=null,
        ?string $InvoiceCity=null,
        ?string $InvoicePostalCode=null,
        ?string $InvoiceCountryCode=null,
        /** @description The booking id, to be used to create the customer. */
        // @ApiMember(Description="The booking id, to be used to create the customer.", IsRequired=true)
        /** @var int */
        public int $BookingId=0,

        /** @description The Term of payment Id, to be used to create the invoice. */
        // @ApiMember(Description="The Term of payment Id, to be used to create the invoice.", IsRequired=true)
        /** @var string */
        public string $TermsOfPaymentId='',

        /** @description Note id's to add to this invoice */
        // @ApiMember(Description="Note id's to add to this invoice")
        /** @var array<string>|null */
        public ?array $Notes=null,

        /** @description Invoice Customer name */
        // @ApiMember(Description="Invoice Customer name")
        /** @var string|null */
        public ?string $InvoiceCustomerName=null,

        /** @description Used for sending the invoice via Auto-invoice Default:None, 0 = None, 1 = AutoInvoiceElectronic, 2 = AutoInvoicePrint, 3 = AutoInvoiceB2C = ['0', '1', '2', '3']. */
        // @ApiMember(Description="Used for sending the invoice via Auto-invoice Default:None, 0 = None, 1 = AutoInvoiceElectronic, 2 = AutoInvoicePrint, 3 = AutoInvoiceB2C = ['0', '1', '2', '3'].", IsRequired=true)
        /** @var EAccountingInvoiceSendTypes|null */
        public ?EAccountingInvoiceSendTypes $SendType=null,

        /** @description 1 = Apartment, 2 = Property Leave blank or set to null if you do not intend to use ROT or Green Technology functionality. */
        // @ApiMember(Description="1 = Apartment, 2 = Property Leave blank or set to null if you do not intend to use ROT or Green Technology functionality.", IsRequired=true)
        /** @var RotPropertyTypes|null */
        public ?RotPropertyTypes $RotPropertyType=null,

        /** @description 0 = Normal, 1 = Rot, 2 = Rut = ['0', '1', '2'] */
        // @ApiMember(Description="0 = Normal, 1 = Rot, 2 = Rut = ['0', '1', '2']", IsRequired=true)
        /** @var RotReducedInvoicingTypes|null */
        public ?RotReducedInvoicingTypes $RotReducedInvoicingType=null,

        /** @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
    ) {
        parent::__construct($CorporateIdentityNumber,$InvoiceAddress1,$InvoiceAddress2,$InvoiceCity,$InvoicePostalCode,$InvoiceCountryCode);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['BookingId'])) $this->BookingId = $o['BookingId'];
        if (isset($o['TermsOfPaymentId'])) $this->TermsOfPaymentId = $o['TermsOfPaymentId'];
        if (isset($o['Notes'])) $this->Notes = JsonConverters::fromArray('string', $o['Notes']);
        if (isset($o['InvoiceCustomerName'])) $this->InvoiceCustomerName = $o['InvoiceCustomerName'];
        if (isset($o['SendType'])) $this->SendType = JsonConverters::from('EAccountingInvoiceSendTypes', $o['SendType']);
        if (isset($o['RotPropertyType'])) $this->RotPropertyType = JsonConverters::from('RotPropertyTypes', $o['RotPropertyType']);
        if (isset($o['RotReducedInvoicingType'])) $this->RotReducedInvoicingType = JsonConverters::from('RotReducedInvoicingTypes', $o['RotReducedInvoicingType']);
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->BookingId)) $o['BookingId'] = $this->BookingId;
        if (isset($this->TermsOfPaymentId)) $o['TermsOfPaymentId'] = $this->TermsOfPaymentId;
        if (isset($this->Notes)) $o['Notes'] = JsonConverters::toArray('string', $this->Notes);
        if (isset($this->InvoiceCustomerName)) $o['InvoiceCustomerName'] = $this->InvoiceCustomerName;
        if (isset($this->SendType)) $o['SendType'] = JsonConverters::to('EAccountingInvoiceSendTypes', $this->SendType);
        if (isset($this->RotPropertyType)) $o['RotPropertyType'] = JsonConverters::to('RotPropertyTypes', $this->RotPropertyType);
        if (isset($this->RotReducedInvoicingType)) $o['RotReducedInvoicingType'] = JsonConverters::to('RotReducedInvoicingTypes', $this->RotReducedInvoicingType);
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        return empty($o) ? new class(){} : $o;
    }
}

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

POST /eaccounting/invoice HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"BookingId":0,"Notes":["String"],"InvoiceCustomerName":"String","SendType":"None","RotPropertyType":"0","RotReducedInvoicingType":"Normal","CompanyId":"00000000-0000-0000-0000-000000000000","CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Invoice":{"TotalAmount":0,"TotalVatAmount":0,"CustomerId":"String","Rows":[{"ArticleNumber":"String","ArticleId":"String","IsServiceArticle":false,"AmountNoVat":0,"PercentVat":0,"LineNumber":0,"IsTextRow":false,"Text":"String","UnitPrice":0,"UnitAbbreviation":"String","UnitAbbreviationEnglish":"String","DiscountPercentage":0,"Quantity":0,"IsWorkCost":false,"IsVatFree":false,"CostCenterItemId1":"String","CostCenterItemId2":"String","CostCenterItemId3":"String","UnitId":"String","ProjectId":"String","WorkCostType":0,"WorkHours":0,"MaterialCosts":0,"GreenTechnologyType":"None","ContributionMargin":{"Amount":0,"Percentage":0}}],"VatSpecification":[{"AmountInvoiceCurrency":0,"VatAmountInvoiceCurrency":0,"VatPercent":0}],"InvoiceDate":"String","DueDate":"String","DeliveryDate":"0001-01-01T00:00:00","Persons":[{"Ssn":"String","Amount":0}],"InvoiceCustomerName":"String","InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"},"CustomerIsPrivatePerson":false,"TermsOfPaymentId":"String","TermsOfPaymentData":{"Id":"String","Name":"String","NameEnglish":"String","NumberOfDays":0,"TermsOfPaymentTypeId":0,"TermsOfPaymentTypeText":"String","AvailableForSales":false,"AvailableForPurchase":false},"CustomerEmail":"String","InvoiceNumber":0,"CustomerNumber":"String","Notes":[{"Id":"String","Text":"String"}],"NoteIds":["String"],"IncludesVat":false,"SendType":"None","IsSold":false,"PaymentDate":"0001-01-01T00:00:00","PaymentStatus":"Paid","PaymentStatusTitle":"String","CreditedBy":[{"CreditInvoiceId":"String"}],"PriceSign":"String","BookingId":"String"},"InvoiceUri":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}