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; |
| 12 | } |
| 13 | |
| 14 | message ContactPoint { |
| 15 | string medium = 1; |
| 16 | string contact = 2; |
| 17 | } |
| 18 | |
| 19 | message Invoice { |
| 20 | repeated Item item = 1; |
| 21 | repeated string invoicer_billing = 2; |
| 22 | repeated ContactPoint invoicer_contact = 3; |
| 23 | repeated string customer_billing = 4; |
| 24 | string invoicer_vat_id = 5; |
| 25 | string invoicer_company_number = 12; |
| 26 | string customer_vat_id = 6; |
| 27 | bool reverse_vat = 7; |
| 28 | bool us_customer = 11; |
| 29 | int64 days_due = 8; |
| 30 | string iban = 9; |
| 31 | string swift = 10; |
Sergiusz Bazanski | c2d322c | 2019-05-01 13:14:32 +0200 | [diff] [blame^] | 32 | string unit = 13; |
Sergiusz Bazanski | fb18c99 | 2019-05-01 12:27:03 +0200 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | message CreateInvoiceRequest { |
| 36 | Invoice invoice = 1; |
| 37 | } |
| 38 | |
| 39 | message CreateInvoiceResponse { |
| 40 | // Unique invoice ID |
| 41 | string uid = 1; |
| 42 | } |
| 43 | |
| 44 | message GetInvoiceRequest { |
| 45 | string uid = 1; |
| 46 | } |
| 47 | |
| 48 | message GetInvoiceResponse { |
| 49 | Invoice invoice = 1; |
| 50 | enum State { |
| 51 | STATE_INVALID = 0; |
| 52 | STATE_PROFORMA = 1; |
| 53 | STATE_SEALED = 2; |
| 54 | }; |
| 55 | State state = 2; |
| 56 | string final_uid = 3; |
| 57 | } |
| 58 | |
| 59 | message RenderInvoiceRequest { |
| 60 | string uid = 1; |
| 61 | } |
| 62 | |
| 63 | message RenderInvoiceResponse { |
| 64 | bytes data = 1; |
| 65 | } |
| 66 | |
| 67 | message SealInvoiceRequest { |
| 68 | string uid = 1; |
| 69 | } |
| 70 | |
| 71 | message SealInvoiceResponse { |
| 72 | } |
| 73 | |
| 74 | service Invoicer { |
| 75 | rpc CreateInvoice(CreateInvoiceRequest) returns (CreateInvoiceResponse); |
| 76 | rpc GetInvoice(GetInvoiceRequest) returns (GetInvoiceResponse); |
| 77 | rpc RenderInvoice(RenderInvoiceRequest) returns (stream RenderInvoiceResponse); |
| 78 | rpc SealInvoice(SealInvoiceRequest) returns (SealInvoiceResponse); |
| 79 | } |