Documentation
¶
Overview ¶
Package invoices is the fleet INVOICE view (/v1/admin/invoices) — every issued invoice across every tenant: number, org, amount, status, issue + due date, plus the id a future detail view fetches /v1/billing/invoices/:id with. SuperAdmin only (core.Guard).
It reads the ONE shared warehouse (commerce.events) — the table the commerce analytics collector lands every invoice-lifecycle event in — over the SAME client (datastore.Query) the o11y/compute lenses use, with ZERO per-org fan-out: one GROUP BY resolves each invoice's LATEST lifecycle state (argMax by timestamp), so the whole fleet is one query, not N per-org commerce reads. Honest by construction: no datastore connected or the collector's table not provisioned yet → the real empty list, never a fabricated row. Optional ?org= scopes to one tenant, ?status= filters the LATEST status, ?limit= caps the list.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InvoiceRow ¶
type InvoiceRow struct {
ID string `json:"id"`
Number string `json:"number"`
Org string `json:"org"`
Display string `json:"display"`
Status string `json:"status"`
AmountCents int64 `json:"amountCents"`
Currency string `json:"currency"`
Issued string `json:"issued"`
Due string `json:"due"`
}
InvoiceRow is one row of GET /v1/admin/invoices — an issued invoice at a glance, tagged with its owning org. Money is USD cents; timestamps are RFC3339 strings.