1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-30 13:33:24 +01:00
bitwarden-server/test/Core.Test/AdminConsole
Alex Morask 68b421fa2b
[PM-11728] Upgrade free organizations without Stripe Sources API (#4757)
* Refactor: Update metadata in OrganizationSignup and OrganizationUpgrade

This commit moves the IsFromSecretsManagerTrial flag from the OrganizationUpgrade to the OrganizationSignup because it will only be passed in on organization creation. Additionally, it removes the nullable boolean 'provider' flag passed to OrganizationService.SignUpAsync and instead adds that boolean flag to the OrganizationSignup which seems more appropriate.

* Introduce OrganizationSale

While I'm trying to ingrain a singular model that can be used to purchase or upgrade organizations, I disliked my previously implemented OrganizationSubscriptionPurchase for being a little too wordy and specific. This sale class aligns more closely with the work we need to complete against Stripe and also uses a private constructor so that it can only be created and utilized via an Organiztion and either OrganizationSignup or OrganizationUpgrade object.

* Use OrganizationSale in OrganizationBillingService

This commit renames the OrganizationBillingService.PurchaseSubscription to Finalize and passes it the OrganizationSale object. It also updates the method so that, if the organization already has a customer, it retrieves that customer instead of automatically trying to create one which we'll need for upgraded free organizations.

* Add functionality for free organization upgrade

This commit adds an UpdatePaymentMethod to the OrganizationBillingService that will check if a customer exists for the organization and if not, creates one with the updated payment source and tax information. Then, in the UpgradeOrganizationPlanCommand, we can use the OrganizationUpgrade to get an OrganizationSale and finalize it, which will create a subscription using the customer created as part of the payment method update that takes place right before it on the client-side. Additionally, it adds some tax ID backfill logic to SubscriberService.UpdateTaxInformation

* (No Logic) Re-order OrganizationBillingService methods alphabetically

* (No Logic) Run dotnet format
2024-09-11 09:04:15 -04:00
..
AutoFixture [AC-2881] Remove Organization.FlexibleCollections from code (#4552) 2024-07-26 15:07:33 +10:00
Entities [AC-1283] AC Team code ownership moves: Organization (pt 2) (#3486) 2023-11-29 15:31:15 -06:00
Models/Data [PM-8830] Billing Enums Rename (#4180) 2024-06-14 15:34:47 -04:00
OrganizationAuth Allow for bulk processing new login device requests (#4064) 2024-05-27 11:56:52 +10:00
OrganizationFeatures [PM-10311] Account Management: Create helper methods for checking against verified domains (#4636) 2024-09-11 11:29:57 +01:00
Services [PM-11728] Upgrade free organizations without Stripe Sources API (#4757) 2024-09-11 09:04:15 -04:00