POST | /eaccounting/invoicedraft |
---|
"use strict";
export class InvoiceAddress {
/** @param {{CorporateIdentityNumber?:string,InvoiceAddress1?:string,InvoiceAddress2?:string,InvoiceCity?:string,InvoicePostalCode?:string,InvoiceCountryCode?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
CorporateIdentityNumber;
/** @type {string} */
InvoiceAddress1;
/** @type {string} */
InvoiceAddress2;
/** @type {string} */
InvoiceCity;
/** @type {string} */
InvoicePostalCode;
/** @type {string} */
InvoiceCountryCode;
}
/** @typedef {'None'|'SolarCellInstallation'|'ElectricEnergyStorageInstallation'|'ElectricVehicleChargingPointInstallation'} */
export var GreenTechnologyType;
(function (GreenTechnologyType) {
GreenTechnologyType["None"] = "None"
GreenTechnologyType["SolarCellInstallation"] = "SolarCellInstallation"
GreenTechnologyType["ElectricEnergyStorageInstallation"] = "ElectricEnergyStorageInstallation"
GreenTechnologyType["ElectricVehicleChargingPointInstallation"] = "ElectricVehicleChargingPointInstallation"
})(GreenTechnologyType || (GreenTechnologyType = {}));
export class ContributionMargin {
/** @param {{Amount?:number,Percentage?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {?number} */
Amount;
/** @type {?number} */
Percentage;
}
export class InvoiceDraftLineQueryResponse {
/** @param {{ArticleNumber?:string,ArticleId?:string,IsServiceArticle?:boolean,AmountNoVat?:number,PercentVat?:number,LineNumber?:number,IsTextRow?:boolean,Text?:string,UnitPrice?:number,UnitAbbreviation?:string,UnitAbbreviationEnglish?:string,DiscountPercentage?:number,Quantity?:number,IsWorkCost?:boolean,IsVatFree?:boolean,CostCenterItemId1?:string,CostCenterItemId2?:string,CostCenterItemId3?:string,UnitId?:string,ProjectId?:string,WorkCostType?:number,WorkHours?:number,MaterialCosts?:number,GreenTechnologyType?:GreenTechnologyType,ContributionMargin?:ContributionMargin}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
ArticleNumber;
/** @type {string} */
ArticleId;
/** @type {?boolean} */
IsServiceArticle;
/** @type {number} */
AmountNoVat;
/** @type {number} */
PercentVat;
/** @type {?number} */
LineNumber;
/** @type {boolean} */
IsTextRow;
/** @type {string} */
Text;
/** @type {?number} */
UnitPrice;
/** @type {string} */
UnitAbbreviation;
/** @type {string} */
UnitAbbreviationEnglish;
/** @type {?number} */
DiscountPercentage;
/** @type {?number} */
Quantity;
/** @type {boolean} */
IsWorkCost;
/** @type {boolean} */
IsVatFree;
/** @type {string} */
CostCenterItemId1;
/** @type {string} */
CostCenterItemId2;
/** @type {string} */
CostCenterItemId3;
/** @type {string} */
UnitId;
/** @type {string} */
ProjectId;
/** @type {?number} */
WorkCostType;
/** @type {?number} */
WorkHours;
/** @type {?number} */
MaterialCosts;
/** @type {?GreenTechnologyType} */
GreenTechnologyType;
/** @type {ContributionMargin} */
ContributionMargin;
}
export class Person {
/** @param {{Ssn?:string,Amount?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Ssn;
/** @type {number} */
Amount;
}
export class NoteQueryResponse {
/** @param {{Id?:string,Text?:string,CreatedUtc?:string,ModifiedUtc?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Id;
/** @type {string} */
Text;
/** @type {string} */
CreatedUtc;
/** @type {string} */
ModifiedUtc;
}
export class InvoiceDraftQueryResponse {
/** @param {{InvoiceId?:string,CreatedDate?:string,TotalAmount?:number,TotalVatAmount?:number,CustomerId?:string,Rows?:InvoiceDraftLineQueryResponse[],InvoiceDate?:string,DueDate?:string,DeliveryDate?:string,Persons?:Person[],InvoiceCustomerName?:string,InvoiceAddress?:InvoiceAddress,CustomerIsPrivatePerson?:boolean,CustomerNumber?:string,Notes?:NoteQueryResponse[],NoteIds?:string[],CreatedUtc?:string,IncludesVat?:boolean,PriceSign?:string,BookingId?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
InvoiceId;
/** @type {?string} */
CreatedDate;
/** @type {?number} */
TotalAmount;
/** @type {?number} */
TotalVatAmount;
/** @type {string} */
CustomerId;
/** @type {InvoiceDraftLineQueryResponse[]} */
Rows;
/** @type {string} */
InvoiceDate;
/** @type {string} */
DueDate;
/** @type {?string} */
DeliveryDate;
/** @type {Person[]} */
Persons;
/** @type {string} */
InvoiceCustomerName;
/** @type {InvoiceAddress} */
InvoiceAddress;
/** @type {boolean} */
CustomerIsPrivatePerson;
/** @type {string} */
CustomerNumber;
/** @type {NoteQueryResponse[]} */
Notes;
/** @type {string[]} */
NoteIds;
/** @type {string} */
CreatedUtc;
/** @type {boolean} */
IncludesVat;
/** @type {string} */
PriceSign;
/** @type {string} */
BookingId;
}
export class CreateInvoiceDraftQueryResponse {
/** @param {{Invoice?:InvoiceDraftQueryResponse,InvoiceUri?:string,ResponseStatus?:ResponseStatus}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {InvoiceDraftQueryResponse} */
Invoice;
/** @type {string} */
InvoiceUri;
/** @type {ResponseStatus} */
ResponseStatus;
}
/** @typedef {number} */
export var RotPropertyTypes;
(function (RotPropertyTypes) {
RotPropertyTypes[RotPropertyTypes["Apartment"] = 1] = "Apartment"
RotPropertyTypes[RotPropertyTypes["Property"] = 2] = "Property"
})(RotPropertyTypes || (RotPropertyTypes = {}));
/** @typedef {'Normal'|'Rot'|'Rut'} */
export var RotReducedInvoicingTypes;
(function (RotReducedInvoicingTypes) {
RotReducedInvoicingTypes["Normal"] = "Normal"
RotReducedInvoicingTypes["Rot"] = "Rot"
RotReducedInvoicingTypes["Rut"] = "Rut"
})(RotReducedInvoicingTypes || (RotReducedInvoicingTypes = {}));
export class CreateInvoiceDraft extends InvoiceAddress {
/** @param {{BookingId?:number,TermsOfPaymentId?:string,Notes?:string[],InvoiceCustomerName?:string,RotPropertyType?:RotPropertyTypes,RotReducedInvoicingType?:RotReducedInvoicingTypes,CompanyId?:string,CorporateIdentityNumber?:string,InvoiceAddress1?:string,InvoiceAddress2?:string,InvoiceCity?:string,InvoicePostalCode?:string,InvoiceCountryCode?:string}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
/**
* @type {number}
* @description The booking id, to be used to create the customer. */
BookingId;
/**
* @type {string}
* @description The Term of payment Id, to be used to create the invoice. */
TermsOfPaymentId;
/**
* @type {string[]}
* @description Note id's to add to this invoice */
Notes;
/**
* @type {string}
* @description Invoice Customer name */
InvoiceCustomerName;
/**
* @type {RotPropertyTypes}
* @description 1 = Apartment, 2 = Property Leave blank or set to null if you do not intend to use ROT or Green Technology functionality. */
RotPropertyType;
/**
* @type {RotReducedInvoicingTypes}
* @description 0 = Normal, 1 = Rot, 2 = Rut = ['0', '1', '2'] */
RotReducedInvoicingType;
/**
* @type {?string}
* @description The company id, if empty will use the company id for the user you are logged in with. */
CompanyId;
}
JavaScript CreateInvoiceDraft DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
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/jsv
Content-Type: text/jsv
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/jsv 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 } } }