Commit Graph

8 Commits

Author SHA1 Message Date
Stephon Brown
3c2cc45215 [PM-32216] Create Stripe Checkout Session Endpoint (#7246)
* feat(stripe): add checkout session constants and settings

* feat(billing): integrate Stripe Checkout Session adapter

* feat(billing): define premium checkout session DTOs

* feat(billing): implement CreatePremiumCheckoutSessionCommand

* feat(billing): add premium checkout session API endpoint

* test(billing): add premium checkout session tests

* fix(billing): run dotnet format

* fix(billing): run dotnet format

* refactor(billing): clarify Stripe session types in IStripeAdapter

* refactor(billing): clarify Stripe session service and types in StripeAdapter

* refactor(StripeAdapter): remove duplicate billing portal session method

* style(premium): remove trailing comma from payment method types

* refactor(billing): retrieve client version from context

* refactor(premium): remove IUserService dependency from checkout command

* refactor(premium): consolidate stripe customer creation logic

* fix(billing) run dotnet format

* feat(billing): add user ID to premium checkout session subscription

* test(billing): verify user ID is set in premium checkout session metadata

* test(billing): handle billing exception during stripe customer creation

* [PM-32218] Create Session Complete Handler (#7283)

* feat(billing): add checkout.session.completed webhook infrastructure

* feat(billing): introduce StripeAdapter for Checkout Session retrieval

* feat(billing): enable StripeEventService to retrieve Checkout Sessions

* feat(billing): implement CheckoutSessionCompletedHandler

* test(billing): add comprehensive tests for CheckoutSessionCompletedHandler and StripeEventService

* fix(billing): run dotnet format

* style: fix incorrect 'using' directive format

* fix(billing): standardize logging levels for critical checkout session states

* feat(billing): implement default payment method update on checkout session completion

* refactor(billing): preload subscription with checkout session

* refactor(billing): pass payment method ID to update method

* test(billing): update mocks for direct subscription access

* test(billing): update test names and expectations for payment method

* fix(billing): run dotnet format

* fix(billing): update order of operations

* feat(billing): Prevent re-upgrading for existing premium users

* refactor(billing): Augment UpdateDefaultPaymentMethodAsync with subscription ID

* feat(billing): Reset Stripe subscription default payment method
2026-03-27 13:53:49 -04:00
cyprain-okeke
fae3e95492 [PM-32480] Add endpoint for Stripe billing portal session (#7227)
* Implement the portal session url

* Remove comment

* formatting issues have been resolved

* Allow deep linking url

* remove thr return url request

* Resolve review comments around comments

* Fix the failing test after removing _globalSettings

* Fix the failing unit test
2026-03-20 09:31:43 +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
cyprain-okeke
8b6056fa08 [PM 32766][Defect] Regression: Unable to upload Premium License to Self Hosted instances (#7090)
* Fix the license version issue

* Fix the lint build error

* fix the build error

* Revert to return the UserLicense as json
2026-02-27 17:13:37 +01:00
Alex Morask
cfa8d4a165 [PM-29604] [PM-29605] [PM-29606] Support premium subscription page redesign (#6821)
* feat(get-subscription): Add EnumMemberJsonConverter

* feat(get-subscription): Add BitwardenDiscount model

* feat(get-subscription): Add Cart model

* feat(get-subscription): Add Storage model

* feat(get-subscription): Add BitwardenSubscription model

* feat(get-subscription): Add DiscountExtensions

* feat(get-subscription): Add error code to StripeConstants

* feat(get-subscription): Add GetBitwardenSubscriptionQuery

* feat(get-subscription): Expose GET /account/billing/vnext/subscription

* feat(reinstate-subscription): Add ReinstateSubscriptionCommand

* feat(reinstate-subscription): Expose POST /account/billing/vnext/subscription/reinstate

* feat(pay-with-paypal-immediately): Add SubscriberId union

* feat(pay-with-paypal-immediately): Add BraintreeService with PayInvoice method

* feat(pay-with-paypal-immediately): Pay PayPal invoice immediately when starting premium subscription

* feat(pay-with-paypal-immediately): Pay invoice with Braintree on invoice.created for subscription cycles only

* fix(update-storage): Always invoice for premium storage update

* fix(update-storage): Move endpoint to subscription path

* docs: Note FF removal POIs

* (format): Run dotnet format
2026-01-12 10:45:41 -06:00
cyprain-okeke
e705fe3f3f [PM-29598] Create Subscription Upgrade Endpoint (#6787)
* Add the ticket implementation

* Add the unit test

* Fix the lint and test issues

* resolve pr comments

* Fix the error on the test file

* Review suggestion and fixes

* resolve the api access comments

* Gte the key from the client

* Add the gateway type as stripe

* Address the legacy plans issues

* Resolve the misunderstanding

* Add additional storage that we will need if they revert

* Add the previous premium UserId
2026-01-09 16:34:06 +01:00
cyprain-okeke
76a8f0fd95 [PM 29610]Update Account Storage Endpoint (#6750)
* update account storage endpoint

* Fix the failing test

* Added flag and refactor base on pr comments

* fix the lint error

* Resolve the pr comments

* Fix the failing test

* Fix the failing test

* Return none

* Resolve the lint error

* Fix the failing test

* Add the missing test

* Formatting issues fixed
2026-01-05 10:52:52 -06:00
cyprain-okeke
665be6bfb0 [PM-29611] Decouple License from Subscription Response (#6768)
* implement the ticket request

* resolve the build lint error

* Resolve the build lint error

* Address review comments

* Fixt the lint and failing unit test

* Fix NSubstitute mock - use concrete ClaimsPrincipal instead of Arg.Any in Returns()

* resolve InjectUser issues

* Fix the failing testing

* Fix the failing unit test
2025-12-31 17:30:41 +01:00