domain

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillingInterval

type BillingInterval string

BillingInterval controls how frequently a subscription renews.

const (
	BillingMonthly BillingInterval = "monthly"
	BillingYearly  BillingInterval = "yearly"
)

type Invoice

type Invoice struct {
	ID             string
	OrganizationID string
	SubscriptionID string
	Status         InvoiceStatus
	Number         string
	Lines          []InvoiceLineItem
	Subtotal       int // cents
	Tax            int // cents
	Total          int // cents
	Currency       string
	DueDate        *time.Time
	PaidAt         *time.Time
	ExternalID     string // e.g. Stripe invoice ID
	CreatedAt      time.Time
}

Invoice is an immutable billing record.

type InvoiceLineItem

type InvoiceLineItem struct {
	ID          string
	Description string
	Quantity    int
	UnitAmount  int // cents
	TotalAmount int // cents
}

InvoiceLineItem is a single line on an invoice.

type InvoiceStatus

type InvoiceStatus string

InvoiceStatus reflects the lifecycle of an invoice.

const (
	InvoiceDraft         InvoiceStatus = "draft"
	InvoiceOpen          InvoiceStatus = "open"
	InvoicePaid          InvoiceStatus = "paid"
	InvoiceVoid          InvoiceStatus = "void"
	InvoiceUncollectible InvoiceStatus = "uncollectible"
)

type Plan

type Plan struct {
	ID             string
	Tier           string
	Name           string
	Description    string
	PricePerMonth  int // in cents
	PricePerYear   int // in cents
	MaxGameServers int
	MaxTeamMembers int
	SupportLevel   string
}

Plan describes what a subscription tier includes.

type Subscription

type Subscription struct {
	ID                 string
	OrganizationID     string
	Plan               Plan
	Status             SubscriptionStatus
	Interval           BillingInterval
	CurrentPeriodStart time.Time
	CurrentPeriodEnd   time.Time
	CancelAtPeriodEnd  bool
	TrialEnd           *time.Time
	ExternalID         string // e.g. Stripe subscription ID
	CreatedAt          time.Time
	UpdatedAt          time.Time
}

Subscription is the billing aggregate root.

func (*Subscription) IsActive

func (s *Subscription) IsActive() bool

IsActive returns true if the subscription is in a state that grants access.

type SubscriptionStatus

type SubscriptionStatus string

SubscriptionStatus reflects the lifecycle of a billing subscription.

const (
	SubscriptionTrialing SubscriptionStatus = "trialing"
	SubscriptionActive   SubscriptionStatus = "active"
	SubscriptionPastDue  SubscriptionStatus = "past_due"
	SubscriptionCanceled SubscriptionStatus = "canceled"
	SubscriptionUnpaid   SubscriptionStatus = "unpaid"
	SubscriptionPaused   SubscriptionStatus = "paused"
)

Jump to

Keyboard shortcuts

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