[PM-30271] Create Retrieve Eligible Subscription Discounts Endpoint#7063
Merged
sbrown-livefront merged 43 commits intomainfrom Mar 3, 2026
Merged
[PM-30271] Create Retrieve Eligible Subscription Discounts Endpoint#7063sbrown-livefront merged 43 commits intomainfrom
sbrown-livefront merged 43 commits intomainfrom
Conversation
Contributor
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7063 +/- ##
==========================================
+ Coverage 56.44% 56.52% +0.07%
==========================================
Files 2013 2020 +7
Lines 88089 88270 +181
Branches 7855 7875 +20
==========================================
+ Hits 49720 49892 +172
- Misses 36554 36559 +5
- Partials 1815 1819 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kdenney
reviewed
Feb 25, 2026
src/Core/Billing/Services/DiscountAudienceFilters/DiscountAudienceFilterFactory.cs
Show resolved
Hide resolved
test/Core.Test/Billing/Services/DiscountAudienceFilters/DiscountAudienceFilterFactoryTests.cs
Show resolved
Hide resolved
kdenney
requested changes
Mar 2, 2026
Contributor
kdenney
left a comment
There was a problem hiding this comment.
Looking good and getting closer! 👏 A few notes and suggestions.
src/Core/Billing/Models/Api/Response/SubscriptionDiscountResponseModel.cs
Outdated
Show resolved
Hide resolved
src/Core/Billing/Services/DiscountAudienceFilters/UserHasNoPreviousSubscriptionsFilter.cs
Outdated
Show resolved
Hide resolved
src/Core/Billing/Services/DiscountAudienceFilters/UserHasNoPreviousSubscriptionsFilter.cs
Show resolved
Hide resolved
|
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
https://bitwarden.atlassian.net/browse/PM-30271
📔 Objective
This pull request introduces a new API endpoint for retrieving eligible subscription discounts for a user and implements the supporting backend infrastructure for discount eligibility evaluation. It adds new service interfaces, implementations, audience filter logic, and comprehensive tests to ensure correct discount selection and mapping.
API and Controller Enhancements:
GET /discountsendpoint inAccountBillingVNextControllerthat returns all applicable subscription discounts for the authenticated user. This endpoint is feature-flagged and uses a new query interface to fetch eligible discounts.Discount Eligibility Infrastructure:
ISubscriptionDiscountServiceinterface and its implementationSubscriptionDiscountServiceto manage discount eligibility checks, including support for audience-based rules.IDiscountAudienceFilterinterface and a factory (IDiscountAudienceFilterFactory/DiscountAudienceFilterFactory) for returning DI filters based on discount targeting rules, with an initial implementations for "UserHasNoPreviousSubscriptions" and "AllUsers".Query and Response Models:
IGetApplicableDiscountsQueryinterface and its implementation to return eligible discounts mapped to the newSubscriptionDiscountResponseModel, which includes all relevant discount details.Dependency Injection and Service Registration:
Stripe Integration and Constants
StripeConstantsto include product IDs and a utility to map Stripe product IDs to discount tiers, and added a method to list subscriptions via Stripe.API Response Model
SubscriptionDiscountResponseModelto standardize the API response for discount information, including per-tier eligibility.Note: Stripe Product IDs are no longer returned with discounts
📸 Screenshots
Screen.Recording.2026-03-03.at.10.51.35.AM.mov