diff --git a/bgpwtf/invoice/main.go b/bgpwtf/invoice/main.go index 5133010a..ae17dbb6 100644 --- a/bgpwtf/invoice/main.go +++ b/bgpwtf/invoice/main.go @@ -130,6 +130,10 @@ func (s *service) SealInvoice(ctx context.Context, req *pb.SealInvoiceRequest) ( return &pb.SealInvoiceResponse{}, nil } +func (s *service) GetInvoices(req *pb.GetInvoicesRequest, srv pb.Invoicer_GetInvoicesServer) error { + return status.Error(codes.Unimplemented, "unimplemented") +} + func init() { flag.Set("logtostderr", "true") } diff --git a/bgpwtf/invoice/proto/invoice.proto b/bgpwtf/invoice/proto/invoice.proto index e6caae58..70e69232 100644 --- a/bgpwtf/invoice/proto/invoice.proto +++ b/bgpwtf/invoice/proto/invoice.proto @@ -312,9 +312,48 @@ message SealInvoiceRequest { 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); +message GetInvoicesRequest { + // Return all invoices issued in a given year. + message ForYear { + int32 year = 1; + } + // Return all invoices issued in a given month of a year. + message ForMonth { + int32 year = 1; + int32 month = 2; + } + + oneof range { + ForYear for_year = 1; + ForMonth for_month = 2; + } +} + +message GetInvoicesResponse { + // Each chunk may contain an arbitrary amount of invoices, and each + // GetInvoices request may return an arbitrary amount of + // GetInvoicesResponses in a stream. + repeated Invoice invoice = 1; +} + +service Invoicer { + // Create an invoice with given data, returning UID. The newly created + // invoice is created as a proforma invoice and not yet sealed, ie. not + // given a unique, sequential ID. + rpc CreateInvoice(CreateInvoiceRequest) returns (CreateInvoiceResponse); + + // Get invoice details for a given UID. + rpc GetInvoice(GetInvoiceRequest) returns (GetInvoiceResponse); + + // Return chunks of a rendered PDF for a given UID. If the invoice is + // sealed, the stored PDF will be returned, otherwise a PDF will be + // rendered on the fly. + rpc RenderInvoice(RenderInvoiceRequest) returns (stream RenderInvoiceResponse); + + // Seal invoice, ie. assign it a sequential ID and render it to an + // immutable PDF for audit purposes. + rpc SealInvoice(SealInvoiceRequest) returns (SealInvoiceResponse); + + // Return a summarized detail of invoice data for a given filter. + rpc GetInvoices(GetInvoicesRequest) returns (stream GetInvoicesResponse); }