-
Notifications
You must be signed in to change notification settings - Fork 91
feat(subs): add BillingAnchor #2930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
ALTER TABLE "subscriptions" ADD COLUMN "billing_anchor" timestamptz; | ||
|
||
-- update all entries to set the billing anchor to the active_from time | ||
UPDATE "subscriptions" SET "billing_anchor" = "active_from" WHERE "billing_anchor" IS NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original spec was that we align the billing anchor to the phase's start to prevent pro-rating at the beginning of the phases if the alignment mode is set to phase.
I would recommend to add two fields:
- The alignment kind which is phase or anchor (enum)
- And an optional billing anchor if the alignment is set to anchor.
The major difference is that in phase mode the alignment is guaranteed to the phase's start so no prorating occurs at the beginning of the phase.
If the billing anchor is set to anchor, then each phase's first period will be pro-rated so that later items are aligned.
9de492a
to
a64b4b2
Compare
24f28a1
to
a71ee81
Compare
a64b4b2
to
3b4cfe9
Compare
a71ee81
to
9cf48de
Compare
9cf48de
to
c4b8ce8
Compare
dd5b5ab
to
8a0c51c
Compare
… billing cadence to be at least 1 month
Co-authored-by: Peter Turi <[email protected]>
8a0c51c
to
d8bcbb2
Compare
c4b8ce8
to
17aaadc
Compare
Overview
Add custom billing anchor different from subscription start
TODO