BokaMera.API.Host

<back to all web services

CreateInvoiceDraft

The following routes are available for this service:
POST/eaccounting/invoicedraft
import java.math.*
import java.util.*
import net.servicestack.client.*


open class CreateInvoiceDraft : InvoiceAddress(), ICompany
{
    /**
    * 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 BookingId:Int? = null

    /**
    * 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 TermsOfPaymentId:UUID? = null

    /**
    * Note id's to add to this invoice
    */
    @ApiMember(Description="Note id's to add to this invoice")
    var Notes:ArrayList<String> = ArrayList<String>()

    /**
    * Invoice Customer name
    */
    @ApiMember(Description="Invoice Customer name")
    var InvoiceCustomerName:String? = null

    /**
    * 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 RotPropertyType:RotPropertyTypes? = null

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

    /**
    * 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 CompanyId:UUID? = null
}

open class InvoiceAddress
{
    var CorporateIdentityNumber:String? = null
    var InvoiceAddress1:String? = null
    var InvoiceAddress2:String? = null
    var InvoiceCity:String? = null
    var InvoicePostalCode:String? = null
    var InvoiceCountryCode:String? = null
}

enum class RotPropertyTypes(val value:Int)
{
    Apartment(1),
    Property(2),
}

enum class RotReducedInvoicingTypes
{
    Normal,
    Rot,
    Rut,
}

open class CreateInvoiceDraftQueryResponse
{
    var Invoice:InvoiceDraftQueryResponse? = null
    var InvoiceUri:String? = null
    var ResponseStatus:ResponseStatus? = null
}

open class InvoiceDraftQueryResponse
{
    var InvoiceId:UUID? = null
    var CreatedDate:Date? = null
    var TotalAmount:BigDecimal? = null
    var TotalVatAmount:BigDecimal? = null
    var CustomerId:String? = null
    var Rows:ArrayList<InvoiceDraftLineQueryResponse> = ArrayList<InvoiceDraftLineQueryResponse>()
    var InvoiceDate:String? = null
    var DueDate:String? = null
    var DeliveryDate:Date? = null
    var Persons:ArrayList<Person> = ArrayList<Person>()
    var InvoiceCustomerName:String? = null
    var InvoiceAddress:InvoiceAddress? = null
    var CustomerIsPrivatePerson:Boolean? = null
    var CustomerNumber:String? = null
    var Notes:ArrayList<NoteQueryResponse> = ArrayList<NoteQueryResponse>()
    var NoteIds:ArrayList<String> = ArrayList<String>()
    var CreatedUtc:Date? = null
    var IncludesVat:Boolean? = null
    var PriceSign:String? = null
    var BookingId:String? = null
}

open class InvoiceDraftLineQueryResponse
{
    var ArticleNumber:String? = null
    var ArticleId:String? = null
    var IsServiceArticle:Boolean? = null
    var AmountNoVat:BigDecimal? = null
    var PercentVat:BigDecimal? = null
    var LineNumber:Int? = null
    var IsTextRow:Boolean? = null
    var Text:String? = null
    var UnitPrice:BigDecimal? = null
    var UnitAbbreviation:String? = null
    var UnitAbbreviationEnglish:String? = null
    var DiscountPercentage:BigDecimal? = null
    var Quantity:Double? = null
    var IsWorkCost:Boolean? = null
    var IsVatFree:Boolean? = null
    var CostCenterItemId1:String? = null
    var CostCenterItemId2:String? = null
    var CostCenterItemId3:String? = null
    var UnitId:String? = null
    var ProjectId:String? = null
    var WorkCostType:Int? = null
    var WorkHours:Double? = null
    var MaterialCosts:BigDecimal? = null
    var GreenTechnologyType:GreenTechnologyType? = null
    var ContributionMargin:ContributionMargin? = null
}

enum class GreenTechnologyType
{
    None,
    SolarCellInstallation,
    ElectricEnergyStorageInstallation,
    ElectricVehicleChargingPointInstallation,
}

open class ContributionMargin
{
    var Amount:Int? = null
    var Percentage:Int? = null
}

open class Person
{
    var Ssn:String? = null
    var Amount:Int? = null
}

open class NoteQueryResponse
{
    var Id:String? = null
    var Text:String? = null
    var CreatedUtc:Date? = null
    var ModifiedUtc:Date? = null
}

Kotlin CreateInvoiceDraft DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + 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
		}
	}
}