fix(payment-gated-subs): Skip billing of missed periods after activation of incomplete subscriptions#5935
Open
osmarluz wants to merge 1 commit into
Conversation
…ion of incomplete subscriptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
When a payment-gated subscription stays incomplete past one or more billing boundaries, activation replayed every boundary crossed during the gating window (
BillMissedPeriodsService): the customer who just approved the gating payment immediately received one full periodic invoice per elapsed period, paying for time the subscription was never active.Description
BillMissedPeriodsServiceis replaced byBillCurrentPeriodService: on activation, only the period in progress is billed, with a single periodic invoice backdated to the period's boundary so the subscription seamlessly rejoins the regular billing clock. The service computes that boundary directly from the current time (using the monthly split grid for yearly and semiannual plans with monthly-billed charges or fixed charges) instead of walking every boundary sincestarted_at. If activation happens within the first period, nothing is billed since the gating invoice already covered it.Periods fully elapsed while gated are intentionally forgiven and never billed. A fixed-charge change deferred into a skipped period (#5925) still takes effect on the first billed invoice, because fixed-charge aggregation carries the last event preceding the billed window.