BokaMera.API.Host

<back to all web services

CreateInvoiceDraft

The following routes are available for this service:
POST/eaccounting/invoicedraft
<?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 InvoiceDraftLineQueryResponse 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 */
        public float $PercentVat=0.0,
        /** @var int|null */
        public ?int $LineNumber=null,
        /** @var bool|null */
        public ?bool $IsTextRow=null,
        /** @var string|null */
        public ?string $Text=null,
        /** @var float|null */
        public ?float $UnitPrice=null,
        /** @var string|null */
        public ?string $UnitAbbreviation=null,
        /** @var string|null */
        public ?string $UnitAbbreviationEnglish=null,
        /** @var float|null */
        public ?float $DiscountPercentage=null,
        /** @var float|null */
        public ?float $Quantity=null,
        /** @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 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 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;
    }
}

class InvoiceDraftQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $InvoiceId='',
        /** @var DateTime|null */
        public ?DateTime $CreatedDate=null,
        /** @var float|null */
        public ?float $TotalAmount=null,
        /** @var float|null */
        public ?float $TotalVatAmount=null,
        /** @var string|null */
        public ?string $CustomerId=null,
        /** @var array<InvoiceDraftLineQueryResponse>|null */
        public ?array $Rows=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 $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 bool|null */
        public ?bool $IncludesVat=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('InvoiceDraftLineQueryResponse', $o['Rows']);
        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['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['IncludesVat'])) $this->IncludesVat = $o['IncludesVat'];
        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('InvoiceDraftLineQueryResponse', $this->Rows);
        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->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->IncludesVat)) $o['IncludesVat'] = $this->IncludesVat;
        if (isset($this->PriceSign)) $o['PriceSign'] = $this->PriceSign;
        if (isset($this->BookingId)) $o['BookingId'] = $this->BookingId;
        return empty($o) ? new class(){} : $o;
    }
}

class CreateInvoiceDraftQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var InvoiceDraftQueryResponse|null */
        public ?InvoiceDraftQueryResponse $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('InvoiceDraftQueryResponse', $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('InvoiceDraftQueryResponse', $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 CreateInvoiceDraft 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 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['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->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 CreateInvoiceDraft 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/invoicedraft HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"BookingId":0,"Notes":["String"],"InvoiceCustomerName":"String","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":{"CreatedDate":"0001-01-01T00:00:00","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}}],"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,"CustomerNumber":"String","Notes":[{"Id":"String","Text":"String"}],"NoteIds":["String"],"IncludesVat":false,"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"}}}