go/svc/invoice: import from code.hackerspace.pl/q3k/inboice
diff --git a/proto/invoice/BUILD.bazel b/proto/invoice/BUILD.bazel
new file mode 100644
index 0000000..0108f44
--- /dev/null
+++ b/proto/invoice/BUILD.bazel
@@ -0,0 +1,23 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
+proto_library(
+ name = "invoice_proto",
+ srcs = ["invoice.proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_library(
+ name = "invoice_go_proto",
+ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+ importpath = "code.hackerspace.pl/hscloud/proto/invoice",
+ proto = ":invoice_proto",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "go_default_library",
+ embed = [":invoice_go_proto"],
+ importpath = "code.hackerspace.pl/hscloud/proto/invoice",
+ visibility = ["//visibility:public"],
+)
diff --git a/proto/invoice/invoice.proto b/proto/invoice/invoice.proto
new file mode 100644
index 0000000..e56253d
--- /dev/null
+++ b/proto/invoice/invoice.proto
@@ -0,0 +1,78 @@
+syntax = "proto3";
+
+package invoice;
+
+message Item {
+ string title = 1;
+ uint64 count = 2;
+ uint64 unit_price = 3;
+ // in thousands of percent points
+ // (ie 23% == 23000)
+ uint64 vat = 4;
+}
+
+message ContactPoint {
+ string medium = 1;
+ string contact = 2;
+}
+
+message Invoice {
+ 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;
+ int64 days_due = 8;
+ string iban = 9;
+ string swift = 10;
+}
+
+message CreateInvoiceRequest {
+ Invoice invoice = 1;
+}
+
+message CreateInvoiceResponse {
+ // Unique invoice ID
+ string uid = 1;
+}
+
+message GetInvoiceRequest {
+ string uid = 1;
+}
+
+message GetInvoiceResponse {
+ Invoice invoice = 1;
+ enum State {
+ STATE_INVALID = 0;
+ STATE_PROFORMA = 1;
+ STATE_SEALED = 2;
+ };
+ State state = 2;
+ string final_uid = 3;
+}
+
+message RenderInvoiceRequest {
+ string uid = 1;
+}
+
+message RenderInvoiceResponse {
+ bytes data = 1;
+}
+
+message SealInvoiceRequest {
+ string uid = 1;
+}
+
+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);
+}