Repository navigation
Conversation
Add InvoiceKind, Invoice.kind, Invoice.idempotency_key and InvoiceLineItem.external_id so the billing platform can bill an organization outside of a contract, and a OneOffInvoiceUpdated event so the requesting service learns when such an invoice is paid, closed unpaid or refunded.
|
The latest Buf updates on your PR. Results from workflow ci / buf-checks (pull_request).
|
Identify the service that requested a one-off invoice on the Invoice and on OneOffInvoiceUpdated, so a handler can recognize its own invoices and map idempotency_key back to its records.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the proto surface for one-off invoices: invoices the billing platform bills to an organization outside of any contract, charged immediately.
InvoiceKindandInvoice.kind.INVOICE_KIND_UNSPECIFIEDcovers invoices written before kinds existed, which are all contract invoices, so consumers only need to test forINVOICE_KIND_ONE_OFF.Invoice.idempotency_key: caller-supplied key that makes one-off creation safe to retry. It is unique per organization andclient_id.Invoice.client_id: names the service that requested a one-off invoice. Each service picks its own idempotency keys, so a key only means something together with the client that chose it.InvoiceLineItem.external_id: the caller's own identifier for a line. Kept separate fromtypeso callers can bill for new products without platform enum changes, and so platform code that reads meaning intotypeprefixes never sees caller values.OneOffInvoiceUpdatedevent (EventPayloadfield 8) with PAID / CLOSED_UNPAID / REFUNDED outcomes, invoice-level amounts only. It carriesclient_idandidempotency_key: a handler acts only on events with its ownclient_idand uses the key to find its own transaction.All additions; no existing fields change.
Consumed by the getsentry stack below; those PRs can't pass CI until this is released and pinned in sentry.
Stack (each getsentry PR is based on the one above it; G1 is based on
master):InvoiceKind,Invoice.kind/idempotency_key,InvoiceLineItem.external_id,OneOffInvoiceUpdatedsentry-protosin sentry once P1 is releasedkind,idempotency_key,external_idcolumns(organization_id, idempotency_key)kind=CONTRACT, proto mapping, shared item builderContractService.create_one_off_invoiceOneOffInvoiceUpdatedeventskindtag, PDF disclaimerInvoicerService.bill_one_off_invoice+ option