1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

[AC-1754] Provide upgrade flow for paid organizations (#3468)

* wip

* Add CompleteSubscriptionUpdate

* Add AdjustSubscription to PaymentService

* Use PaymentService.AdjustSubscription in UpgradeOrganizationPlanCommand

* Add CompleteSubscriptionUpdateTests

* Remove unused changes

* Update UpgradeOrganizationPlanCommandTests

* Fixing missing usings after master merge

* Defects: AC-1958, AC-1959

* Allow user to unsubscribe from Secrets Manager and Storage during upgrade

* Handled null exception when upgrading away from a plan that doesn't allow secrets manager

* Resolved issue where Teams Starter couldn't increase storage

---------

Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com>
Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
This commit is contained in:
Alex Morask
2023-12-27 09:30:23 -05:00
committed by GitHub
parent cf4d8a4f92
commit c60f260c0f
15 changed files with 995 additions and 45 deletions

View File

@ -147,6 +147,40 @@ public class SecretsManagerOrganizationCustomization : ICustomization
}
}
internal class TeamsStarterOrganizationCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
var organizationId = Guid.NewGuid();
const PlanType planType = PlanType.TeamsStarter;
fixture.Customize<Organization>(composer =>
composer
.With(organization => organization.Id, organizationId)
.With(organization => organization.PlanType, planType)
.With(organization => organization.Seats, 10)
.Without(organization => organization.MaxStorageGb));
}
}
internal class TeamsMonthlyWithAddOnsOrganizationCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
var organizationId = Guid.NewGuid();
const PlanType planType = PlanType.TeamsMonthly;
fixture.Customize<Organization>(composer =>
composer
.With(organization => organization.Id, organizationId)
.With(organization => organization.PlanType, planType)
.With(organization => organization.Seats, 20)
.With(organization => organization.UseSecretsManager, true)
.With(organization => organization.SmSeats, 5)
.With(organization => organization.SmServiceAccounts, 53));
}
}
internal class OrganizationCustomizeAttribute : BitCustomizeAttribute
{
public bool UseGroups { get; set; }
@ -189,6 +223,16 @@ internal class SecretsManagerOrganizationCustomizeAttribute : BitCustomizeAttrib
new SecretsManagerOrganizationCustomization();
}
internal class TeamsStarterOrganizationCustomizeAttribute : BitCustomizeAttribute
{
public override ICustomization GetCustomization() => new TeamsStarterOrganizationCustomization();
}
internal class TeamsMonthlyWithAddOnsOrganizationCustomizeAttribute : BitCustomizeAttribute
{
public override ICustomization GetCustomization() => new TeamsMonthlyWithAddOnsOrganizationCustomization();
}
internal class EphemeralDataProtectionCustomization : ICustomization
{
public void Customize(IFixture fixture)