Commit Graph

3 Commits

Author SHA1 Message Date
Kyle Denney
2efacd596d [PM-30101] add multiple coupon support to server preview/purchase (#7229)
* [PM-30101] add multiple coupon support to server preview/purchase

* pr feedback
2026-03-19 09:07:49 -05:00
cyprain-okeke
153c175ed8 Add coupon support to invoice preview and subscription creation (#6994)
* Add coupon support to invoice preview and subscription creation

* Fix the build lint error

* Resolve the initial review comments

* fix  the failing test

* fix the build lint error

* Fix the failing test

* Resolve the unaddressed issues

* Fixed the deconstruction error

* Fix the lint issue

* Fix the lint error

* Fix the lint error

* Fix the build lint error

* lint error resolved

* remove the setting file

* rename the variable name  validatedCoupon

* Remove the owner property

* Update OrganizationBillingService tests to align with recent refactoring

- Remove GetMetadata tests as method no longer exists
- Remove Owner property references from OrganizationSale (removed in d7613365ed)
- Update coupon validation to use SubscriptionDiscountRepository instead of SubscriptionDiscountService
- Add missing imports for SubscriptionDiscount entities
- Rename test for clarity: Finalize_WithNullOwner_SkipsValidation → Finalize_WithCouponOutsideDateRange_IgnoresCouponAndProceeds

All tests passing (14/14)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix the lint error

* Making the owner non nullable

* fix the failing unit test

* Make the owner nullable

* Fix the bug for coupon in Stripe with no audience restrictions(PM-32756)

* Return validation message for invalid coupon

* Update the valid token message

* Fix the failing unit test

* Remove the duplicate method

* Fix the failing build and test

* Resolve the failing test

* Add delete of invalid coupon

* Add the expired error message

* Delete on invalid coupon in stripe

* Fix the lint errors

* return null if we get exception from stripe

* remove the auto-delete change

* fix the failing test

* Fix the lint build error

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 17:08:40 +01:00
Stephon Brown
ee84237643 [PM-30271] Create Retrieve Eligible Subscription Discounts Endpoint (#7063)
* feat(billing): add subscription discount response model

* feat(billing): implement discount audience filters

* feat(billing): introduce subscription discount service

* feat(billing): add query for applicable discounts

* feat(api): add endpoint for applicable discounts

* chore(billing): register new billing services and queries

* refactor(tests): rename discount audience filter test methods for clarity

* refactor(billing): remove unused Id property from SubscriptionDiscountResponseModel

* feat(billing): add feature flag to GetApplicableDiscountsAsync endpoint

* format(billing): dotnet format and remove pricing import

* refactor(billing): change discount audience filter factory to singleton

* test(discount): add test to verify filter retrieval for all audience types

* feat(billing): add DiscountTierType enum

* feat(billing): define Stripe product IDs and tier mapping

* feat(billing): introduce DiscountEligibility record

* feat(billing): update IDiscountAudienceFilter for tier eligibility

* feat(billing): add ListSubscriptionsAsync to IStripeAdapter

* feat(billing): implement ListSubscriptionsAsync in StripeAdapter

* feat(billing): implement AllUsersFilter for discount audience

* feat(billing): refactor UserHasNoPreviousSubscriptionsFilter for tier eligibility

* feat(billing): update DiscountAudienceFilterFactory for DI

* feat(billing): update ISubscriptionDiscountService for tier eligibility

* feat(billing): implement SubscriptionDiscountService tier eligibility

* feat(billing): update SubscriptionDiscountResponseModel with tier eligibility

* feat(billing): add GetTierEligibilityDictionary utility

* feat(billing): update GetApplicableDiscountsQuery to use tier eligibility

* chore(billing): update DI registrations for discount services

* test(billing): add/update unit tests for discount features

* fix(billing): remove unneeded import

* fix(billing): run dotnet format

* refactor(billing): remove unused Teams and Enterprise discount tiers

* refactor(billing): move DiscountEligibility to Models namespace

* refactor(billing): update discount audience filter DI to scoped

* perf(billing): optimize UserHasNoPreviousSubscriptionsFilter with caching

* refactor(billing): remove StripeProductIds from subscription discount response model

* test(billing): update GetApplicableDiscountsQueryTests after StripeProductIds removal

* fix(billing): Run dotnet format
2026-03-03 13:39:10 -05:00