Repository navigation
feat(payments): add the subscription data model and plan settings - #849
Conversation
🦋 Changeset detectedLatest commit: 8c8d6da The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
[Critical impact] The PR appears safe to merge; no actionable new issues remain.
|
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
3ade6a8 to
c3883f4
Compare
Coverage Report for CI Build 39155021027Warning No base build found for commit Coverage: 74.827%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
|
thank you @Priyanshubhartistm |
Description
First, behaviour-neutral step towards recurring membership plans (design: #673). It adds the storage and settings the later PRs build on; nothing reads them yet, so with no plans configured the relay behaves exactly as before.
user_subscriptionstable (one row per pubkey: plan id, statusactive/renewal_pending/past_due/expired, current period start and end, grace end, cancel-at-period-end) andplan_id,period_start,period_endcolumns oninvoices. The subscription is keyed by pubkey, so there is no separatesubscription_idcolumn.current_period_endis NULL for a subscription that never ends.grandfatheredplan, so turning plans on later cannot lock anyone out.payments.subscriptionPlans[](id,amountin msats,intervalSeconds,graceSeconds, optionaldescriptionand per-planlimits), empty by default, documented inCONFIGURATION.mdand validated invalidateSettings: ids are unique and notgrandfathered, amounts are positive integers and unique (the amount paid will select the plan), intervals positive, grace non-negative.UserSubscriptionRepository(find by pubkey, upsert, and the three lookups the renewal/expiry sweeps need: due for renewal, period ended, grace ended);InvoiceRepositoryand theInvoicetype carry the plan and period, which an existing invoice never has rewritten..knip.jsonignores the new repository until a later PR uses it.Related Issue
Closes #848
Motivation and Context
Admission today is a one-time boolean, so nothing records a paid period, a plan, or when access ends. Recurring billing and tiered access (#673) need that state first, and landing it on its own keeps the follow-up PRs small to review.