blob: 187e35810a38b829e46fe87c8ecffe815b3dac3a [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;
32 int64 days_due = 8;
33 string iban = 9;
34 string swift = 10;
Sergiusz Bazanskic2d322c2019-05-01 13:14:32 +020035 string unit = 13;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020036}
37
Sergiusz Bazanski3976e3c2019-05-01 15:27:49 +020038message Invoice {
39 // Original invoice parameters/data.
40 InvoiceData data = 1;
41 enum State {
42 STATE_INVALID = 0;
43 STATE_PROFORMA = 1;
44 STATE_SEALED = 2;
45 };
46 State state = 2;
47 string uid = 9;
48 // If sealed, otherwise 'proforma'.
49 string final_uid = 3;
50 int64 date = 4;
51 int64 due_date = 5;
52 // Denormalized fields follow.
53 uint64 total_net = 6;
54 uint64 total = 7;
55 string unit = 8;
56}
57
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020058message CreateInvoiceRequest {
Sergiusz Bazanski3976e3c2019-05-01 15:27:49 +020059 InvoiceData invoice_data = 1;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020060}
61
62message CreateInvoiceResponse {
63 // Unique invoice ID
64 string uid = 1;
65}
66
67message GetInvoiceRequest {
68 string uid = 1;
69}
70
71message GetInvoiceResponse {
72 Invoice invoice = 1;
Sergiusz Bazanskifb18c992019-05-01 12:27:03 +020073}
74
75message RenderInvoiceRequest {
76 string uid = 1;
77}
78
79message RenderInvoiceResponse {
80 bytes data = 1;
81}
82
83message SealInvoiceRequest {
84 string uid = 1;
85}
86
87message SealInvoiceResponse {
88}
89
90service Invoicer {
91 rpc CreateInvoice(CreateInvoiceRequest) returns (CreateInvoiceResponse);
92 rpc GetInvoice(GetInvoiceRequest) returns (GetInvoiceResponse);
93 rpc RenderInvoice(RenderInvoiceRequest) returns (stream RenderInvoiceResponse);
94 rpc SealInvoice(SealInvoiceRequest) returns (SealInvoiceResponse);
95}