Sergiusz Bazanski | fb18c99 | 2019-05-01 12:27:03 +0200 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | |
| 3 | package invoice; |
| 4 | |
| 5 | message 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 Bazanski | 3976e3c | 2019-05-01 15:27:49 +0200 | [diff] [blame^] | 12 | // Denormalized fields follow. |
| 13 | uint64 total_net = 5; |
| 14 | uint64 total = 6; |
Sergiusz Bazanski | fb18c99 | 2019-05-01 12:27:03 +0200 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | message ContactPoint { |
| 18 | string medium = 1; |
| 19 | string contact = 2; |
| 20 | } |
| 21 | |
Sergiusz Bazanski | 3976e3c | 2019-05-01 15:27:49 +0200 | [diff] [blame^] | 22 | message InvoiceData { |
Sergiusz Bazanski | fb18c99 | 2019-05-01 12:27:03 +0200 | [diff] [blame] | 23 | 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 Bazanski | c2d322c | 2019-05-01 13:14:32 +0200 | [diff] [blame] | 35 | string unit = 13; |
Sergiusz Bazanski | fb18c99 | 2019-05-01 12:27:03 +0200 | [diff] [blame] | 36 | } |
| 37 | |
Sergiusz Bazanski | 3976e3c | 2019-05-01 15:27:49 +0200 | [diff] [blame^] | 38 | message 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 Bazanski | fb18c99 | 2019-05-01 12:27:03 +0200 | [diff] [blame] | 58 | message CreateInvoiceRequest { |
Sergiusz Bazanski | 3976e3c | 2019-05-01 15:27:49 +0200 | [diff] [blame^] | 59 | InvoiceData invoice_data = 1; |
Sergiusz Bazanski | fb18c99 | 2019-05-01 12:27:03 +0200 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | message CreateInvoiceResponse { |
| 63 | // Unique invoice ID |
| 64 | string uid = 1; |
| 65 | } |
| 66 | |
| 67 | message GetInvoiceRequest { |
| 68 | string uid = 1; |
| 69 | } |
| 70 | |
| 71 | message GetInvoiceResponse { |
| 72 | Invoice invoice = 1; |
Sergiusz Bazanski | fb18c99 | 2019-05-01 12:27:03 +0200 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | message RenderInvoiceRequest { |
| 76 | string uid = 1; |
| 77 | } |
| 78 | |
| 79 | message RenderInvoiceResponse { |
| 80 | bytes data = 1; |
| 81 | } |
| 82 | |
| 83 | message SealInvoiceRequest { |
| 84 | string uid = 1; |
| 85 | } |
| 86 | |
| 87 | message SealInvoiceResponse { |
| 88 | } |
| 89 | |
| 90 | service 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 | } |