[PM-40440] fix: Include Secrets Manager and storage in plan-change tax preview#7995
[PM-40440] fix: Include Secrets Manager and storage in plan-change tax preview#7995amorask-bitwarden wants to merge 4 commits into
Conversation
…x preview The plan-change tax preview rebuilt line items from the current subscription but looked up Secrets Manager seats, service accounts, and storage by the target plan's price IDs. Those IDs change across a tier boundary (and the service-account 2024 bump), and Families storage uses a distinct personal-storage ID, so the lookups missed and the preview omitted SM and storage cost, under-quoting the upgrade. Match existing items by the current plan's price IDs and re-price at the target plan, following the password-manager-seat pattern already in the command.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the plan-change tax preview fix in Code Review DetailsNo findings. The lookup fix correctly mirrors the established Password-Manager-seat pattern, the null guards match the plan-definition semantics (Families |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7995 +/- ##
=======================================
Coverage 62.15% 62.15%
=======================================
Files 2284 2284
Lines 99649 99661 +12
Branches 9012 9012
=======================================
+ Hits 61934 61946 +12
- Misses 35538 35539 +1
+ Partials 2177 2176 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
When an org has an active price-migration schedule, its Phase 2 coupon is surfaced as the org's CustomerDiscount for the subscription page. The web change-plan dialog couldn't tell that schedule-derived coupon apart from a genuine customer/SM discount, causing it to mis-render Enterprise upgrades. Add an additive IsFromSchedule flag, serialized to the API response, so the client can make that distinction. No server behavior changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🎟️ Tracking
PM-40440
📔 Objective
In the organization plan-change tax preview (
PreviewOrganizationTaxCommand, has-subscription branch), preview line items are rebuilt from the org's current Stripe subscription and re-priced at the target plan. Password Manager seats correctly look themselves up by the current plan's price IDs, but Secrets Manager seats, service accounts, and storage were looked up by the new plan's price IDs. Those IDs change across a tier boundary (Teams↔Enterprise), across the service-account "2024" version bump, and for storage between Families (personal-storage-gb-*) and org plans (storage-gb-*) — so the lookups missed, and the previewTotalsilently omitted Secrets Manager and storage cost, under-quoting the upgrade (e.g. ~$1,440+ on a Teams 2020 annual org with 10 SM seats moving to Enterprise annual).This aligns Secrets Manager and storage with the existing Password-Manager-seat pattern already in this branch: match existing items on the current subscription by the current plan's price IDs, then re-price at the target plan. Null guards are added for plans without Secrets Manager (Families/Free) and without a storage add-on.
Covered by five new tests (SM tier-change regression, Families null-guard, monthly tier change, no-SM regression, Families-with-storage regression) plus an updated existing test whose mock subscription is now keyed by the current plan's IDs. The SM and storage regressions were verified to fail against the pre-fix lookups.
Ship-together dependency: the corresponding client change (change-plan dialog switching its displayed total to this command's
Total) must not merge ahead of this PR, or Secrets-Manager orgs would see a real under-quote in the upgrade dialog. Recommended merge order: server first (or coordinated), then client.clientsPR: bitwarden/clients#21902