Skip to content

[PM-33894] Schedule price increases#7293

Merged
amorask-bitwarden merged 7 commits intomainfrom
billing/PM-33894/schedule-price-increase
Mar 24, 2026
Merged

[PM-33894] Schedule price increases#7293
amorask-bitwarden merged 7 commits intomainfrom
billing/PM-33894/schedule-price-increase

Conversation

@amorask-bitwarden
Copy link
Copy Markdown
Contributor

@amorask-bitwarden amorask-bitwarden commented Mar 24, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-33894

📔 Objective

Modifies UpcomingInvoiceHandler to defer subscription price changes to the renewal date using Stripe subscription schedules, gated behind the PM32645_DeferPriceMigrationToRenewal feature flag. This fixes MRR distortion caused by the current behavior of updating subscription prices immediately when invoice.upcoming fires (~15 days before renewal).

When the flag is enabled, both the Premium user and Families organization paths now:

  • Check for an existing active schedule (idempotency guard)
  • Create a 2-phase subscription schedule from the current subscription
  • Phase 1 echoes the current subscription state; Phase 2 applies the new price (and discount where applicable) at renewal

When the flag is disabled, existing UpdateSubscription behavior is preserved.

Also migrates UpcomingInvoiceHandler from the legacy IStripeFacade to IStripeAdapter and adds SubscriptionScheduleStatus and SubscriptionScheduleEndBehavior constants to StripeConstants.

image

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

Logo
Checkmarx One – Scan Summary & Details7ec5e5d6-bff3-4dc8-a983-ce25f2118c6f

Great job! No new security vulnerabilities introduced in this pull request

@amorask-bitwarden amorask-bitwarden added the ai-review-vnext Request a Claude code review using the vNext workflow label Mar 24, 2026
@amorask-bitwarden amorask-bitwarden marked this pull request as ready for review March 24, 2026 17:51
@amorask-bitwarden amorask-bitwarden requested a review from a team as a code owner March 24, 2026 17:51
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 86.09626% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.87%. Comparing base (4f37c93) to head (d70858c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...Services/Implementations/UpcomingInvoiceHandler.cs 86.09% 22 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7293      +/-   ##
==========================================
+ Coverage   57.84%   57.87%   +0.02%     
==========================================
  Files        2043     2043              
  Lines       89879    90002     +123     
  Branches     7989     8000      +11     
==========================================
+ Hits        51992    52090      +98     
- Misses      36029    36050      +21     
- Partials     1858     1862       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

Overall Assessment: APPROVE

This PR introduces deferred price migration via Stripe subscription schedules for both Premium users and Families organizations, gated behind the PM32645_DeferPriceMigrationToRenewal feature flag. The implementation migrates from IStripeFacade to IStripeAdapter, adds a shared SchedulePriceMigrationAsync method with an idempotency guard (checking for existing active schedules) and orphaned schedule cleanup on failure, carries storage items into phase 2, and adds new SubscriptionScheduleStatus and SubscriptionScheduleEndBehavior constants. The legacy path is fully preserved when the flag is disabled. Test coverage is comprehensive with eight new test cases covering schedule creation, idempotency, error handling, and edge cases.

Code Review Details

No findings to report. The implementation is well-structured with appropriate error handling, idempotency guards, and feature flag gating.

@sonarqubecloud
Copy link
Copy Markdown

@amorask-bitwarden amorask-bitwarden merged commit 15e71aa into main Mar 24, 2026
44 checks passed
@amorask-bitwarden amorask-bitwarden deleted the billing/PM-33894/schedule-price-increase branch March 24, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-vnext Request a Claude code review using the vNext workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants