billing

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package billing is the module manifest: what a tenant is paying for.

It is the shape every module follows — contracts/, internal/, and one exported function taking a struct of typed dependencies and returning a module.Module — with one asymmetry worth naming at the top. Plans are a collection an administrator maintains, so they are a rest.Spec. The subscription is not a collection: a tenant is the customer, so it has one, and a singleton has no list, no create and no id in its path. Its three routes are internal/handler.go, the only hand-written ones here.

Renewal is the other thing to read first. Taking money is a call to somebody else's machine, so it never happens inside a database transaction: the job asks the service what is owed, closes that transaction, charges, and opens another to record the answer. internal/renew.go is the shape.

Index

Constants

This section is empty.

Variables

Manual is the PaymentProvider that records what is owed and moves no money. main wires it, or whatever a deployment has instead, so the choice is visible in the file that composes the application — as the mailer is.

Functions

func Module

func Module(deps Deps) module.Module

Module is the manifest. The implementation is constructed here, in one line, and handed to the two places that use it.

Types

type Deps

type Deps struct {
	// Tenants is how the nightly renewal reaches every tenant.
	Tenants jobs.TenantLister

	// Payments takes the money. There is one implementation here, Manual; the
	// ones that speak to a payment processor live outside this repository.
	Payments contracts.PaymentProvider

	// RenewEvery replaces the nightly schedule with an interval, for a test
	// that cannot wait until two in the morning. Zero means the schedule.
	RenewEvery time.Duration
}

Deps is what this module cannot make for itself.

Directories

Path Synopsis
Package contracts is everything another module, an app or a test may know about billing: the two entities, the events, the permissions, the payment provider this module needs somebody else to satisfy, and the Service interface.
Package contracts is everything another module, an app or a test may know about billing: the two entities, the events, the permissions, the payment provider this module needs somebody else to satisfy, and the Service interface.
billingtest
Package billingtest is the conformance suite for contracts.Service, and a fake that passes it.
Package billingtest is the conformance suite for contracts.Service, and a fake that passes it.
Package internal is every implementation of the billing module.
Package internal is every implementation of the billing module.

Jump to

Keyboard shortcuts

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