blob: 187e35810a38b829e46fe87c8ecffe815b3dac3a [file] [log] [blame]
syntax = "proto3";
package invoice;
message Item {
string title = 1;
uint64 count = 2;
uint64 unit_price = 3;
// in thousands of percent points
// (ie 23% == 23000)
uint64 vat = 4;
// Denormalized fields follow.
uint64 total_net = 5;
uint64 total = 6;
}
message ContactPoint {
string medium = 1;
string contact = 2;
}
message InvoiceData {
repeated Item item = 1;
repeated string invoicer_billing = 2;
repeated ContactPoint invoicer_contact = 3;
repeated string customer_billing = 4;
string invoicer_vat_id = 5;
string invoicer_company_number = 12;
string customer_vat_id = 6;
bool reverse_vat = 7;
bool us_customer = 11;
int64 days_due = 8;
string iban = 9;
string swift = 10;
string unit = 13;
}
message Invoice {
// Original invoice parameters/data.
InvoiceData data = 1;
enum State {
STATE_INVALID = 0;
STATE_PROFORMA = 1;
STATE_SEALED = 2;
};
State state = 2;
string uid = 9;
// If sealed, otherwise 'proforma'.
string final_uid = 3;
int64 date = 4;
int64 due_date = 5;
// Denormalized fields follow.
uint64 total_net = 6;
uint64 total = 7;
string unit = 8;
}
message CreateInvoiceRequest {
InvoiceData invoice_data = 1;
}
message CreateInvoiceResponse {
// Unique invoice ID
string uid = 1;
}
message GetInvoiceRequest {
string uid = 1;
}
message GetInvoiceResponse {
Invoice invoice = 1;
}
message RenderInvoiceRequest {
string uid = 1;
}
message RenderInvoiceResponse {
bytes data = 1;
}
message SealInvoiceRequest {
string uid = 1;
}
message SealInvoiceResponse {
}
service Invoicer {
rpc CreateInvoice(CreateInvoiceRequest) returns (CreateInvoiceResponse);
rpc GetInvoice(GetInvoiceRequest) returns (GetInvoiceResponse);
rpc RenderInvoice(RenderInvoiceRequest) returns (stream RenderInvoiceResponse);
rpc SealInvoice(SealInvoiceRequest) returns (SealInvoiceResponse);
}