mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 17:12:49 -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:
@ -97,11 +97,6 @@ public class UpgradeOrganizationPlanCommand : IUpgradeOrganizationPlanCommand
|
||||
throw new BadRequestException("You cannot upgrade to this plan.");
|
||||
}
|
||||
|
||||
if (existingPlan.Type != PlanType.Free)
|
||||
{
|
||||
throw new BadRequestException("You can only upgrade from the free plan. Contact support.");
|
||||
}
|
||||
|
||||
_organizationService.ValidatePasswordManagerPlan(newPlan, upgrade);
|
||||
|
||||
if (upgrade.UseSecretsManager)
|
||||
@ -226,8 +221,16 @@ public class UpgradeOrganizationPlanCommand : IUpgradeOrganizationPlanCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Update existing sub
|
||||
throw new BadRequestException("You can only upgrade from the free plan. Contact support.");
|
||||
paymentIntentClientSecret = await _paymentService.AdjustSubscription(
|
||||
organization,
|
||||
newPlan,
|
||||
upgrade.AdditionalSeats,
|
||||
upgrade.UseSecretsManager,
|
||||
upgrade.AdditionalSmSeats,
|
||||
upgrade.AdditionalServiceAccounts,
|
||||
upgrade.AdditionalStorageGb);
|
||||
|
||||
success = string.IsNullOrEmpty(paymentIntentClientSecret);
|
||||
}
|
||||
|
||||
organization.BusinessName = upgrade.BusinessName;
|
||||
|
Reference in New Issue
Block a user