Skip to content

CAP-MBR-MEM-013Bill renewals in runs, on demand or on a schedule

Markdown

CAP-MBR-MEM-013

Bill renewals in runs, on demand or on a schedule

Markdown
  • DocumentDraft
  • Product intentConfirmed
  • ImplementationPartially observed

KindCapabilityProduct areaMembershipModuleMemberships, Applications and Membership BillingRevision1

Read atservices-membership 5994c270react-console baf6dae3

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
Each renewing member gets one renewal order, one notice and each planned reminder, never twice.Lapsed members are dropped with the run's reason.Nothing is billed for a term that changed after it was planned.
Surfaces
consoleapijob
Constraints
A run's filters and actions are each at most 4 KB.
Intent sources
services-membership:README.md#2026-10-18 — Final acceptanceservices-membership:docs/migrations/participant/README.md#Billing runs

Controls

45 controls apply, from the corpus control catalogue.

TC-AVL-002 TC-AVL-003 TC-AVL-004 TC-AZ-001 TC-AZ-002 TC-AZ-003 TC-AZ-004 TC-AZ-005 TC-AZ-006 TC-CHG-001 TC-CHG-002 TC-CHG-003 TC-CHG-004 TC-CRY-001 TC-CRY-002 TC-CRY-003 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-DAT-007 TC-IAM-001 TC-IAM-002 TC-IAM-004 TC-IAM-005 TC-IAM-006 TC-LOG-001 TC-LOG-002 TC-LOG-003 TC-LOG-004 TC-LOG-005 TC-MON-001 TC-MON-002 TC-MON-004 TC-PI-001 TC-PI-002 TC-PI-003 TC-PI-004 TC-PI-005 TC-PRV-001 TC-PRV-002 TC-SEC-001 TC-SEC-004 TC-TEN-001 TC-TEN-002 TC-TEN-003

Permissions

KeyChecked atScope
membership.billing.readapitenant
membership.billing.manageapitenant

Business Rules

15 rules, 15 to be proved before approval. A rule's product intent is derived from its origin: 15 confirmed by a product decision, the rest inheriting this capability's confirmed.

IdRuleKindEnforced atProvenance
01must prove
Confirmed
A billing template names its program, its filters and actions, and, when it drops lapsed terms, a status reason that applies to terminations.
no proof recorded yet
validationapi, servicetest
02must prove
Confirmed
A run is created from a template, copying its filters, actions and drop reason so the run is reproducible, or from its own, over a range of term end dates; a template of another program is refused.
no proof recorded yet
policyservicetest
03must prove
Confirmed
Planning on a business date takes the committed terms of principal memberships of the program ending in the range, of the types and packages the filters allow, and leaves out terms already renewed, terms that never end, suspended memberships, and flow-down or assigned memberships.
no proof recorded yet
policyservicetest
services-membership:modules/billing/tests/unit/run-plan.spec.ts#leaves out a term already renewed (a later effective or pending term)
04must prove
Confirmed
A candidate whose term ends on or after the run's date less its grace is renewing; one that ended earlier is lapsed.
no proof recorded yet
calculationservicetest
services-membership:modules/billing/tests/unit/run-plan.spec.ts#classes a term ending before the date less its grace as lapsed
05must prove
Confirmed
A renewing term is planned a renewal order, or an auto-renewal order and an expiring-card warning when the member auto-renews with a stored payment method, plus the notice and each reminder the run asks for; a lapsed term is planned a drop; do-not-renew and do-not-drop members are left alone unless the filters include them.
no proof recorded yet
policyservicetest
services-membership:modules/billing/tests/unit/run-plan.spec.ts#plans an auto-renewal order and the expiring card warning for a stored payment method
06must prove
Confirmed
A plan counts its candidates, their classes, the exclusions and the planned actions; a replan adds only what is new.
no proof recorded yet
calculationservicetest
services-membership:modules/billing/tests/unit/run-plan.spec.ts#counts the candidates, their classes, the exclusions and the planned actions
07must prove
Confirmed
Execution acts on each planned action once and settles it with its effect; an action whose term changed since it was planned is settled as stale and does nothing, and executing a run again does nothing.
no proof recorded yet
invariantservicetest
services-membership:modules/billing/tests/integration/billing-runs.integration.spec.ts#refuses as stale an action whose term changed after planning
08must prove
Confirmed
A renewal order is prepared through Membership's own checkout preparation and placed with the action as its retry key, so an order Membership would refuse is never placed and a repeat never places two; a member who renewed meanwhile is skipped.
no proof recorded yet
policyservicetest
services-membership:modules/billing/tests/integration/billing-runs.integration.spec.ts#executes on the jobs engine: one order per renewing candidate (Jo’s with both dues chapters), a notice and reminder each, one drop per lapsed term
09must prove
Confirmed
A drop terminates the lapsed term with the run's reason, effective on the run's date, and an expired term keeps its dates.
no proof recorded yet
lifecycleservicetest
10must prove
Confirmed
A failed execution returns the run to planned, keeping the actions it settled, and an execution that never starts does not leave the run executing for ever.
no proof recorded yet
lifecycleserviceunknown
11must prove
Confirmed
Plan, execute and cancel are made at the version read and only from a status that allows them; a run is cancelled only before it executes, and its planned actions stay as the record of what would have happened.
no proof recorded yet
validationservicetest
12must prove
Confirmed
A recurring run creates one run per occurrence of its schedule, in the association's time zone, over the terms ending at the configured offsets from the occurrence's date; it plans it on that date and executes it when set to; a redelivered occurrence finds the run it created.
no proof recorded yet
policyservice, databasetest
services-membership:modules/billing/tests/integration/billing-runs.integration.spec.ts#creates and plans one run per occurrence of a recurring run, a redelivered occurrence finding it
13must prove
Confirmed
Of two changes to a recurring run made at the same version, one applies and the other is refused.
no proof recorded yet
invariantservicetest
services-membership:modules/billing/tests/integration/recurring-billing-run-concurrency.integration.spec.ts#applies one of two changes made at the same version and refuses the other with version_mismatch
14must prove
Confirmed
Readers may read templates, runs, actions and recurring runs; only billing managers create, plan, execute or cancel them.
no proof recorded yet
permissionapitest
services-membership:tests/e2e/billing-api.e2e.spec.ts#lets a reader read the run and refuses it the planning
15must prove
Confirmed
Notices, reminders and warnings go to a person's first e-mail address; an organization member, and a person with no address, is skipped as having no recipient.
no proof recorded yet
policyservicetest

Scenarios

IdGivenWhenThenProvenance
01A renewal run planned on 15 March 2027 over the FAA members, inside Regular's 120-day window.It is executed, then executed again.Pat, Lee and Jo each get one order (Jo's with both chapters' dues), a notice and a reminder; Sam, Kim and Alex are dropped; the second execution does nothing.test
02A monthly recurring notice run in the association's time zone.An occurrence is delivered twice.One run exists for that business day, planned on it.test

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.