revenue

package
v1.801.413 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: 9 Imported by: 0

Documentation

Overview

Package revenue is the fleet REVENUE aggregate (/v1/admin/revenue) — the operator's money board: total prepaid balances held, total realized spend, MRR, a per-customer revenue table, ARPU, and a real spend trend. SuperAdmin only (core.Admit).

This is ORTHOGONAL to /v1/admin/finance: finance is the COGS/margin god-view (what WE pay vendors); revenue is the CUSTOMER money view (what each customer holds/spends/ subscribes). Every number is a real commerce read; an unreachable org degrades to honest zero, and a partial fleet read marks its source degraded.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

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

Routes registers the fleet revenue board (SuperAdmin only, cross-tenant profitability).

Types

type RevenueCustomer

type RevenueCustomer struct {
	Org          string `json:"org"`
	Display      string `json:"display"`
	Plan         string `json:"plan"`
	BalanceCents int64  `json:"balanceCents"`
	SpendCents   int64  `json:"spendCents"`
	MRRCents     int64  `json:"mrrCents"`
}

RevenueCustomer is one row of the per-customer revenue table.

type RevenueData

type RevenueData struct {
	TotalBalancesCents int64               `json:"totalBalancesCents"`
	TotalSpendCents    int64               `json:"totalSpendCents"`
	MRRCents           int64               `json:"mrrCents"`
	Customers          int                 `json:"customers"`
	PayingCustomers    int                 `json:"payingCustomers"`
	ARPUCents          int64               `json:"arpuCents"`
	PerCustomer        []RevenueCustomer   `json:"perCustomer"`
	SpendTrend         []core.SeriesPoint  `json:"spendTrend"`
	GeneratedAt        string              `json:"generatedAt"`
	Sources            []core.SourceStatus `json:"sources"`
}

RevenueData is the whole GET /v1/admin/revenue payload.

func Compute

func Compute(s *cloud.Service[core.State], ctx context.Context, cr iam.Creds) (RevenueData, error)

Compute builds the fleet revenue aggregate. It is split out of the handler so the consolidated money board (/v1/admin/money) folds the SAME numbers this endpoint serves: one aggregation, two views, no second implementation to drift.

type RevenueOut

type RevenueOut struct {
	Status string       `json:"status"`
	Msg    string       `json:"msg"`
	Data   *RevenueData `json:"data"`
}

RevenueOut is the GET /v1/admin/revenue envelope.

Jump to

Keyboard shortcuts

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