proto/invoice -> bgpwtf/invoice/proto

Change-Id: I5d25864046665e4b0e57ec62a29797fbce6ed3cb
diff --git a/bgpwtf/invoice/proto/invoice.proto b/bgpwtf/invoice/proto/invoice.proto
new file mode 100644
index 0000000..75720b7
--- /dev/null
+++ b/bgpwtf/invoice/proto/invoice.proto
@@ -0,0 +1,105 @@
+syntax = "proto3";
+package invoice;
+option go_package = "code.hackerspace.pl/hscloud/bgpwtf/invoice/proto";
+
+message Item {
+    string title = 1;
+    uint64 count = 2;
+    uint64 unit_price = 3;
+    // in thousands of percent points
+    // (ie 23% == 23000)
+    uint64 vat = 4;
+    // Denormalized fields follow.
+    uint64 total_net = 5;
+    uint64 total = 6;
+}
+
+message ContactPoint {
+    string medium = 1;
+    string contact = 2;
+}
+
+message InvoiceData {
+    repeated Item item = 1;
+    repeated string invoicer_billing = 2;
+    repeated ContactPoint invoicer_contact = 3;
+    repeated string customer_billing = 4;
+    string invoicer_vat_id = 5;
+    string invoicer_company_number = 12;
+    string customer_vat_id = 6;
+    bool reverse_vat = 7;
+    bool us_customer = 11;
+    // Optional, if not given the proforma will be created with the current time.
+    int64 date = 14;
+    int64 days_due = 8;
+    string iban = 9;
+    string swift = 10;
+    string unit = 13;
+    // Next tag: 15
+}
+
+message Invoice {
+    // Original invoice parameters/data.
+    InvoiceData data = 1;
+    enum State {
+        STATE_INVALID = 0;
+        STATE_PROFORMA = 1;
+        STATE_SEALED = 2;
+    };
+    State state = 2;
+    string uid = 9;
+    // If sealed, otherwise 'proforma'.
+    string final_uid = 3;
+    int64 date = 4;
+    int64 due_date = 5;
+    // Denormalized fields follow.
+    uint64 total_net = 6;
+    uint64 total = 7;
+    string unit = 8;
+}
+
+message CreateInvoiceRequest {
+    InvoiceData invoice_data = 1;
+}
+
+message CreateInvoiceResponse {
+    // Unique invoice ID
+    string uid = 1;
+}
+
+message GetInvoiceRequest {
+    string uid = 1;
+}
+
+message GetInvoiceResponse {
+    Invoice invoice = 1;
+}
+
+message RenderInvoiceRequest {
+    string uid = 1;
+    string language = 2;
+}
+
+message RenderInvoiceResponse {
+    bytes data = 1;
+}
+
+message SealInvoiceRequest {
+    string uid = 1;
+    enum DateSource {
+        DATE_SOURCE_NOW = 0;
+        DATE_SOURCE_PROFORMA = 1;
+    }
+    DateSource date_source = 2;
+    string language = 3;
+}
+
+message SealInvoiceResponse {
+}
+
+service Invoicer {
+    rpc CreateInvoice(CreateInvoiceRequest) returns (CreateInvoiceResponse);
+    rpc GetInvoice(GetInvoiceRequest) returns (GetInvoiceResponse);
+    rpc RenderInvoice(RenderInvoiceRequest) returns (stream RenderInvoiceResponse);
+    rpc SealInvoice(SealInvoiceRequest) returns (SealInvoiceResponse);
+}