invoices

package
v1.801.231 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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

func Invoices

func Invoices(s *cloud.Service[core.State], c *zip.Ctx) error

Invoices answers GET /v1/admin/invoices.

GET /v1/admin/invoices?org=&status=&limit=

func Routes

func Routes(app *zip.App, s *cloud.Service[core.State])

Routes registers the fleet invoice view (SuperAdmin only, cross-tenant).

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL