invoices

package
v1.801.433 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 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.Admit).

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 Routes

func Routes(z *zip.App)

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.

type InvoicesIn

type InvoicesIn struct {
	// Status filters on the invoice's LATEST lifecycle status (paid, open, void, …),
	// matched case-insensitively.
	Status string `json:"status"`
	// Org filters to one tenant, matched exactly.
	Org string `json:"org"`
	// Limit caps the rows returned. total still reports the full match count.
	Limit string `json:"limit"`
}

InvoicesIn is the GET /v1/admin/invoices filter.

type InvoicesOut

type InvoicesOut struct {
	Status string       `json:"status"`
	Msg    string       `json:"msg"`
	Data   []InvoiceRow `json:"data"`
	Total  *int         `json:"total,omitempty"`
}

InvoicesOut is the GET /v1/admin/invoices envelope. total is the count BEFORE limit truncates, so the console can say "showing 50 of 812".

func Invoices

func Invoices(ctx context.Context, in *InvoicesIn) (*InvoicesOut, error)

Invoices answers GET /v1/admin/invoices.

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

Jump to

Keyboard shortcuts

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