POST | /eaccounting/invoice |
---|
import java.math.*
import java.util.*
import net.servicestack.client.*
open class CreateInvoice : 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
/**
* 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 SendType:EAccountingInvoiceSendTypes? = 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 EAccountingInvoiceSendTypes
{
None,
AutoInvoiceElectronic,
AutoInvoicePrint,
AutoInvoiceB2C,
}
enum class RotPropertyTypes(val value:Int)
{
Apartment(1),
Property(2),
}
enum class RotReducedInvoicingTypes
{
Normal,
Rot,
Rut,
}
open class CreateInvoiceQueryResponse
{
var Invoice:InvoiceQueryResponse? = null
var InvoiceUri:String? = null
var ResponseStatus:ResponseStatus? = null
}
open class InvoiceQueryResponse
{
var InvoiceId:UUID? = null
var CreatedDate:Date? = null
var TotalAmount:BigDecimal? = null
var TotalVatAmount:BigDecimal? = null
var CustomerId:String? = null
var Rows:ArrayList<InvoiceLineQueryResponse> = ArrayList<InvoiceLineQueryResponse>()
var VatSpecification:ArrayList<VatSpecificationQueryResponse> = ArrayList<VatSpecificationQueryResponse>()
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 TermsOfPaymentId:String? = null
var TermsOfPaymentData:EAccountingTermsOfPaymentQueryResponse? = null
var CustomerEmail:String? = null
var InvoiceNumber:Int? = null
var CustomerNumber:String? = null
var Notes:ArrayList<NoteQueryResponse> = ArrayList<NoteQueryResponse>()
var NoteIds:ArrayList<String> = ArrayList<String>()
var CreatedUtc:Date? = null
var ModifiedUtc:Date? = null
var IncludesVat:Boolean? = null
var SendType:EAccountingInvoiceSendTypes? = null
var IsSold:Boolean? = null
var PaymentDate:Date? = null
var PaymentStatus:PaymentStatus? = null
var PaymentStatusTitle:String? = null
var CreditedBy:ArrayList<CreditedBy> = ArrayList<CreditedBy>()
var PriceSign:String? = null
var BookingId:String? = null
}
open class InvoiceLineQueryResponse
{
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:Float? = 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:Float? = 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 VatSpecificationQueryResponse
{
var AmountInvoiceCurrency:BigDecimal? = null
var VatAmountInvoiceCurrency:BigDecimal? = null
var VatPercent:BigDecimal? = null
}
open class Person
{
var Ssn:String? = null
var Amount:Int? = null
}
open class EAccountingTermsOfPaymentQueryResponse
{
var Id:String? = null
var Name:String? = null
var NameEnglish:String? = null
var NumberOfDays:Int? = null
var TermsOfPaymentTypeId:Int? = null
var TermsOfPaymentTypeText:String? = null
var AvailableForSales:Boolean? = null
var AvailableForPurchase:Boolean? = null
}
open class NoteQueryResponse
{
var Id:String? = null
var Text:String? = null
var CreatedUtc:Date? = null
var ModifiedUtc:Date? = null
}
enum class PaymentStatus
{
Paid,
Unpaid,
Overdue,
}
open class CreditedBy
{
var CreditInvoiceId:String? = null
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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/csv
Content-Type: text/csv
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/csv 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"}}}