1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00
bitwarden-server/test
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
..
Admin.Test Include all projects in coverage (#3829) 2024-02-20 17:18:40 +01:00
Api.IntegrationTest [PM-11667] Remove all code related to the outdated custom permissions 'Edit/Delete Assigned Collections' (#4736) 2024-09-10 15:06:13 +01:00
Api.Test [PM-11667] Remove all code related to the outdated custom permissions 'Edit/Delete Assigned Collections' (#4736) 2024-09-10 15:06:13 +01:00
Billing.Test Upgrade Stripe.net to 45.7.0 (#4744) 2024-09-06 13:30:39 -04:00
Common [AC-1722] Deprecate "Edit/Delete Assigned Collections" custom permissions (#4604) 2024-09-02 11:04:55 +01:00
Core.Test [PM-11728] Upgrade free organizations without Stripe Sources API (#4757) 2024-09-11 09:04:15 -04:00
Events.Test Include all projects in coverage (#3829) 2024-02-20 17:18:40 +01:00
EventsProcessor.Test Include all projects in coverage (#3829) 2024-02-20 17:18:40 +01:00
Icons.Test Fix Broken Icon Unit Test (#4151) 2024-06-03 09:58:53 -04:00
Identity.IntegrationTest [PM-6664] base request validator - Two Factor flows integration tests (#4643) 2024-09-06 08:05:25 -07:00
Identity.Test [PM-6664] Base Request Validator Unit Tests and Resource Owner integration Tests (#4582) 2024-09-05 11:17:15 -07:00
Infrastructure.Dapper.Test Create DataTableBuilder (#4608) 2024-09-05 20:44:45 -04:00
Infrastructure.EFIntegration.Test [AC-1722] Deprecate "Edit/Delete Assigned Collections" custom permissions (#4604) 2024-09-02 11:04:55 +01:00
Infrastructure.IntegrationTest [PM-10311] Account Management: Create helper methods for checking against verified domains (#4636) 2024-09-11 11:29:57 +01:00
IntegrationTestCommon [PM-6664] base request validator - Two Factor flows integration tests (#4643) 2024-09-06 08:05:25 -07:00
Notifications.Test Include all projects in coverage (#3829) 2024-02-20 17:18:40 +01:00
Bitwarden.Tests.proj Devcontainer Improvements (#4466) 2024-07-08 10:48:02 -04:00