[PM-33899] Release schedule on terminal subscription operations#7305
Open
amorask-bitwarden wants to merge 3 commits intomainfrom
Open
[PM-33899] Release schedule on terminal subscription operations#7305amorask-bitwarden wants to merge 3 commits intomainfrom
amorask-bitwarden wants to merge 3 commits intomainfrom
Conversation
Contributor
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7305 +/- ##
==========================================
+ Coverage 57.91% 57.94% +0.03%
==========================================
Files 2044 2045 +1
Lines 90130 90243 +113
Branches 8018 8026 +8
==========================================
+ Hits 52199 52295 +96
- Misses 36066 36080 +14
- Partials 1865 1868 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ase-schedule-terminal
|
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.




🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-33899
📔 Objective
Introduces
IPriceIncreaseScheduler— a shared service that consolidates subscription schedule creation and release logic behind thePM32645_DeferPriceMigrationToRenewalfeature flag. Previously, schedule creation lived as a private method inUpcomingInvoiceHandlerand release guards were inlined at each call site.Schedule(Subscription)— Creates a two-phase subscription schedule that defers a price increase to the renewal date. Resolves the subscriber type viaSubscriberIdmetadata to determine the correct migration path (Premium or Families), builds the appropriate Phase 2 configuration (target price + discount), and creates the schedule in Stripe. Returnsboolso callers can skip downstream processing (e.g., renewal emails) when a schedule already exists.Release(string customerId, string subscriptionId)— Releases any active schedule for the subscription, cancelling a pending deferred price increase. Logs and re-throws on failure, requiring manual release via the Stripe Dashboard.Call sites:
UpcomingInvoiceHandler— callsScheduleduringinvoice.upcomingprocessing (replaces the privateSchedulePriceMigrationAsync)SubscriptionUpdatedHandler— callsReleasewhen a subscription goes unpaid; callsSchedulewhen a subscription recovers (recreates the schedule)UpgradePremiumToOrganizationCommand— callsReleasebefore upgrading to an org planSetUpSponsorshipCommand— callsReleasebefore applying a sponsorship📸 Screenshots