1
0
Fork 0

invoice: add GetInvoices to proto

This call will return a stream of repeated Invoices, in order to submit
monthly audit summaries to accounting, including PDFs and JPK_V7 codes
(ie. GTU and SP codes).

Change-Id: Id9da2952a6358c5c2c737eee08c473c1fbcfbe7d
master
q3k 2020-11-16 22:59:33 +01:00 committed by q3k
parent b456c18bb2
commit 1ecf22da9a
2 changed files with 48 additions and 5 deletions

View File

@ -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")
}

View File

@ -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);
}