1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00
bitwarden-server/test/Core.Test/AdminConsole/Services
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
..
AzureQueueEventWriteServiceTests.cs [AC-2972] AC Team ownership: Events (2/2) (#4675) 2024-08-21 09:03:26 +10:00
EventServiceTests.cs [AC-2972] AC Team ownership: Events (2/2) (#4675) 2024-08-21 09:03:26 +10:00
GroupServiceTests.cs Log events from the import organization flow (#4632) 2024-08-28 08:19:48 +10:00
OrganizationDomainServiceTests.cs [PM-10311] Account Management: Create helper methods for checking against verified domains (#4636) 2024-09-11 11:29:57 +01:00
OrganizationServiceTests.cs [PM-11728] Upgrade free organizations without Stripe Sources API (#4757) 2024-09-11 09:04:15 -04:00
PolicyServiceTests.cs [PM-10325] Rename OrganizationUser Delete and BulkDelete endpoints to Remove and BulkRemove (#4711) 2024-09-04 11:18:23 +01:00
RepositoryEventWriteServiceTests.cs [AC-2972] AC Team ownership: Events (2/2) (#4675) 2024-08-21 09:03:26 +10:00