blob: a5c6a844bd642e0d0b7e54cd0700ed06ea4b3526 [file] [log] [blame]
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +02001syntax = "proto3";
2
3package invoice;
4
5message Item {
6 string title = 1;
7 uint64 count = 2;
8 uint64 unit_price = 3;
9 // in thousands of percent points
10 // (ie 23% == 23000)
11 uint64 vat = 4;
Sergiusz Bazanski3976e3c2019-05-01 15:27:49 +020012 // Denormalized fields follow.
13 uint64 total_net = 5;
14 uint64 total = 6;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020015}
16
17message ContactPoint {
18 string medium = 1;
19 string contact = 2;
20}
21
Sergiusz Bazanski3976e3c2019-05-01 15:27:49 +020022message InvoiceData {
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020023 repeated Item item = 1;
24 repeated string invoicer_billing = 2;
25 repeated ContactPoint invoicer_contact = 3;
26 repeated string customer_billing = 4;
27 string invoicer_vat_id = 5;
28 string invoicer_company_number = 12;
29 string customer_vat_id = 6;
30 bool reverse_vat = 7;
31 bool us_customer = 11;
Sergiusz Bazanskia818ef22019-06-07 10:37:22 +020032 // Optional, if not given the proforma will be created with the current time.
33 int64 date = 14;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020034 int64 days_due = 8;
35 string iban = 9;
36 string swift = 10;
Sergiusz Bazanskic2d322c2019-05-01 13:14:32 +020037 string unit = 13;
Sergiusz Bazanskia818ef22019-06-07 10:37:22 +020038 // Next tag: 15
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020039}
40
Sergiusz Bazanski3976e3c2019-05-01 15:27:49 +020041message Invoice {
42 // Original invoice parameters/data.
43 InvoiceData data = 1;
44 enum State {
45 STATE_INVALID = 0;
46 STATE_PROFORMA = 1;
47 STATE_SEALED = 2;
48 };
49 State state = 2;
50 string uid = 9;
51 // If sealed, otherwise 'proforma'.
52 string final_uid = 3;
53 int64 date = 4;
54 int64 due_date = 5;
55 // Denormalized fields follow.
56 uint64 total_net = 6;
57 uint64 total = 7;
58 string unit = 8;
59}
60
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020061message CreateInvoiceRequest {
Sergiusz Bazanski3976e3c2019-05-01 15:27:49 +020062 InvoiceData invoice_data = 1;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020063}
64
65message CreateInvoiceResponse {
66 // Unique invoice ID
67 string uid = 1;
68}
69
70message GetInvoiceRequest {
71 string uid = 1;
72}
73
74message GetInvoiceResponse {
75 Invoice invoice = 1;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020076}
77
78message RenderInvoiceRequest {
79 string uid = 1;
Sergiusz Bazanskia818ef22019-06-07 10:37:22 +020080 string language = 2;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020081}
82
83message RenderInvoiceResponse {
84 bytes data = 1;
85}
86
87message SealInvoiceRequest {
88 string uid = 1;
Sergiusz Bazanskia818ef22019-06-07 10:37:22 +020089 enum DateSource {
90 DATE_SOURCE_NOW = 0;
91 DATE_SOURCE_PROFORMA = 1;
92 }
93 DateSource date_source = 2;
94 string language = 3;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020095}
96
97message SealInvoiceResponse {
98}
99
100service Invoicer {
101 rpc CreateInvoice(CreateInvoiceRequest) returns (CreateInvoiceResponse);
102 rpc GetInvoice(GetInvoiceRequest) returns (GetInvoiceResponse);
103 rpc RenderInvoice(RenderInvoiceRequest) returns (stream RenderInvoiceResponse);
104 rpc SealInvoice(SealInvoiceRequest) returns (SealInvoiceResponse);
105}