Documentation
¶
Overview ¶
Package subscription is the facade of the subscription module: plans and groups, the storefront, user subscriptions and their self-service, subscription delivery and client applications, order fulfillment and provider entitlements, trials, quota tasks, the lifecycle sweeps and calendar traffic resets, plan inventory and traffic usage accounting. See docs/design/adr-001-modular-monolith.md.
Index ¶
- Constants
- Variables
- func NewRepoBuilder() repository.SubscriptionBuilder
- type Access
- type Accounts
- type DeliveryConfig
- type DeliveryLimiter
- type Deps
- type FulfillmentOutcome
- type Inventory
- type InventoryStore
- type NodeReader
- type OrderReader
- type QuotaGiftLedger
- type Reads
- type RefundSettler
- type RequestMeta
- type ServedSubscription
- type Service
- type Store
- type SubscriptionTransactor
- type TrafficLogReader
- type TrafficUsage
- type TrafficUsageStore
- type TrialPolicy
Constants ¶
const ( InventoryReserveConsumer = inventory.InventoryReserveConsumer InventoryRestoreConsumer = inventory.InventoryRestoreConsumer )
These persisted consumer identities must remain stable across deployments.
const ( NotifyKindPurchase = fulfillment.NotifyPurchase NotifyKindRenewal = fulfillment.NotifyRenewal NotifyKindResetTraffic = fulfillment.NotifyResetTraffic )
The notices a fulfillment outcome can call for: a new subscription, a renewal, or a traffic reset.
const TrialGrantConsumer = trial.Consumer
TrialGrantConsumer is the trial grant's consumer identity on the event bus and in its inbox markers. It is persisted: renaming it would grant committed trials again.
Variables ¶
var ErrOutOfStock = inventory.ErrOutOfStock
ErrOutOfStock reports that the plan has no inventory left to reserve.
var ErrQuotaTaskUnretryable = quotatask.ErrUnretryable
ErrQuotaTaskUnretryable re-exports the quota subdomain's skip-retry sentinel for the queue shell.
Functions ¶
func NewRepoBuilder ¶ added in v1.15.2
func NewRepoBuilder() repository.SubscriptionBuilder
NewRepoBuilder exports the module-owned repository implementations for store assembly (ADR-001 step-6 preparation).
Types ¶
type Access ¶ added in v1.21.0
type Access interface {
// SubscriptionByToken returns the subscription holding the token. An
// unknown token reports gorm.ErrRecordNotFound.
SubscriptionByToken(ctx context.Context, token string) (*usersubEntity.Subscribe, error)
// SubscriptionByID returns the subscription. An unknown id reports
// gorm.ErrRecordNotFound.
SubscriptionByID(ctx context.Context, id int64) (*usersubEntity.Subscribe, error)
// SubscriptionsByIDs returns the subscriptions among the ids that exist.
SubscriptionsByIDs(ctx context.Context, ids []int64) ([]*usersubEntity.Subscribe, error)
// SubscriptionDetailsByIDs returns the subscriptions among the ids that
// exist, each with its plan.
SubscriptionDetailsByIDs(ctx context.Context, ids []int64) ([]*usersubEntity.SubscribeDetails, error)
// PlanByID returns the plan.
PlanByID(ctx context.Context, id int64) (*subscribe.Subscribe, error)
// ServableSubscriptionsByNodeScope returns the subscriptions the nodes
// of a scope may serve now: the servable subscriptions of the plans
// selecting any of the node ids or tags, by plan and id, each with its
// plan.
ServableSubscriptionsByNodeScope(ctx context.Context, nodeIDs []int64, tags []string) ([]ServedSubscription, error)
// ClearUserSubscriptionCaches drops the cached entries of every
// subscription the users hold, so the tokens of a deleted or disabled
// account stop resolving from the cache, and returns the node scope of
// their plans: the node user lists that still carry the subscriptions.
// A failed cache deletion is logged; the scope is returned all the same.
ClearUserSubscriptionCaches(ctx context.Context, userIDs []int64) (nodeIDs []int64, tags []string, err error)
// ClientApplications lists the client applications in their stored
// order.
ClientApplications(ctx context.Context) ([]*client.SubscribeApplication, error)
}
Access is the part of the facade the other modules compose (ADR-001 rule 4): entity-typed reads they assemble in memory instead of reading the subscription tables, and the cache invalidation when an account's access ends. Nothing here opens a transaction.
type Accounts ¶ added in v1.21.0
type Accounts interface {
// FindOne returns the account with its devices and auth methods,
// soft-deleted ones included.
FindOne(ctx context.Context, id int64) (*user.User, error)
// FindAccountState returns the account gate (enabled, deleted),
// soft-deleted accounts included.
FindAccountState(ctx context.Context, id int64) (*user.AccountState, error)
// FindUsersByIds returns the live accounts among ids.
FindUsersByIds(ctx context.Context, ids []int64) ([]*user.User, error)
// FindUserAuthMethodsByUserIds returns the method bindings of the
// accounts; soft-deleted accounts resolve to none.
FindUserAuthMethodsByUserIds(ctx context.Context, method string, userIds []int64) ([]*user.AuthMethods, error)
// QueryDevicePageList pages the account's devices, optionally only those
// of one subscription.
QueryDevicePageList(ctx context.Context, userid, subscribeId int64, page, size int) ([]*user.Device, int64, error)
// ClearUserCache drops the id-keyed cached projections of the accounts;
// ClearUserCacheOf every projection the loaded accounts derive.
ClearUserCache(ctx context.Context, userIDs ...int64) error
ClearUserCacheOf(ctx context.Context, users ...*user.User) error
}
Accounts is the module's port onto the identity domain: the owner accounts, devices and email bindings its use cases read, and the account-cache invalidation after they changed what an account shows. The composition root backs it with the identity facade (ADR-001 rule 4).
type DeliveryConfig ¶
DeliveryConfig re-exports the delivery subdomain's runtime snapshot.
type DeliveryLimiter ¶ added in v1.21.0
type DeliveryLimiter = delivery.FetchLimiter
DeliveryLimiter re-exports the delivery subdomain's per-address fetch limiter port.
func NewDeliveryLimiter ¶ added in v1.21.0
func NewDeliveryLimiter(rds *redis.Client) DeliveryLimiter
NewDeliveryLimiter returns the per-address fetch limiter of subscription delivery over rds: delivery.FetchRateQuota fetches per delivery.FetchRateWindow and address.
type Deps ¶
type Deps struct {
Plans repository.SubscribeRepo
UserSubs repository.UserSubscriptionRepo
Nodes NodeReader
Store SubscriptionTransactor
// NotifyPlanChanged broadcasts a plan update to connected devices.
NotifyPlanChanged func()
// IsTrialPlan reports whether the plan is the configured trial plan.
IsTrialPlan func(planID int64) bool
// Delivery dependencies.
Clients repository.ClientRepo
Logs repository.LogRepo
// DeliveryConfig reads the runtime-mutable delivery configuration.
DeliveryConfig func() DeliveryConfig
// DeliveryLimiter bounds the subscription fetches per client address
// (NewDeliveryLimiter); nil admits every fetch.
DeliveryLimiter DeliveryLimiter
// Accounts is the identity port of delivery, administration, lifecycle
// and quota use cases: owners, their devices and email bindings, and
// their cached projections.
Accounts Accounts
// User-subscription administration dependencies.
Traffic TrafficLogReader
// Operations composes only the persistence capabilities of this module's
// administration, lifecycle and fulfillment use cases.
Operations Store
// Orders, Refunds and QuotaGifts are the billing module's side of
// fulfillment, cancellation and quota tasks: the orders they read, the
// cancellation's refund stage and the quota task's gift stage.
Orders OrderReader
Refunds RefundSettler
QuotaGifts QuotaGiftLedger
Inbox repository.InboxRepo
// SingleModel forbids holding more than one blocking subscription;
// runtime-mutable, read per request.
SingleModel func() bool
// TrialPolicy snapshots the runtime-mutable registration-trial settings
// per call.
TrialPolicy func() TrialPolicy
// LifecycleNotify is the lifecycle sweep's owner notification channel.
LifecycleNotify sweep.Notifier
}
Deps declares everything the module needs; the composition root (internal/app) provides them.
type FulfillmentOutcome ¶ added in v1.15.1
type FulfillmentOutcome = fulfillment.Outcome
FulfillmentOutcome re-exports the fulfillment subdomain's notification context, and the NotifyKind* constants label which notice applies.
type Inventory ¶ added in v1.20.3
type Inventory interface {
Reserve(ctx context.Context, orderNo string, subscribeID int64) error
Restore(ctx context.Context, orderNo string, subscribeID int64) error
}
Inventory owns reservation persistence. Callers pass only business inputs.
func NewInventory ¶ added in v1.20.3
func NewInventory(store InventoryStore) Inventory
NewInventory returns the plan inventory over its store.
type InventoryStore ¶ added in v1.20.3
InventoryStore restricts order-driven inventory changes to subscription transactions and the durable inbox used to deduplicate them.
type NodeReader ¶ added in v1.21.0
type NodeReader interface {
delivery.NodeLister
storefront.NodeLister
application.NodeLister
}
NodeReader and TrafficLogReader are the network read ports (the network facade satisfies them): the nodes delivery, the storefront and the template preview list, and the admin view of a subscription's traffic.
type OrderReader ¶ added in v1.21.0
type OrderReader interface {
fulfillment.OrderReader
selfsub.OrderReader
}
OrderReader is the billing read port of fulfillment and the refund quote: the paid order by id or number, and the order with its renewals.
type QuotaGiftLedger ¶ added in v1.21.0
type QuotaGiftLedger = quotatask.GiftLedger
RefundSettler and QuotaGiftLedger re-export the billing ports of the cancellation's refund stage and the quota task's gift stage; the billing facade provides both.
type Reads ¶ added in v1.21.0
type Reads interface {
// FilterPlans pages the plans the filter selects.
FilterPlans(ctx context.Context, params *subscribe.FilterParams) (int64, []*subscribe.Subscribe, error)
// SubscriptionDetailsByID returns the subscription with its plan.
SubscriptionDetailsByID(ctx context.Context, id int64) (*usersubEntity.SubscribeDetails, error)
// UserSubscriptions lists the user's subscriptions with their plans;
// given statuses, only those in one of them.
UserSubscriptions(ctx context.Context, userID int64, statuses ...int64) ([]*usersubEntity.SubscribeDetails, error)
// HasBlockingSubscription reports whether the user holds a subscription
// that forbids buying another while only one may be held.
HasBlockingSubscription(ctx context.Context, userID int64) (bool, error)
// CountQuotaConsumingSubscriptions counts the user's subscriptions of the
// plan that count against its per-user purchase quota.
CountQuotaConsumingSubscriptions(ctx context.Context, userID, planID int64) (int64, error)
// SelectSubscriptionIDs returns the ids of the subscriptions the filter
// selects; CountSelectedSubscriptions counts them.
SelectSubscriptionIDs(ctx context.Context, filter *usersubEntity.SubscribeFilter) ([]int64, error)
CountSelectedSubscriptions(ctx context.Context, filter *usersubEntity.SubscribeFilter) (int64, error)
}
Reads is the part of the facade serving the other modules' plan and subscription reads that are not about node access (ADR-001 rule 4): the checkout's purchase checks, the storefront's plan list, the marketing target selection and the bot's views. The reads return the repositories' results and errors as they are, so a miss is still gorm.ErrRecordNotFound.
type RefundSettler ¶ added in v1.21.0
type RefundSettler = selfsub.RefundSettler
RefundSettler and QuotaGiftLedger re-export the billing ports of the cancellation's refund stage and the quota task's gift stage; the billing facade provides both.
type RequestMeta ¶
type RequestMeta = delivery.RequestMeta
RequestMeta re-exports the delivery subdomain's transport details.
type ServedSubscription ¶ added in v1.21.0
type ServedSubscription = nodeaccess.Served
ServedSubscription re-exports the node-access subdomain's served subscription: a subscription a node may serve now, with the plan whose speed and device limits apply to it.
type Service ¶
type Service interface {
// CheckSubscriptions runs the lifecycle sweeps (traffic exceeded,
// expired), committing status flips in subscription transactions with
// notification and cache invalidation as post-commit side effects.
CheckSubscriptions(ctx context.Context) error
// RemindExpiringSubscriptions warns owners whose subscription expires
// soon. It is a daily pass, not part of the minute-by-minute sweep: the
// notice is once per expiry and reaching users at a civil hour matters.
RemindExpiringSubscriptions(ctx context.Context) error
// ResetCalendarTraffic clears the traffic of the subscriptions owed their
// plan's calendar reset (1st of the month, monthly, yearly): those whose
// reset falls on today and those a missed run left unreset since their
// last reset day, each at most once per day however often a failed run
// is repeated.
ResetCalendarTraffic(ctx context.Context) error
// ProcessQuotaTask executes an admin-scheduled quota grant (time
// extension / gift credit) for the task's subscription scope.
ProcessQuotaTask(ctx context.Context, taskID int64) error
// FulfillPaidOrder applies a paid order's business effect (new
// subscription, renewal or traffic reset) exactly once and returns the
// notification context.
FulfillPaidOrder(ctx context.Context, orderNo string) (*FulfillmentOutcome, error)
ReconcileEntitlement(ctx context.Context, cmd dto.ReconcileEntitlementCommand) (*dto.EntitlementResult, error)
// GrantTrial consumes the identity.user_registered event: applies the
// registration trial exactly once (a disabled policy still consumes the
// event).
GrantTrial(ctx context.Context, userID int64) error
// The client-application management for subscription delivery.
CreateSubscribeApplication(ctx context.Context, req *dto.CreateSubscribeApplicationRequest) (*dto.SubscribeApplication, error)
UpdateSubscribeApplication(ctx context.Context, req *dto.UpdateSubscribeApplicationRequest) (*dto.SubscribeApplication, error)
DeleteSubscribeApplication(ctx context.Context, req *dto.DeleteSubscribeApplicationRequest) error
GetSubscribeApplicationList(ctx context.Context, req *dto.GetSubscribeApplicationListRequest) (*dto.GetSubscribeApplicationListResponse, error)
PreviewSubscribeTemplate(ctx context.Context, req *dto.PreviewSubscribeTemplateRequest) (*dto.PreviewSubscribeTemplateResponse, error)
CreateSubscribe(ctx context.Context, req *dto.CreateSubscribeRequest) error
UpdateSubscribe(ctx context.Context, req *dto.UpdateSubscribeRequest) error
DeleteSubscribe(ctx context.Context, req *dto.DeleteSubscribeRequest) error
BatchDeleteSubscribe(ctx context.Context, req *dto.BatchDeleteSubscribeRequest) error
GetSubscribeList(ctx context.Context, req *dto.GetSubscribeListRequest) (*dto.GetSubscribeListResponse, error)
GetSubscribeDetails(ctx context.Context, req *dto.GetSubscribeDetailsRequest) (*dto.Subscribe, error)
SubscribeSort(ctx context.Context, req *dto.SubscribeSortRequest) error
ResetAllSubscribeToken(ctx context.Context) (*dto.ResetAllSubscribeTokenResponse, error)
CreateSubscribeGroup(ctx context.Context, req *dto.CreateSubscribeGroupRequest) error
UpdateSubscribeGroup(ctx context.Context, req *dto.UpdateSubscribeGroupRequest) error
DeleteSubscribeGroup(ctx context.Context, req *dto.DeleteSubscribeGroupRequest) error
BatchDeleteSubscribeGroup(ctx context.Context, req *dto.BatchDeleteSubscribeGroupRequest) error
GetSubscribeGroupList(ctx context.Context) (*dto.GetSubscribeGroupListResponse, error)
QuerySubscribeList(ctx context.Context, req *dto.QuerySubscribeListRequest) (*dto.QuerySubscribeListResponse, error)
QuerySubscribeGroupList(ctx context.Context) (*dto.QuerySubscribeGroupListResponse, error)
QueryUserSubscribeNodeList(ctx context.Context) (*dto.QueryUserSubscribeNodeListResponse, error)
// Deliver renders the client configuration for a subscription token.
Deliver(ctx context.Context, meta RequestMeta, req *dto.SubscribeRequest) (*dto.SubscribeResponse, error)
// IsUserAgentAllowed gates delivery by the configured user-agent allowlist.
IsUserAgentAllowed(ctx context.Context, userAgent string) bool
// User self-service subscription management.
QueryUserSubscribe(ctx context.Context) (*dto.QueryUserSubscribeListResponse, error)
// ResetOwnSubscribeToken is the self-service variant; ownership of the
// subscription is enforced against the request context.
ResetOwnSubscribeToken(ctx context.Context, req *dto.ResetUserSubscribeTokenRequest) error
GetSubscribeLog(ctx context.Context, req *dto.GetSubscribeLogRequest) (*dto.GetSubscribeLogResponse, error)
UpdateUserSubscribeNote(ctx context.Context, req *dto.UpdateUserSubscribeNoteRequest) error
PreUnsubscribe(ctx context.Context, req *dto.PreUnsubscribeRequest) (*dto.PreUnsubscribeResponse, error)
// Unsubscribe cancels in a subscription transaction and settles the
// refund in a billing transaction, resumable via the idempotent inbox.
Unsubscribe(ctx context.Context, req *dto.UnsubscribeRequest) error
// Admin-side user subscription management.
CreateUserSubscribe(ctx context.Context, req *dto.CreateUserSubscribeRequest) error
DeleteUserSubscribe(ctx context.Context, req *dto.DeleteUserSubscribeRequest) error
UpdateUserSubscribe(ctx context.Context, req *dto.UpdateUserSubscribeRequest) error
GetUserSubscribe(ctx context.Context, req *dto.GetUserSubscribeListRequest) (*dto.GetUserSubscribeListResponse, error)
GetUserSubscribeById(ctx context.Context, req *dto.GetUserSubscribeByIdRequest) (*dto.UserSubscribeDetail, error)
GetUserSubscribeDevices(ctx context.Context, req *dto.GetUserSubscribeDevicesRequest) (*dto.GetUserSubscribeDevicesResponse, error)
GetUserSubscribeLogs(ctx context.Context, req *dto.GetUserSubscribeLogsRequest) (*dto.GetUserSubscribeLogsResponse, error)
GetUserSubscribeResetTrafficLogs(ctx context.Context, req *dto.GetUserSubscribeResetTrafficLogsRequest) (*dto.GetUserSubscribeResetTrafficLogsResponse, error)
GetUserSubscribeTrafficLogs(ctx context.Context, req *dto.GetUserSubscribeTrafficLogsRequest) (*dto.GetUserSubscribeTrafficLogsResponse, error)
ResetUserSubscribeToken(ctx context.Context, req *dto.ResetUserSubscribeTokenRequest) error
ResetUserSubscribeTraffic(ctx context.Context, req *dto.ResetUserSubscribeTrafficRequest) error
ToggleUserSubscribeStatus(ctx context.Context, req *dto.ToggleUserSubscribeStatusRequest) error
// ChangeUserSubscribeStatus stops or resumes a subscription the caller
// saw in status from, refusing when the status changed meanwhile.
ChangeUserSubscribeStatus(ctx context.Context, id int64, from, to uint8) error
// Access and Reads serve the other modules' reads and cache
// invalidation (see access.go and reads.go).
Access
Reads
}
Service is the only surface other code may depend on; the implementation lives under internal/ where the compiler seals it off.
type Store ¶ added in v1.20.3
type Store interface {
usersub.Store
selfsub.Store
sweep.Store
trial.Store
fulfillment.Store
quotatask.Store
trafficreset.Store
}
Store is the persistence capability required by this package. It excludes unrelated repositories and application-wide transactions.
type SubscriptionTransactor ¶
type SubscriptionTransactor = plan.SubscriptionTransactor
SubscriptionTransactor re-exports the plan subdomain's transaction port.
type TrafficLogReader ¶ added in v1.21.0
type TrafficLogReader = usersub.TrafficLogReader
NodeReader and TrafficLogReader are the network read ports (the network facade satisfies them): the nodes delivery, the storefront and the template preview list, and the admin view of a subscription's traffic.
type TrafficUsage ¶ added in v1.20.3
type TrafficUsage interface {
ApplyBucketOnce(ctx context.Context, bucket string, deltas []traffic.SubscribeTrafficDelta) error
}
TrafficUsage charges the network's traffic buckets to the subscriptions' usage, each bucket at most once.
func NewTrafficUsage ¶ added in v1.20.3
func NewTrafficUsage(store TrafficUsageStore) TrafficUsage
NewTrafficUsage returns the usage accounting over its store.
type TrafficUsageStore ¶ added in v1.20.3
type TrafficUsageStore = trafficusage.Store
TrafficUsageStore restricts usage accounting to subscription transactions and the durable inbox that deduplicates the buckets.
type TrialPolicy ¶ added in v1.15.2
TrialPolicy re-exports the trial subdomain's policy snapshot for the composition root.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dto is the subscription module's contract: the commands, queries and results of its facade and HTTP handlers, and the module's own JSON snapshots of the identity and network data its views embed.
|
Package dto is the subscription module's contract: the commands, queries and results of its facade and HTTP handlers, and the module's own JSON snapshots of the identity and network data its views embed. |
|
entity
|
|
|
client
Package client holds the subscription module's client-application entity (the subscribe_application table): the client apps subscriptions are delivered to, with their templates and download links.
|
Package client holds the subscription module's client-application entity (the subscribe_application table): the client apps subscriptions are delivered to, with their templates and download links. |
|
entitlement
Package entitlement stores provider-authoritative subscription periods.
|
Package entitlement stores provider-authoritative subscription periods. |
|
subscribe
Package subscribe holds the subscription module's plan entities: the plans (the subscribe table) and their groups (subscribe_group).
|
Package subscribe holds the subscription module's plan entities: the plans (the subscribe table) and their groups (subscribe_group). |
|
usersub
Package usersub holds the subscription domain's user-subscription entities (ADR-001 step 5: entity packages follow table ownership).
|
Package usersub holds the subscription domain's user-subscription entities (ADR-001 step 5: entity packages follow table ownership). |
|
internal
|
|
|
application
Package application implements the client-application subdomain of the subscription module: managing the subscribe clients and previewing their delivery templates.
|
Package application implements the client-application subdomain of the subscription module: managing the subscribe clients and previewing their delivery templates. |
|
deduction
Package deduction provides functionality for calculating remaining amounts in subscription billing systems, supporting various time units and traffic-based calculations.
|
Package deduction provides functionality for calculating remaining amounts in subscription billing systems, supporting various time units and traffic-based calculations. |
|
delivery
Package delivery implements the subscription delivery subdomain of the subscription module: token-authenticated rendering of client configs via the adapter, with notice placeholders for expired/exhausted subscriptions.
|
Package delivery implements the subscription delivery subdomain of the subscription module: token-authenticated rendering of client configs via the adapter, with notice placeholders for expired/exhausted subscriptions. |
|
fulfillment
Package fulfillment applies a paid order's business effect: creating, renewing or traffic-resetting the user subscription in the fulfillment transaction, idempotent via the inbox marker.
|
Package fulfillment applies a paid order's business effect: creating, renewing or traffic-resetting the user subscription in the fulfillment transaction, idempotent via the inbox marker. |
|
inventory
Package inventory reserves and restores plan stock for orders, each at most once per order through inbox markers.
|
Package inventory reserves and restores plan stock for orders, each at most once per order through inbox markers. |
|
nodeaccess
Package nodeaccess serves the subscription side of node access to the other modules (ADR-001 rule 4): the subscriptions the network may serve, found by token, id or node scope together with their plans, and the cache invalidation when an account's access ends.
|
Package nodeaccess serves the subscription side of node access to the other modules (ADR-001 rule 4): the subscriptions the network may serve, found by token, id or node scope together with their plans, and the cache invalidation when an account's access ends. |
|
period
Package period holds the subscription module's calendar rules: the time units that size a subscription term and the traffic reset cycles of a plan.
|
Package period holds the subscription module's calendar rules: the time units that size a subscription term and the traffic reset cycles of a plan. |
|
plan
Package plan implements the subscription plan management subdomain of the subscription module: plan and group CRUD, ordering and token resets.
|
Package plan implements the subscription plan management subdomain of the subscription module: plan and group CRUD, ordering and token resets. |
|
quotatask
Package quotatask processes the admin-scheduled quota grants: extending subscription time and crediting gift money for a scope of subscriptions.
|
Package quotatask processes the admin-scheduled quota grants: extending subscription time and crediting gift money for a scope of subscriptions. |
|
render
Package render builds the client configurations of subscription delivery and template previews: it maps nodes to the proxies a client template renders and executes the template in the application's output format.
|
Package render builds the client configurations of subscription delivery and template previews: it maps nodes to the proxies a client template renders and executes the template in the application's output format. |
|
repo
Package repo holds the subscription module's repository implementations: plans and groups, user subscriptions with their traffic accounting and cache bridges, client applications and provider entitlements (ADR-001 step-6 preparation).
|
Package repo holds the subscription module's repository implementations: plans and groups, user subscriptions with their traffic accounting and cache bridges, client applications and provider entitlements (ADR-001 step-6 preparation). |
|
selfsub
Package selfsub implements the user self-service subscription management of the subscription module: viewing, token reset, notes, and the two-phase cancellation whose refund stage the billing module settles.
|
Package selfsub implements the user self-service subscription management of the subscription module: viewing, token reset, notes, and the two-phase cancellation whose refund stage the billing module settles. |
|
storefront
Package storefront implements the public subscription listings of the subscription module.
|
Package storefront implements the public subscription listings of the subscription module. |
|
subtest
Package subtest is the subscription module's behaviour-test fixture: a SQLite database with the module's tables and a miniredis cache behind the module's real repositories.
|
Package subtest is the subscription module's behaviour-test fixture: a SQLite database with the module's tables and a miniredis cache behind the module's real repositories. |
|
sweep
Package sweep implements the subscription lifecycle sweep: marking traffic-exceeded and expired subscriptions finished, then firing the retryable side effects (owner notification, cache invalidation).
|
Package sweep implements the subscription lifecycle sweep: marking traffic-exceeded and expired subscriptions finished, then firing the retryable side effects (owner notification, cache invalidation). |
|
trafficreset
Package trafficreset applies the plans' calendar traffic resets: on the 1st of every month, monthly on the start day and yearly on the start date (the rules live in period).
|
Package trafficreset applies the plans' calendar traffic resets: on the 1st of every month, monthly on the start day and yearly on the start date (the rules live in period). |
|
trafficusage
Package trafficusage owns idempotent subscription usage accounting.
|
Package trafficusage owns idempotent subscription usage accounting. |
|
trial
Package trial grants the registration trial subscription.
|
Package trial grants the registration trial subscription. |
|
usersub
Package usersub implements the admin-side user subscription management of the subscription module.
|
Package usersub implements the admin-side user subscription management of the subscription module. |
|
transport
|
|
|
http
Package handler serves subscription delivery over HTTP: the client configuration for a subscription token or a pan-domain host.
|
Package handler serves subscription delivery over HTTP: the client configuration for a subscription token or a pan-domain host. |
|
http/admin/application
Package application holds the admin HTTP handlers for the client applications of subscription delivery and their template previews.
|
Package application holds the admin HTTP handlers for the client applications of subscription delivery and their template previews. |
|
http/admin/subscribe
Package subscribe holds the admin HTTP handlers for plans and plan groups.
|
Package subscribe holds the admin HTTP handlers for plans and plan groups. |
|
http/admin/user
Package user holds the admin HTTP handlers for the users' subscriptions.
|
Package user holds the admin HTTP handlers for the users' subscriptions. |
|
http/public/subscribe
Package subscribe holds the public HTTP handlers for the plan storefront and the owner's subscription nodes.
|
Package subscribe holds the public HTTP handlers for the plan storefront and the owner's subscription nodes. |
|
http/public/user
Package user holds the HTTP handlers through which users manage their own subscriptions.
|
Package user holds the HTTP handlers through which users manage their own subscriptions. |