Skip to content

[PM-38456]: Allow License Generation for Sales Trial Orgs#7793

Open
sbrown-livefront wants to merge 3 commits into
mainfrom
billing/pm-38456/fix-license-file-generation-for-sales-trials
Open

[PM-38456]: Allow License Generation for Sales Trial Orgs#7793
sbrown-livefront wants to merge 3 commits into
mainfrom
billing/pm-38456/fix-license-file-generation-for-sales-trials

Conversation

@sbrown-livefront

@sbrown-livefront sbrown-livefront commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

🎟️ Tracking

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

📔 Objective

Some Sales-assisted trial organizations are created with no Stripe subscription — the sales team sets an ExpirationDate directly in the Admin portal instead. GetCloudOrganizationLicenseQuery.GetLicenseAsync was throwing "No active subscription found." unconditionally whenever subscriptionInfo.Subscription is null, which blocked license file generation for these orgs entirely.

The fix relaxes that guard to pass through when the org has a future ExpirationDate, allowing LicenseExtensions.CalculateFreshExpirationDate (which already had the correct fallback from PM-21415) to use org.ExpirationDate directly.

Before: Any org without a Stripe subscription → BadRequestException

After:

  • No subscription + no expiration → BadRequestException("No active subscription found.")
  • No subscription + past expiration → BadRequestException("No active subscription found.")
  • No subscription + future expiration → license generated with org.ExpirationDate as the expiration

📸 Screenshots

No Subscription with Future Expiration Date

Screen.Recording.2026-06-09.at.3.55.37.PM.mov

No Subscription with Expire Expiration Date

Screen.Recording.2026-06-09.at.3.56.25.PM.mov

@sbrown-livefront sbrown-livefront changed the title fix(billing): allow license generation for sales trial orgs [PM-38456]: Allow License Generation for Sales Trial Orgs Jun 9, 2026
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 61.09%. Comparing base (c968d25) to head (28acccd).

Files with missing lines Patch % Lines
...ations/Queries/GetCloudOrganizationLicenseQuery.cs 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7793   +/-   ##
=======================================
  Coverage   61.09%   61.09%           
=======================================
  Files        2173     2173           
  Lines       96631    96634    +3     
  Branches     8701     8702    +1     
=======================================
+ Hits        59040    59043    +3     
+ Misses      35489    35486    -3     
- Partials     2102     2105    +3     

☔ View full report in Codecov by Harness.
📢 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.

@sbrown-livefront sbrown-livefront self-assigned this Jun 9, 2026
@sbrown-livefront sbrown-livefront added the ai-review Request a Claude code review label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the relaxation of the null-subscription guard in GetCloudOrganizationLicenseQuery.GetLicenseAsync and the accompanying unit tests. The change correctly converts the second status check to else if so that a null Subscription reference cannot be dereferenced when the new future-ExpirationDate path falls through. Traced the downstream flow through OrganizationLicense, LicenseExtensions (CalculateFreshExpirationDate, CalculateFreshRefreshDate, CalculateFreshExpirationDateWithoutGracePeriod, CalculateIsTrialing), and OrganizationLicenseClaimsFactory — all of these already null-check subscriptionInfo?.Subscription and fall back to org.ExpirationDate, so Sales-assisted trial orgs without a Stripe subscription are handled end-to-end. Test coverage explicitly exercises the no-expiration, past-expiration, and future-expiration branches, matching established test patterns in the file.

Code Review Details

No findings.

@sbrown-livefront sbrown-livefront marked this pull request as ready for review June 9, 2026 20:34
@sbrown-livefront sbrown-livefront requested a review from a team as a code owner June 9, 2026 20:34
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

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

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants