Feat: Add Organization Subscription-Preview Endpoint - #8245
Draft
sbrown-livefront wants to merge 15 commits into
Draft
Feat: Add Organization Subscription-Preview Endpoint#8245sbrown-livefront wants to merge 15 commits into
sbrown-livefront wants to merge 15 commits into
Conversation
…ionEndpointsHandler
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## billing/PM-39925/invoice-preview-projection #8245 +/- ##
===============================================================================
+ Coverage 63.39% 63.41% +0.02%
===============================================================================
Files 2420 2423 +3
Lines 104400 104504 +104
Branches 9472 9483 +11
===============================================================================
+ Hits 66182 66269 +87
- Misses 35946 35959 +13
- Partials 2272 2276 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
📔 Objective
First endpoint on the new
Bit.Subscriptions.Organizationfeature library and first consumer of the shared, Stripe-invoice-preview–driven cart summary. Sources the organization's upcoming-renewal cart totals from an actual Stripe invoice preview instead of reconstructing them from local subscription state.Adds:
GetSubscriptionPreviewQuery(Bit.Invoicing) — shared,ISubscriber-generic query ported fromGetBitwardenSubscriptionQuery. Resolves tier/cadence (collapsingTeamsStarter → Teams), previews viacreate_preview(subscription=id), falls back to the subscription overload when there's no upcoming invoice, and maps subscription status →SubscriptionPreviewenvelope (suspension/grace-period/cancel). Registered inAddInvoicing(). The Organization path is fully wired here; the User/Premium path is stubbed for Task 8.GET /organizations/{organizationId:guid}/billing/subscription/preview— new route on the org subscription group, gated behindPM36631_PreviewDrivenCart.AuthorizeAttribute<OrganizationBillingRequirement>using theIOrganizationRequirementframework (Owner or confirmed provider-user-for-org; excludes Admin/Custom). Lives entirely in theOrganizationAuthorizationlibrary — no dependency on theApiproject.Refactor (cross-cutting):
AuthorizeAttributemoved into the dedicatedOrganizationAuthorizationlibrary and its namespace updated. Consumers were re-pointed to the new namespace — a one-lineusingchange across ~15 AdminConsole/Billing controllers, the PAMAccessRuleEndpoints,NoopAuthorizeAttribute, and two test files. This accounts for the otherwise-unrelated file churn; no behavior changes.Confirmed during implementation:
create_preview(subscription=id)surfaces a subscription schedule's phase-2 discount, so the legacyGetSchedulePhase2CouponIdsAsyncporting was not needed.Out of scope: Provider subscribers (
ResolveTierAndCadenceAsyncthrows); the User/Premium route (Task 8).📸 Screenshots
N/A — internal API endpoint, no UI in this PR.