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; |
| 32 | } |
| 33 | |
| 34 | message CreateInvoiceRequest { |
| 35 | Invoice invoice = 1; |
| 36 | } |
| 37 | |
| 38 | message CreateInvoiceResponse { |
| 39 | // Unique invoice ID |
| 40 | string uid = 1; |
| 41 | } |
| 42 | |
| 43 | message GetInvoiceRequest { |
| 44 | string uid = 1; |
| 45 | } |
| 46 | |
| 47 | message GetInvoiceResponse { |
| 48 | Invoice invoice = 1; |
| 49 | enum State { |
| 50 | STATE_INVALID = 0; |
| 51 | STATE_PROFORMA = 1; |
| 52 | STATE_SEALED = 2; |
| 53 | }; |
| 54 | State state = 2; |
| 55 | string final_uid = 3; |
| 56 | } |
| 57 | |
| 58 | message RenderInvoiceRequest { |
| 59 | string uid = 1; |
| 60 | } |
| 61 | |
| 62 | message RenderInvoiceResponse { |
| 63 | bytes data = 1; |
| 64 | } |
| 65 | |
| 66 | message SealInvoiceRequest { |
| 67 | string uid = 1; |
| 68 | } |
| 69 | |
| 70 | message SealInvoiceResponse { |
| 71 | } |
| 72 | |
| 73 | service Invoicer { |
| 74 | rpc CreateInvoice(CreateInvoiceRequest) returns (CreateInvoiceResponse); |
| 75 | rpc GetInvoice(GetInvoiceRequest) returns (GetInvoiceResponse); |
| 76 | rpc RenderInvoice(RenderInvoiceRequest) returns (stream RenderInvoiceResponse); |
| 77 | rpc SealInvoice(SealInvoiceRequest) returns (SealInvoiceResponse); |
| 78 | } |