Skip to content

[PM-31780] Add exempt from billing automation toggle#7438

Open
amorask-bitwarden wants to merge 8 commits intomainfrom
billing/PM-31780/exempt-from-billing-automation
Open

[PM-31780] Add exempt from billing automation toggle#7438
amorask-bitwarden wants to merge 8 commits intomainfrom
billing/PM-31780/exempt-from-billing-automation

Conversation

@amorask-bitwarden
Copy link
Copy Markdown
Contributor

@amorask-bitwarden amorask-bitwarden commented Apr 10, 2026

🎟️ Tracking

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

📔 Objective

Adds an ExemptFromBillingAutomation boolean property to the Organization entity, exposed as a checkbox in the admin portal's Billing section. When checked, the organization is marked as exempt from automated billing lifecycle operations (subscription cancellation, disabling for non-payment).

The toggle is gated by the existing Org_Billing_Edit permission, accessible to Owner, Admin, and Billing roles. No new permissions are introduced.

This is the first of a set of related tickets:

  • PM-31781: Server-side logic to skip billing automations when exempt
  • PM-34174: Client-side suppression of renewal reminder banners for exempt orgs

Changes

  • Database: New ExemptFromBillingAutomation BIT NOT NULL DEFAULT(0) column with idempotent MSSQL migration + EF migrations for Postgres/MySQL/SQLite
  • Entity: Added property with XML doc comment to Organization.cs
  • Admin portal: Edit model, controller (in Org_Billing_Edit block), and view (checkbox in Billing section)
  • SQL source of truth: Updated table definition, Organization_Create, Organization_Update, OrganizationView

📸 Screenshots

Screen.Recording.2026-04-10.at.9.43.50.AM.mov

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.12%. Comparing base (f2141b9) to head (d0397a5).

Files with missing lines Patch % Lines
...Admin/AdminConsole/Models/OrganizationEditModel.cs 0.00% 3 Missing ⚠️
...dminConsole/Controllers/OrganizationsController.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7438      +/-   ##
==========================================
+ Coverage   58.66%   63.12%   +4.46%     
==========================================
  Files        2066     2066              
  Lines       91089    91094       +5     
  Branches     8106     8107       +1     
==========================================
+ Hits        53440    57507    +4067     
+ Misses      35740    31592    -4148     
- Partials     1909     1995      +86     

☔ 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.

@amorask-bitwarden amorask-bitwarden marked this pull request as ready for review April 10, 2026 14:59
@amorask-bitwarden amorask-bitwarden requested review from a team as code owners April 10, 2026 14:59
@github-actions
Copy link
Copy Markdown
Contributor

Logo
Checkmarx One – Scan Summary & Details67cf3917-7047-4623-9909-d081becf35f0

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

jrmccannon
jrmccannon previously approved these changes Apr 10, 2026
[UseMyItems],
[ExemptFromBillingAutomation]
FROM
[dbo].[Organization]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the Organization table was updated, any view that selects from it should be refreshed (no need to refresh OrganizationView though since you're re-defining it anyway).

GO

EXEC sp_refreshview N'[dbo].[OrganizationCipherDetailsCollectionsView]';
EXEC sp_refreshview N'[dbo].[OrganizationUserOrganizationDetailsView]';
EXEC sp_refreshview N'[dbo].[ProviderOrganizationOrganizationDetailsView]';
EXEC sp_refreshview N'[dbo].[ProviderUserProviderOrganizationDetailsView]';
EXEC sp_refreshview N'[dbo].[UserPremiumAccessView]';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching - added here: ca1628b

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants