mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC-1753] Automatically assign provider's pricing to new organizations (#3513)
* Initial commit * resolve pr comment * adding some unit test * Resolve pr comments * Adding some unit test * Resolve pr comment * changes to find the bug * revert back changes on admin * Fix the failing Test * fix the bug
This commit is contained in:
@ -21,6 +21,7 @@ public class ProviderResponseModel : ResponseModel
|
||||
BusinessCountry = provider.BusinessCountry;
|
||||
BusinessTaxNumber = provider.BusinessTaxNumber;
|
||||
BillingEmail = provider.BillingEmail;
|
||||
CreationDate = provider.CreationDate;
|
||||
}
|
||||
|
||||
public Guid Id { get; set; }
|
||||
@ -32,4 +33,5 @@ public class ProviderResponseModel : ResponseModel
|
||||
public string BusinessCountry { get; set; }
|
||||
public string BusinessTaxNumber { get; set; }
|
||||
public string BillingEmail { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
}
|
||||
|
@ -1890,11 +1890,6 @@ public class OrganizationService : IOrganizationService
|
||||
|
||||
public void ValidatePasswordManagerPlan(Models.StaticStore.Plan plan, OrganizationUpgrade upgrade)
|
||||
{
|
||||
if (plan is not { LegacyYear: null })
|
||||
{
|
||||
throw new BadRequestException("Invalid Password Manager plan selected.");
|
||||
}
|
||||
|
||||
ValidatePlan(plan, upgrade.AdditionalSeats, "Password Manager");
|
||||
|
||||
if (plan.PasswordManager.BaseSeats + upgrade.AdditionalSeats <= 0)
|
||||
@ -2409,12 +2404,8 @@ public class OrganizationService : IOrganizationService
|
||||
public async Task CreatePendingOrganization(Organization organization, string ownerEmail, ClaimsPrincipal user, IUserService userService, bool salesAssistedTrialStarted)
|
||||
{
|
||||
var plan = StaticStore.Plans.FirstOrDefault(p => p.Type == organization.PlanType);
|
||||
if (plan is not { LegacyYear: null })
|
||||
{
|
||||
throw new BadRequestException("Invalid plan selected.");
|
||||
}
|
||||
|
||||
if (plan.Disabled)
|
||||
if (plan!.Disabled)
|
||||
{
|
||||
throw new BadRequestException("Plan not found.");
|
||||
}
|
||||
|
@ -29,6 +29,12 @@ public static class Constants
|
||||
/// Used by IdentityServer to identify our own provider.
|
||||
/// </summary>
|
||||
public const string IdentityProvider = "bitwarden";
|
||||
|
||||
/// <summary>
|
||||
/// Date identifier used in ProviderService to determine if a provider was created before Nov 6, 2023.
|
||||
/// If true, the organization plan assigned to that provider is updated to a 2020 plan.
|
||||
/// </summary>
|
||||
public static readonly DateTime ProviderCreatedPriorNov62023 = new DateTime(2023, 11, 6);
|
||||
}
|
||||
|
||||
public static class AuthConstants
|
||||
|
Reference in New Issue
Block a user