From 721d2969d43972d6e2205e4e3fa6b48f16991dda Mon Sep 17 00:00:00 2001
From: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
Date: Fri, 14 Jun 2024 15:34:47 -0400
Subject: [PATCH] [PM-8830] Billing Enums Rename (#4180)
* Renamed ProductType to ProductTierType
* Renamed Product properties to ProductTier
* Moved ProductTierType to Bit.Core.Billing.Enums namespace from Bit.Core.Enums
* Moved PlanType enum to Bit.Core.Billing.Enums
* Moved StaticStore to Bit.Core.Billing.Models.StaticStore namespace
* Added ProductType enum
* dotnet format
---
.../Providers/CreateProviderCommand.cs | 1 +
.../AdminConsole/Services/ProviderService.cs | 1 +
.../Billing/ProviderBillingService.cs | 1 +
.../Queries/Projects/MaxProjectsQuery.cs | 2 +-
...oveOrganizationFromProviderCommandTests.cs | 1 +
.../Services/ProviderServiceTests.cs | 1 +
.../Billing/ProviderBillingServiceTests.cs | 1 +
.../Queries/Projects/MaxProjectsQueryTests.cs | 2 +-
.../Controllers/ProvidersController.cs | 1 +
.../Models/OrganizationEditModel.cs | 5 ++--
.../AdminConsole/Models/ProviderEditModel.cs | 1 +
.../Views/Organizations/Edit.cshtml | 1 +
.../Views/Shared/_OrganizationForm.cshtml | 1 +
.../Shared/_OrganizationFormScripts.cshtml | 1 +
.../Views/Tools/StripeSubscriptions.cshtml | 2 +-
.../Controllers/OrganizationsController.cs | 3 ++-
.../OrganizationCreateRequestModel.cs | 1 +
.../OrganizationUpgradeRequestModel.cs | 2 +-
.../OrganizationResponseModel.cs | 2 +-
.../ProfileOrganizationResponseModel.cs | 7 +++---
...rofileProviderOrganizationResponseModel.cs | 5 ++--
.../CreateClientOrganizationRequestBody.cs | 2 +-
src/Api/Models/Response/PlanResponseModel.cs | 6 ++---
.../Controllers/FreshsalesController.cs | 2 +-
src/Billing/Controllers/StripeController.cs | 1 +
.../AdminConsole/Entities/Organization.cs | 1 +
.../OrganizationUserOrganizationDetails.cs | 3 ++-
.../ProviderUserOrganizationDetails.cs | 3 ++-
.../OrganizationUsers/AcceptOrgUserCommand.cs | 1 +
.../Implementations/OrganizationService.cs | 5 ++--
src/Core/Billing/Entities/ProviderPlan.cs | 4 +--
src/Core/{ => Billing}/Enums/PlanType.cs | 2 +-
.../Enums/ProductTierType.cs} | 5 ++--
src/Core/Billing/Enums/ProductType.cs | 11 ++++++++
.../Billing/Extensions/BillingExtensions.cs | 1 +
.../Models/ConfiguredProviderPlanDTO.cs | 2 +-
.../{ => Billing}/Models/StaticStore/Plan.cs | 4 +--
.../Models/StaticStore/Plans/CustomPlan.cs | 7 +++---
.../StaticStore/Plans/Enterprise2019Plan.cs | 9 ++++---
.../StaticStore/Plans/Enterprise2020Plan.cs | 9 ++++---
.../StaticStore/Plans/EnterprisePlan.cs | 7 +++---
.../StaticStore/Plans/EnterprisePlan2023.cs | 7 +++---
.../StaticStore/Plans/Families2019Plan.cs | 9 ++++---
.../Models/StaticStore/Plans/FamiliesPlan.cs | 9 ++++---
.../Models/StaticStore/Plans/FreePlan.cs | 9 ++++---
.../Models/StaticStore/Plans/Teams2019Plan.cs | 9 ++++---
.../Models/StaticStore/Plans/Teams2020Plan.cs | 9 ++++---
.../Models/StaticStore/Plans/TeamsPlan.cs | 7 +++---
.../Models/StaticStore/Plans/TeamsPlan2023.cs | 7 +++---
.../StaticStore/Plans/TeamsStarterPlan.cs | 7 +++---
.../StaticStore/Plans/TeamsStarterPlan2023.cs | 7 +++---
.../Models/StaticStore/SponsoredPlan.cs | 7 +++---
.../Services/IProviderBillingService.cs | 2 +-
.../Models/Business/OrganizationLicense.cs | 1 +
.../Models/Business/OrganizationUpgrade.cs | 2 +-
.../Business/ProviderSubscriptionUpdate.cs | 4 +--
.../Models/Business/SubscriptionUpdate.cs | 2 +-
.../Models/Mail/OrganizationInvitesInfo.cs | 2 +-
.../Cloud/CloudSyncSponsorshipsCommand.cs | 4 +--
.../Cloud/SetUpSponsorshipCommand.cs | 4 +--
.../Cloud/ValidateSponsorshipCommand.cs | 2 +-
.../CreateSponsorshipCommand.cs | 4 +--
.../AddSecretsManagerSubscriptionCommand.cs | 8 +++---
...UpdateSecretsManagerSubscriptionCommand.cs | 3 ++-
.../UpgradeOrganizationPlanCommand.cs | 25 ++++++++++---------
.../Tools/Models/Business/ReferenceEvent.cs | 2 +-
src/Core/Utilities/CoreHelpers.cs | 2 +-
src/Core/Utilities/StaticStore.cs | 9 ++++---
.../Repositories/OrganizationRepository.cs | 1 +
...adCountByFreeOrganizationAdminUserQuery.cs | 3 ++-
.../Controllers/MembersControllerTests.cs | 1 +
.../Controllers/ConfigControllerTests.cs | 3 ++-
.../Helpers/OrganizationTestHelpers.cs | 1 +
.../OrganizationsControllerTests.cs | 1 +
...OrganizationSponsorshipsControllerTests.cs | 7 +++---
.../ProviderBillingControllerTests.cs | 1 +
.../Utilities/EnumMatchesAttributeTests.cs | 1 +
.../Vault/Controllers/SyncControllerTests.cs | 4 +--
.../AutoFixture/OrganizationFixtures.cs | 1 +
.../SelfHostedOrganizationDetailsTests.cs | 1 +
.../Services/OrganizationServiceTests.cs | 1 +
.../CompleteSubscriptionUpdateTests.cs | 2 +-
.../OrganizationLicenseFileFixtures.cs | 1 +
.../Business/SeatSubscriptionUpdateTests.cs | 2 +-
.../SecretsManagerSubscriptionUpdateTests.cs | 2 +-
.../ServiceAccountSubscriptionUpdateTests.cs | 2 +-
.../Business/SmSeatSubscriptionUpdateTests.cs | 2 +-
.../StorageSubscriptionUpdateTests.cs | 2 +-
.../CloudSyncSponsorshipsCommandTests.cs | 1 +
.../Cloud/SetUpSponsorshipCommandTests.cs | 2 +-
.../Cloud/ValidateSponsorshipCommandTests.cs | 2 +-
.../CreateSponsorshipCommandTests.cs | 1 +
.../FamiliesForEnterpriseTestsBase.cs | 11 ++++----
...dSecretsManagerSubscriptionCommandTests.cs | 2 +-
...eSecretsManagerSubscriptionCommandTests.cs | 2 +-
.../UpgradeOrganizationPlanCommandTests.cs | 2 +-
.../Services/StripePaymentServiceTests.cs | 1 +
test/Core.Test/Utilities/StaticStoreTests.cs | 2 +-
.../Vault/Services/CipherServiceTests.cs | 9 ++++---
.../OrganizationRepositoryTests.cs | 1 +
.../Repositories/CollectionRepositoryTests.cs | 1 +
101 files changed, 219 insertions(+), 147 deletions(-)
rename src/Core/{ => Billing}/Enums/PlanType.cs (97%)
rename src/Core/{Enums/ProductType.cs => Billing/Enums/ProductTierType.cs} (81%)
create mode 100644 src/Core/Billing/Enums/ProductType.cs
rename src/Core/{ => Billing}/Models/StaticStore/Plan.cs (97%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/CustomPlan.cs (68%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/Enterprise2019Plan.cs (93%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/Enterprise2020Plan.cs (93%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/EnterprisePlan.cs (94%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/EnterprisePlan2023.cs (94%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/Families2019Plan.cs (85%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/FamiliesPlan.cs (83%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/FreePlan.cs (84%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/Teams2019Plan.cs (93%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/Teams2020Plan.cs (93%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/TeamsPlan.cs (94%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/TeamsPlan2023.cs (94%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/TeamsStarterPlan.cs (91%)
rename src/Core/{ => Billing}/Models/StaticStore/Plans/TeamsStarterPlan2023.cs (91%)
rename src/Core/{ => Billing}/Models/StaticStore/SponsoredPlan.cs (63%)
diff --git a/bitwarden_license/src/Commercial.Core/AdminConsole/Providers/CreateProviderCommand.cs b/bitwarden_license/src/Commercial.Core/AdminConsole/Providers/CreateProviderCommand.cs
index 16d62d69c..09157d72c 100644
--- a/bitwarden_license/src/Commercial.Core/AdminConsole/Providers/CreateProviderCommand.cs
+++ b/bitwarden_license/src/Commercial.Core/AdminConsole/Providers/CreateProviderCommand.cs
@@ -5,6 +5,7 @@ using Bit.Core.AdminConsole.Providers.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.AdminConsole.Services;
using Bit.Core.Billing.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Repositories;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
diff --git a/bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs b/bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs
index f15850a8d..f252f1434 100644
--- a/bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs
+++ b/bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs
@@ -7,6 +7,7 @@ using Bit.Core.AdminConsole.Models.Business.Provider;
using Bit.Core.AdminConsole.Models.Business.Tokenables;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.AdminConsole.Services;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Extensions;
using Bit.Core.Context;
using Bit.Core.Entities;
diff --git a/bitwarden_license/src/Commercial.Core/Billing/ProviderBillingService.cs b/bitwarden_license/src/Commercial.Core/Billing/ProviderBillingService.cs
index f06f67690..608e3653f 100644
--- a/bitwarden_license/src/Commercial.Core/Billing/ProviderBillingService.cs
+++ b/bitwarden_license/src/Commercial.Core/Billing/ProviderBillingService.cs
@@ -8,6 +8,7 @@ using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Billing;
using Bit.Core.Billing.Constants;
using Bit.Core.Billing.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Extensions;
using Bit.Core.Billing.Models;
using Bit.Core.Billing.Repositories;
diff --git a/bitwarden_license/src/Commercial.Core/SecretsManager/Queries/Projects/MaxProjectsQuery.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Queries/Projects/MaxProjectsQuery.cs
index 7afad6e82..ee7bc398f 100644
--- a/bitwarden_license/src/Commercial.Core/SecretsManager/Queries/Projects/MaxProjectsQuery.cs
+++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Queries/Projects/MaxProjectsQuery.cs
@@ -1,4 +1,4 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Repositories;
using Bit.Core.SecretsManager.Queries.Projects.Interfaces;
diff --git a/bitwarden_license/test/Commercial.Core.Test/AdminConsole/ProviderFeatures/RemoveOrganizationFromProviderCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/AdminConsole/ProviderFeatures/RemoveOrganizationFromProviderCommandTests.cs
index 43928c3a5..5a1d5cf38 100644
--- a/bitwarden_license/test/Commercial.Core.Test/AdminConsole/ProviderFeatures/RemoveOrganizationFromProviderCommandTests.cs
+++ b/bitwarden_license/test/Commercial.Core.Test/AdminConsole/ProviderFeatures/RemoveOrganizationFromProviderCommandTests.cs
@@ -5,6 +5,7 @@ using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Billing.Constants;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Services;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
diff --git a/bitwarden_license/test/Commercial.Core.Test/AdminConsole/Services/ProviderServiceTests.cs b/bitwarden_license/test/Commercial.Core.Test/AdminConsole/Services/ProviderServiceTests.cs
index 564b631b1..9a1c6c78d 100644
--- a/bitwarden_license/test/Commercial.Core.Test/AdminConsole/Services/ProviderServiceTests.cs
+++ b/bitwarden_license/test/Commercial.Core.Test/AdminConsole/Services/ProviderServiceTests.cs
@@ -7,6 +7,7 @@ using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.AdminConsole.Models.Business.Provider;
using Bit.Core.AdminConsole.Models.Business.Tokenables;
using Bit.Core.AdminConsole.Repositories;
+using Bit.Core.Billing.Enums;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;
diff --git a/bitwarden_license/test/Commercial.Core.Test/Billing/ProviderBillingServiceTests.cs b/bitwarden_license/test/Commercial.Core.Test/Billing/ProviderBillingServiceTests.cs
index 479f6f4dd..a35213e35 100644
--- a/bitwarden_license/test/Commercial.Core.Test/Billing/ProviderBillingServiceTests.cs
+++ b/bitwarden_license/test/Commercial.Core.Test/Billing/ProviderBillingServiceTests.cs
@@ -10,6 +10,7 @@ using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Billing;
using Bit.Core.Billing.Constants;
using Bit.Core.Billing.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Models;
using Bit.Core.Billing.Repositories;
using Bit.Core.Billing.Services;
diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Queries/Projects/MaxProjectsQueryTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Queries/Projects/MaxProjectsQueryTests.cs
index e1fa7bf9f..347f5b212 100644
--- a/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Queries/Projects/MaxProjectsQueryTests.cs
+++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Queries/Projects/MaxProjectsQueryTests.cs
@@ -1,6 +1,6 @@
using Bit.Commercial.Core.SecretsManager.Queries.Projects;
using Bit.Core.AdminConsole.Entities;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Repositories;
using Bit.Core.SecretsManager.Repositories;
diff --git a/src/Admin/AdminConsole/Controllers/ProvidersController.cs b/src/Admin/AdminConsole/Controllers/ProvidersController.cs
index 621144e46..8eb28e24a 100644
--- a/src/Admin/AdminConsole/Controllers/ProvidersController.cs
+++ b/src/Admin/AdminConsole/Controllers/ProvidersController.cs
@@ -10,6 +10,7 @@ using Bit.Core.AdminConsole.Providers.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.AdminConsole.Services;
using Bit.Core.Billing.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Extensions;
using Bit.Core.Billing.Repositories;
using Bit.Core.Enums;
diff --git a/src/Admin/AdminConsole/Models/OrganizationEditModel.cs b/src/Admin/AdminConsole/Models/OrganizationEditModel.cs
index 27cf453f7..a582ac2a2 100644
--- a/src/Admin/AdminConsole/Models/OrganizationEditModel.cs
+++ b/src/Admin/AdminConsole/Models/OrganizationEditModel.cs
@@ -3,6 +3,7 @@ using System.Net;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Models;
using Bit.Core.Entities;
using Bit.Core.Enums;
@@ -22,8 +23,8 @@ public class OrganizationEditModel : OrganizationViewModel
{
Provider = provider;
BillingEmail = provider.Type == ProviderType.Reseller ? provider.BillingEmail : string.Empty;
- PlanType = Core.Enums.PlanType.TeamsMonthly;
- Plan = Core.Enums.PlanType.TeamsMonthly.GetDisplayAttribute()?.GetName();
+ PlanType = Core.Billing.Enums.PlanType.TeamsMonthly;
+ Plan = Core.Billing.Enums.PlanType.TeamsMonthly.GetDisplayAttribute()?.GetName();
LicenseKey = RandomLicenseKey;
}
diff --git a/src/Admin/AdminConsole/Models/ProviderEditModel.cs b/src/Admin/AdminConsole/Models/ProviderEditModel.cs
index e0c08d708..87de1fd98 100644
--- a/src/Admin/AdminConsole/Models/ProviderEditModel.cs
+++ b/src/Admin/AdminConsole/Models/ProviderEditModel.cs
@@ -2,6 +2,7 @@
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Models.Data.Provider;
using Bit.Core.Billing.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Enums;
namespace Bit.Admin.AdminConsole.Models;
diff --git a/src/Admin/AdminConsole/Views/Organizations/Edit.cshtml b/src/Admin/AdminConsole/Views/Organizations/Edit.cshtml
index 1db3e51dd..2499159d7 100644
--- a/src/Admin/AdminConsole/Views/Organizations/Edit.cshtml
+++ b/src/Admin/AdminConsole/Views/Organizations/Edit.cshtml
@@ -1,5 +1,6 @@
@using Bit.Admin.Enums;
@using Bit.Admin.Models
+@using Bit.Core.Billing.Enums
@using Bit.Core.Enums
@inject Bit.Admin.Services.IAccessControlService AccessControlService
@model OrganizationEditModel
diff --git a/src/Admin/AdminConsole/Views/Shared/_OrganizationForm.cshtml b/src/Admin/AdminConsole/Views/Shared/_OrganizationForm.cshtml
index 97f6219ea..5c43da628 100644
--- a/src/Admin/AdminConsole/Views/Shared/_OrganizationForm.cshtml
+++ b/src/Admin/AdminConsole/Views/Shared/_OrganizationForm.cshtml
@@ -1,6 +1,7 @@
@using Bit.Admin.Enums;
@using Bit.Core.Enums
@using Bit.Core.AdminConsole.Enums.Provider
+@using Bit.Core.Billing.Enums
@using Bit.SharedWeb.Utilities
@inject Bit.Admin.Services.IAccessControlService AccessControlService;
diff --git a/src/Admin/AdminConsole/Views/Shared/_OrganizationFormScripts.cshtml b/src/Admin/AdminConsole/Views/Shared/_OrganizationFormScripts.cshtml
index 5095d62c5..5e0b938da 100644
--- a/src/Admin/AdminConsole/Views/Shared/_OrganizationFormScripts.cshtml
+++ b/src/Admin/AdminConsole/Views/Shared/_OrganizationFormScripts.cshtml
@@ -1,5 +1,6 @@
@inject IWebHostEnvironment HostingEnvironment
@using Bit.Admin.Utilities
+@using Bit.Core.Billing.Enums
@using Bit.Core.Enums
@model OrganizationEditModel
diff --git a/src/Admin/Views/Tools/StripeSubscriptions.cshtml b/src/Admin/Views/Tools/StripeSubscriptions.cshtml
index a8de5ba90..ad8359e2d 100644
--- a/src/Admin/Views/Tools/StripeSubscriptions.cshtml
+++ b/src/Admin/Views/Tools/StripeSubscriptions.cshtml
@@ -149,7 +149,7 @@
Id |
Customer Email |
Status |
- Product |
+ Product Tier |
Current Period End |
diff --git a/src/Api/AdminConsole/Controllers/OrganizationsController.cs b/src/Api/AdminConsole/Controllers/OrganizationsController.cs
index 83c2fe0d1..0fdc03eed 100644
--- a/src/Api/AdminConsole/Controllers/OrganizationsController.cs
+++ b/src/Api/AdminConsole/Controllers/OrganizationsController.cs
@@ -18,6 +18,7 @@ using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Repositories;
using Bit.Core.Auth.Services;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Extensions;
using Bit.Core.Billing.Services;
using Bit.Core.Context;
@@ -355,7 +356,7 @@ public class OrganizationsController : Controller
{
// Non-enterprise orgs should not be able to create or view an apikey of billing sync/scim key types
var plan = StaticStore.GetPlan(organization.PlanType);
- if (plan.Product != ProductType.Enterprise)
+ if (plan.ProductTier != ProductTierType.Enterprise)
{
throw new NotFoundException();
}
diff --git a/src/Api/AdminConsole/Models/Request/Organizations/OrganizationCreateRequestModel.cs b/src/Api/AdminConsole/Models/Request/Organizations/OrganizationCreateRequestModel.cs
index 6a3f6b96e..6f5e39b7d 100644
--- a/src/Api/AdminConsole/Models/Request/Organizations/OrganizationCreateRequestModel.cs
+++ b/src/Api/AdminConsole/Models/Request/Organizations/OrganizationCreateRequestModel.cs
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
+using Bit.Core.Billing.Enums;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Business;
diff --git a/src/Api/AdminConsole/Models/Request/Organizations/OrganizationUpgradeRequestModel.cs b/src/Api/AdminConsole/Models/Request/Organizations/OrganizationUpgradeRequestModel.cs
index dae1b1d42..2a73f094e 100644
--- a/src/Api/AdminConsole/Models/Request/Organizations/OrganizationUpgradeRequestModel.cs
+++ b/src/Api/AdminConsole/Models/Request/Organizations/OrganizationUpgradeRequestModel.cs
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
using Bit.Core.Models.Business;
namespace Bit.Api.AdminConsole.Models.Request.Organizations;
diff --git a/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs b/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs
index e72f1fcf8..297ae247f 100644
--- a/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs
+++ b/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
using Bit.Api.Models.Response;
using Bit.Core.AdminConsole.Entities;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
using Bit.Core.Models.Api;
using Bit.Core.Models.Business;
using Bit.Core.Utilities;
diff --git a/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs b/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs
index ed75de7bf..ae7f2cdff 100644
--- a/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs
+++ b/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs
@@ -2,6 +2,7 @@
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Models.Data;
+using Bit.Core.Billing.Enums;
using Bit.Core.Enums;
using Bit.Core.Models.Api;
using Bit.Core.Models.Data;
@@ -33,7 +34,7 @@ public class ProfileOrganizationResponseModel : ResponseModel
UsePasswordManager = organization.UsePasswordManager;
UsersGetPremium = organization.UsersGetPremium;
UseCustomPermissions = organization.UseCustomPermissions;
- UseActivateAutofillPolicy = StaticStore.GetPlan(organization.PlanType).Product == ProductType.Enterprise;
+ UseActivateAutofillPolicy = StaticStore.GetPlan(organization.PlanType).ProductTier == ProductTierType.Enterprise;
SelfHost = organization.SelfHost;
Seats = organization.Seats;
MaxCollections = organization.MaxCollections;
@@ -56,7 +57,7 @@ public class ProfileOrganizationResponseModel : ResponseModel
FamilySponsorshipAvailable = FamilySponsorshipFriendlyName == null &&
StaticStore.GetSponsoredPlan(PlanSponsorshipType.FamiliesForEnterprise)
.UsersCanSponsor(organization);
- PlanProductType = StaticStore.GetPlan(organization.PlanType).Product;
+ ProductTierType = StaticStore.GetPlan(organization.PlanType).ProductTier;
FamilySponsorshipLastSyncDate = organization.FamilySponsorshipLastSyncDate;
FamilySponsorshipToDelete = organization.FamilySponsorshipToDelete;
FamilySponsorshipValidUntil = organization.FamilySponsorshipValidUntil;
@@ -147,7 +148,7 @@ public class ProfileOrganizationResponseModel : ResponseModel
public ProviderType? ProviderType { get; set; }
public string FamilySponsorshipFriendlyName { get; set; }
public bool FamilySponsorshipAvailable { get; set; }
- public ProductType PlanProductType { get; set; }
+ public ProductTierType ProductTierType { get; set; }
public bool KeyConnectorEnabled { get; set; }
public string KeyConnectorUrl { get; set; }
public DateTime? FamilySponsorshipLastSyncDate { get; set; }
diff --git a/src/Api/AdminConsole/Models/Response/ProfileProviderOrganizationResponseModel.cs b/src/Api/AdminConsole/Models/Response/ProfileProviderOrganizationResponseModel.cs
index 9c3951c29..a7dbd0209 100644
--- a/src/Api/AdminConsole/Models/Response/ProfileProviderOrganizationResponseModel.cs
+++ b/src/Api/AdminConsole/Models/Response/ProfileProviderOrganizationResponseModel.cs
@@ -1,4 +1,5 @@
using Bit.Core.AdminConsole.Models.Data.Provider;
+using Bit.Core.Billing.Enums;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Utilities;
@@ -25,7 +26,7 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo
UseResetPassword = organization.UseResetPassword;
UsersGetPremium = organization.UsersGetPremium;
UseCustomPermissions = organization.UseCustomPermissions;
- UseActivateAutofillPolicy = StaticStore.GetPlan(organization.PlanType).Product == ProductType.Enterprise;
+ UseActivateAutofillPolicy = StaticStore.GetPlan(organization.PlanType).ProductTier == ProductTierType.Enterprise;
SelfHost = organization.SelfHost;
Seats = organization.Seats;
MaxCollections = organization.MaxCollections;
@@ -42,7 +43,7 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo
UserId = organization.UserId;
ProviderId = organization.ProviderId;
ProviderName = organization.ProviderName;
- PlanProductType = StaticStore.GetPlan(organization.PlanType).Product;
+ ProductTierType = StaticStore.GetPlan(organization.PlanType).ProductTier;
LimitCollectionCreationDeletion = organization.LimitCollectionCreationDeletion;
AllowAdminAccessToAllCollectionItems = organization.AllowAdminAccessToAllCollectionItems;
FlexibleCollections = organization.FlexibleCollections;
diff --git a/src/Api/Billing/Models/Requests/CreateClientOrganizationRequestBody.cs b/src/Api/Billing/Models/Requests/CreateClientOrganizationRequestBody.cs
index c27fb4522..39b2e3323 100644
--- a/src/Api/Billing/Models/Requests/CreateClientOrganizationRequestBody.cs
+++ b/src/Api/Billing/Models/Requests/CreateClientOrganizationRequestBody.cs
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Bit.Api.Utilities;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
namespace Bit.Api.Billing.Models.Requests;
diff --git a/src/Api/Models/Response/PlanResponseModel.cs b/src/Api/Models/Response/PlanResponseModel.cs
index 7d007421e..f9d6959b4 100644
--- a/src/Api/Models/Response/PlanResponseModel.cs
+++ b/src/Api/Models/Response/PlanResponseModel.cs
@@ -1,4 +1,4 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
using Bit.Core.Models.Api;
using Bit.Core.Models.StaticStore;
@@ -15,7 +15,7 @@ public class PlanResponseModel : ResponseModel
}
Type = plan.Type;
- Product = plan.Product;
+ ProductTier = plan.ProductTier;
Name = plan.Name;
IsAnnual = plan.IsAnnual;
NameLocalizationKey = plan.NameLocalizationKey;
@@ -45,7 +45,7 @@ public class PlanResponseModel : ResponseModel
}
public PlanType Type { get; set; }
- public ProductType Product { get; set; }
+ public ProductTierType ProductTier { get; set; }
public string Name { get; set; }
public bool IsAnnual { get; set; }
public string NameLocalizationKey { get; set; }
diff --git a/src/Billing/Controllers/FreshsalesController.cs b/src/Billing/Controllers/FreshsalesController.cs
index 72d8de5e5..0182011d7 100644
--- a/src/Billing/Controllers/FreshsalesController.cs
+++ b/src/Billing/Controllers/FreshsalesController.cs
@@ -1,6 +1,6 @@
using System.Net.Http.Headers;
using System.Text.Json.Serialization;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
using Bit.Core.Repositories;
using Bit.Core.Settings;
using Bit.Core.Utilities;
diff --git a/src/Billing/Controllers/StripeController.cs b/src/Billing/Controllers/StripeController.cs
index 52923f06a..b03f6633d 100644
--- a/src/Billing/Controllers/StripeController.cs
+++ b/src/Billing/Controllers/StripeController.cs
@@ -5,6 +5,7 @@ using Bit.Core;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Billing.Constants;
+using Bit.Core.Billing.Enums;
using Bit.Core.Context;
using Bit.Core.Enums;
using Bit.Core.OrganizationFeatures.OrganizationSponsorships.FamiliesForEnterprise.Interfaces;
diff --git a/src/Core/AdminConsole/Entities/Organization.cs b/src/Core/AdminConsole/Entities/Organization.cs
index f12baf572..d3be3871b 100644
--- a/src/Core/AdminConsole/Entities/Organization.cs
+++ b/src/Core/AdminConsole/Entities/Organization.cs
@@ -3,6 +3,7 @@ using System.Net;
using System.Text.Json;
using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Models;
+using Bit.Core.Billing.Enums;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Business;
diff --git a/src/Core/AdminConsole/Models/Data/Organizations/OrganizationUsers/OrganizationUserOrganizationDetails.cs b/src/Core/AdminConsole/Models/Data/Organizations/OrganizationUsers/OrganizationUserOrganizationDetails.cs
index 141076df3..7f0a20762 100644
--- a/src/Core/AdminConsole/Models/Data/Organizations/OrganizationUsers/OrganizationUserOrganizationDetails.cs
+++ b/src/Core/AdminConsole/Models/Data/Organizations/OrganizationUsers/OrganizationUserOrganizationDetails.cs
@@ -1,5 +1,6 @@
using System.Text.Json.Serialization;
using Bit.Core.AdminConsole.Enums.Provider;
+using Bit.Core.Billing.Enums;
using Bit.Core.Utilities;
namespace Bit.Core.Models.Data.Organizations.OrganizationUsers;
@@ -33,7 +34,7 @@ public class OrganizationUserOrganizationDetails
public Enums.OrganizationUserStatusType Status { get; set; }
public Enums.OrganizationUserType Type { get; set; }
public bool Enabled { get; set; }
- public Enums.PlanType PlanType { get; set; }
+ public PlanType PlanType { get; set; }
public string SsoExternalId { get; set; }
public string Identifier { get; set; }
public string Permissions { get; set; }
diff --git a/src/Core/AdminConsole/Models/Data/Provider/ProviderUserOrganizationDetails.cs b/src/Core/AdminConsole/Models/Data/Provider/ProviderUserOrganizationDetails.cs
index 5acd3eec2..ed68f957a 100644
--- a/src/Core/AdminConsole/Models/Data/Provider/ProviderUserOrganizationDetails.cs
+++ b/src/Core/AdminConsole/Models/Data/Provider/ProviderUserOrganizationDetails.cs
@@ -1,5 +1,6 @@
using System.Text.Json.Serialization;
using Bit.Core.AdminConsole.Enums.Provider;
+using Bit.Core.Billing.Enums;
using Bit.Core.Utilities;
namespace Bit.Core.AdminConsole.Models.Data.Provider;
@@ -38,7 +39,7 @@ public class ProviderUserOrganizationDetails
public Guid? ProviderUserId { get; set; }
[JsonConverter(typeof(HtmlEncodingStringConverter))]
public string ProviderName { get; set; }
- public Core.Enums.PlanType PlanType { get; set; }
+ public PlanType PlanType { get; set; }
public bool LimitCollectionCreationDeletion { get; set; }
public bool AllowAdminAccessToAllCollectionItems { get; set; }
public bool FlexibleCollections { get; set; }
diff --git a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/AcceptOrgUserCommand.cs b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/AcceptOrgUserCommand.cs
index e0c2bada4..756bd2ae4 100644
--- a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/AcceptOrgUserCommand.cs
+++ b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/AcceptOrgUserCommand.cs
@@ -1,6 +1,7 @@
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.Services;
using Bit.Core.Auth.Models.Business.Tokenables;
+using Bit.Core.Billing.Enums;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
diff --git a/src/Core/AdminConsole/Services/Implementations/OrganizationService.cs b/src/Core/AdminConsole/Services/Implementations/OrganizationService.cs
index aec2178f7..9bcefa3c7 100644
--- a/src/Core/AdminConsole/Services/Implementations/OrganizationService.cs
+++ b/src/Core/AdminConsole/Services/Implementations/OrganizationService.cs
@@ -13,6 +13,7 @@ using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Models.Business;
using Bit.Core.Auth.Models.Business.Tokenables;
using Bit.Core.Auth.Repositories;
+using Bit.Core.Billing.Enums;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;
@@ -2054,9 +2055,9 @@ public class OrganizationService : IOrganizationService
throw new BadRequestException("Plan does not allow additional Machine Accounts.");
}
- if ((plan.Product == ProductType.TeamsStarter &&
+ if ((plan.ProductTier == ProductTierType.TeamsStarter &&
upgrade.AdditionalSmSeats.GetValueOrDefault() > plan.PasswordManager.BaseSeats) ||
- (plan.Product != ProductType.TeamsStarter &&
+ (plan.ProductTier != ProductTierType.TeamsStarter &&
upgrade.AdditionalSmSeats.GetValueOrDefault() > upgrade.AdditionalSeats))
{
throw new BadRequestException("You cannot have more Secrets Manager seats than Password Manager seats.");
diff --git a/src/Core/Billing/Entities/ProviderPlan.cs b/src/Core/Billing/Entities/ProviderPlan.cs
index f4965570d..114048057 100644
--- a/src/Core/Billing/Entities/ProviderPlan.cs
+++ b/src/Core/Billing/Entities/ProviderPlan.cs
@@ -1,5 +1,5 @@
-using Bit.Core.Entities;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Entities;
using Bit.Core.Utilities;
namespace Bit.Core.Billing.Entities;
diff --git a/src/Core/Enums/PlanType.cs b/src/Core/Billing/Enums/PlanType.cs
similarity index 97%
rename from src/Core/Enums/PlanType.cs
rename to src/Core/Billing/Enums/PlanType.cs
index 0fe72a4c4..e88a73af1 100644
--- a/src/Core/Enums/PlanType.cs
+++ b/src/Core/Billing/Enums/PlanType.cs
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
-namespace Bit.Core.Enums;
+namespace Bit.Core.Billing.Enums;
public enum PlanType : byte
{
diff --git a/src/Core/Enums/ProductType.cs b/src/Core/Billing/Enums/ProductTierType.cs
similarity index 81%
rename from src/Core/Enums/ProductType.cs
rename to src/Core/Billing/Enums/ProductTierType.cs
index 9d6e0e2bb..05d83fe8e 100644
--- a/src/Core/Enums/ProductType.cs
+++ b/src/Core/Billing/Enums/ProductTierType.cs
@@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations;
-namespace Bit.Core.Enums;
+namespace Bit.Core.Billing.Enums;
-public enum ProductType : byte
+public enum ProductTierType : byte
{
[Display(Name = "Free")]
Free = 0,
@@ -15,4 +15,3 @@ public enum ProductType : byte
[Display(Name = "Teams Starter")]
TeamsStarter = 4,
}
-
diff --git a/src/Core/Billing/Enums/ProductType.cs b/src/Core/Billing/Enums/ProductType.cs
new file mode 100644
index 000000000..63ea803d4
--- /dev/null
+++ b/src/Core/Billing/Enums/ProductType.cs
@@ -0,0 +1,11 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Bit.Core.Billing.Enums;
+
+public enum ProductType
+{
+ [Display(Name = "Password Manager")]
+ PasswordManager = 0,
+ [Display(Name = "Secrets Manager")]
+ SecretsManager = 1,
+}
diff --git a/src/Core/Billing/Extensions/BillingExtensions.cs b/src/Core/Billing/Extensions/BillingExtensions.cs
index 1a5665224..c3ba756ed 100644
--- a/src/Core/Billing/Extensions/BillingExtensions.cs
+++ b/src/Core/Billing/Extensions/BillingExtensions.cs
@@ -1,6 +1,7 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
+using Bit.Core.Billing.Enums;
using Bit.Core.Enums;
using Stripe;
diff --git a/src/Core/Billing/Models/ConfiguredProviderPlanDTO.cs b/src/Core/Billing/Models/ConfiguredProviderPlanDTO.cs
index 519e2f406..d8ada5716 100644
--- a/src/Core/Billing/Models/ConfiguredProviderPlanDTO.cs
+++ b/src/Core/Billing/Models/ConfiguredProviderPlanDTO.cs
@@ -1,5 +1,5 @@
using Bit.Core.Billing.Entities;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
namespace Bit.Core.Billing.Models;
diff --git a/src/Core/Models/StaticStore/Plan.cs b/src/Core/Billing/Models/StaticStore/Plan.cs
similarity index 97%
rename from src/Core/Models/StaticStore/Plan.cs
rename to src/Core/Billing/Models/StaticStore/Plan.cs
index 4f8b0435f..e6abb34d3 100644
--- a/src/Core/Models/StaticStore/Plan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plan.cs
@@ -1,11 +1,11 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
namespace Bit.Core.Models.StaticStore;
public abstract record Plan
{
public PlanType Type { get; protected init; }
- public ProductType Product { get; protected init; }
+ public ProductTierType ProductTier { get; protected init; }
public string Name { get; protected init; }
public bool IsAnnual { get; protected init; }
public string NameLocalizationKey { get; protected init; }
diff --git a/src/Core/Models/StaticStore/Plans/CustomPlan.cs b/src/Core/Billing/Models/StaticStore/Plans/CustomPlan.cs
similarity index 68%
rename from src/Core/Models/StaticStore/Plans/CustomPlan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/CustomPlan.cs
index 77eee781e..ce55cb422 100644
--- a/src/Core/Models/StaticStore/Plans/CustomPlan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/CustomPlan.cs
@@ -1,8 +1,9 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
-public record CustomPlan : Models.StaticStore.Plan
+public record CustomPlan : Plan
{
public CustomPlan()
{
diff --git a/src/Core/Models/StaticStore/Plans/Enterprise2019Plan.cs b/src/Core/Billing/Models/StaticStore/Plans/Enterprise2019Plan.cs
similarity index 93%
rename from src/Core/Models/StaticStore/Plans/Enterprise2019Plan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/Enterprise2019Plan.cs
index 802326def..72db7897b 100644
--- a/src/Core/Models/StaticStore/Plans/Enterprise2019Plan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/Enterprise2019Plan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
-public record Enterprise2019Plan : Models.StaticStore.Plan
+public record Enterprise2019Plan : Plan
{
public Enterprise2019Plan(bool isAnnual)
{
Type = isAnnual ? PlanType.EnterpriseAnnually2019 : PlanType.EnterpriseMonthly2019;
- Product = ProductType.Enterprise;
+ ProductTier = ProductTierType.Enterprise;
Name = isAnnual ? "Enterprise (Annually) 2019" : "Enterprise (Monthly) 2019";
IsAnnual = isAnnual;
NameLocalizationKey = "planNameEnterprise";
diff --git a/src/Core/Models/StaticStore/Plans/Enterprise2020Plan.cs b/src/Core/Billing/Models/StaticStore/Plans/Enterprise2020Plan.cs
similarity index 93%
rename from src/Core/Models/StaticStore/Plans/Enterprise2020Plan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/Enterprise2020Plan.cs
index d98432080..42b984e7e 100644
--- a/src/Core/Models/StaticStore/Plans/Enterprise2020Plan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/Enterprise2020Plan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
-public record Enterprise2020Plan : Models.StaticStore.Plan
+public record Enterprise2020Plan : Plan
{
public Enterprise2020Plan(bool isAnnual)
{
Type = isAnnual ? PlanType.EnterpriseAnnually2020 : PlanType.EnterpriseMonthly2020;
- Product = ProductType.Enterprise;
+ ProductTier = ProductTierType.Enterprise;
Name = isAnnual ? "Enterprise (Annually) 2020" : "Enterprise (Monthly) 2020";
IsAnnual = isAnnual;
NameLocalizationKey = "planNameEnterprise";
diff --git a/src/Core/Models/StaticStore/Plans/EnterprisePlan.cs b/src/Core/Billing/Models/StaticStore/Plans/EnterprisePlan.cs
similarity index 94%
rename from src/Core/Models/StaticStore/Plans/EnterprisePlan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/EnterprisePlan.cs
index 4e256bff2..f81f84ffc 100644
--- a/src/Core/Models/StaticStore/Plans/EnterprisePlan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/EnterprisePlan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
public record EnterprisePlan : Plan
{
public EnterprisePlan(bool isAnnual)
{
Type = isAnnual ? PlanType.EnterpriseAnnually : PlanType.EnterpriseMonthly;
- Product = ProductType.Enterprise;
+ ProductTier = ProductTierType.Enterprise;
Name = isAnnual ? "Enterprise (Annually)" : "Enterprise (Monthly)";
IsAnnual = isAnnual;
NameLocalizationKey = "planNameEnterprise";
diff --git a/src/Core/Models/StaticStore/Plans/EnterprisePlan2023.cs b/src/Core/Billing/Models/StaticStore/Plans/EnterprisePlan2023.cs
similarity index 94%
rename from src/Core/Models/StaticStore/Plans/EnterprisePlan2023.cs
rename to src/Core/Billing/Models/StaticStore/Plans/EnterprisePlan2023.cs
index 9e448199f..8cd833542 100644
--- a/src/Core/Models/StaticStore/Plans/EnterprisePlan2023.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/EnterprisePlan2023.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
public record Enterprise2023Plan : Plan
{
public Enterprise2023Plan(bool isAnnual)
{
Type = isAnnual ? PlanType.EnterpriseAnnually2023 : PlanType.EnterpriseMonthly2023;
- Product = ProductType.Enterprise;
+ ProductTier = ProductTierType.Enterprise;
Name = isAnnual ? "Enterprise (Annually)" : "Enterprise (Monthly)";
IsAnnual = isAnnual;
NameLocalizationKey = "planNameEnterprise";
diff --git a/src/Core/Models/StaticStore/Plans/Families2019Plan.cs b/src/Core/Billing/Models/StaticStore/Plans/Families2019Plan.cs
similarity index 85%
rename from src/Core/Models/StaticStore/Plans/Families2019Plan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/Families2019Plan.cs
index 14ddb3405..b0ca8feeb 100644
--- a/src/Core/Models/StaticStore/Plans/Families2019Plan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/Families2019Plan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
-public record Families2019Plan : Models.StaticStore.Plan
+public record Families2019Plan : Plan
{
public Families2019Plan()
{
Type = PlanType.FamiliesAnnually2019;
- Product = ProductType.Families;
+ ProductTier = ProductTierType.Families;
Name = "Families 2019";
IsAnnual = true;
NameLocalizationKey = "planNameFamilies";
diff --git a/src/Core/Models/StaticStore/Plans/FamiliesPlan.cs b/src/Core/Billing/Models/StaticStore/Plans/FamiliesPlan.cs
similarity index 83%
rename from src/Core/Models/StaticStore/Plans/FamiliesPlan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/FamiliesPlan.cs
index 9a6e90cf0..e2f51ec91 100644
--- a/src/Core/Models/StaticStore/Plans/FamiliesPlan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/FamiliesPlan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
-public record FamiliesPlan : Models.StaticStore.Plan
+public record FamiliesPlan : Plan
{
public FamiliesPlan()
{
Type = PlanType.FamiliesAnnually;
- Product = ProductType.Families;
+ ProductTier = ProductTierType.Families;
Name = "Families";
IsAnnual = true;
NameLocalizationKey = "planNameFamilies";
diff --git a/src/Core/Models/StaticStore/Plans/FreePlan.cs b/src/Core/Billing/Models/StaticStore/Plans/FreePlan.cs
similarity index 84%
rename from src/Core/Models/StaticStore/Plans/FreePlan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/FreePlan.cs
index 2b647f91e..3b0a8b748 100644
--- a/src/Core/Models/StaticStore/Plans/FreePlan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/FreePlan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
-public record FreePlan : Models.StaticStore.Plan
+public record FreePlan : Plan
{
public FreePlan()
{
Type = PlanType.Free;
- Product = ProductType.Free;
+ ProductTier = ProductTierType.Free;
Name = "Free";
NameLocalizationKey = "planNameFree";
DescriptionLocalizationKey = "planDescFree";
diff --git a/src/Core/Models/StaticStore/Plans/Teams2019Plan.cs b/src/Core/Billing/Models/StaticStore/Plans/Teams2019Plan.cs
similarity index 93%
rename from src/Core/Models/StaticStore/Plans/Teams2019Plan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/Teams2019Plan.cs
index ce53354f2..27ed5e0bf 100644
--- a/src/Core/Models/StaticStore/Plans/Teams2019Plan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/Teams2019Plan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
-public record Teams2019Plan : Models.StaticStore.Plan
+public record Teams2019Plan : Plan
{
public Teams2019Plan(bool isAnnual)
{
Type = isAnnual ? PlanType.TeamsAnnually2019 : PlanType.TeamsMonthly2019;
- Product = ProductType.Teams;
+ ProductTier = ProductTierType.Teams;
Name = isAnnual ? "Teams (Annually) 2019" : "Teams (Monthly) 2019";
IsAnnual = isAnnual;
NameLocalizationKey = "planNameTeams";
diff --git a/src/Core/Models/StaticStore/Plans/Teams2020Plan.cs b/src/Core/Billing/Models/StaticStore/Plans/Teams2020Plan.cs
similarity index 93%
rename from src/Core/Models/StaticStore/Plans/Teams2020Plan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/Teams2020Plan.cs
index e040edc88..a760b9692 100644
--- a/src/Core/Models/StaticStore/Plans/Teams2020Plan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/Teams2020Plan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
-public record Teams2020Plan : Models.StaticStore.Plan
+public record Teams2020Plan : Plan
{
public Teams2020Plan(bool isAnnual)
{
Type = isAnnual ? PlanType.TeamsAnnually2020 : PlanType.TeamsMonthly2020;
- Product = ProductType.Teams;
+ ProductTier = ProductTierType.Teams;
Name = isAnnual ? "Teams (Annually) 2020" : "Teams (Monthly) 2020";
IsAnnual = isAnnual;
NameLocalizationKey = "planNameTeams";
diff --git a/src/Core/Models/StaticStore/Plans/TeamsPlan.cs b/src/Core/Billing/Models/StaticStore/Plans/TeamsPlan.cs
similarity index 94%
rename from src/Core/Models/StaticStore/Plans/TeamsPlan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/TeamsPlan.cs
index 84ce6d4fd..e0ea93723 100644
--- a/src/Core/Models/StaticStore/Plans/TeamsPlan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/TeamsPlan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
public record TeamsPlan : Plan
{
public TeamsPlan(bool isAnnual)
{
Type = isAnnual ? PlanType.TeamsAnnually : PlanType.TeamsMonthly;
- Product = ProductType.Teams;
+ ProductTier = ProductTierType.Teams;
Name = isAnnual ? "Teams (Annually)" : "Teams (Monthly)";
IsAnnual = isAnnual;
NameLocalizationKey = "planNameTeams";
diff --git a/src/Core/Models/StaticStore/Plans/TeamsPlan2023.cs b/src/Core/Billing/Models/StaticStore/Plans/TeamsPlan2023.cs
similarity index 94%
rename from src/Core/Models/StaticStore/Plans/TeamsPlan2023.cs
rename to src/Core/Billing/Models/StaticStore/Plans/TeamsPlan2023.cs
index c0b319010..8498af6b1 100644
--- a/src/Core/Models/StaticStore/Plans/TeamsPlan2023.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/TeamsPlan2023.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
public record Teams2023Plan : Plan
{
public Teams2023Plan(bool isAnnual)
{
Type = isAnnual ? PlanType.TeamsAnnually2023 : PlanType.TeamsMonthly2023;
- Product = ProductType.Teams;
+ ProductTier = ProductTierType.Teams;
Name = isAnnual ? "Teams (Annually)" : "Teams (Monthly)";
IsAnnual = isAnnual;
NameLocalizationKey = "planNameTeams";
diff --git a/src/Core/Models/StaticStore/Plans/TeamsStarterPlan.cs b/src/Core/Billing/Models/StaticStore/Plans/TeamsStarterPlan.cs
similarity index 91%
rename from src/Core/Models/StaticStore/Plans/TeamsStarterPlan.cs
rename to src/Core/Billing/Models/StaticStore/Plans/TeamsStarterPlan.cs
index 9e308b5e5..d78844e42 100644
--- a/src/Core/Models/StaticStore/Plans/TeamsStarterPlan.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/TeamsStarterPlan.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
public record TeamsStarterPlan : Plan
{
public TeamsStarterPlan()
{
Type = PlanType.TeamsStarter;
- Product = ProductType.TeamsStarter;
+ ProductTier = ProductTierType.TeamsStarter;
Name = "Teams (Starter)";
NameLocalizationKey = "planNameTeamsStarter";
DescriptionLocalizationKey = "planDescTeams";
diff --git a/src/Core/Models/StaticStore/Plans/TeamsStarterPlan2023.cs b/src/Core/Billing/Models/StaticStore/Plans/TeamsStarterPlan2023.cs
similarity index 91%
rename from src/Core/Models/StaticStore/Plans/TeamsStarterPlan2023.cs
rename to src/Core/Billing/Models/StaticStore/Plans/TeamsStarterPlan2023.cs
index 77b70b831..ea15d9eb9 100644
--- a/src/Core/Models/StaticStore/Plans/TeamsStarterPlan2023.cs
+++ b/src/Core/Billing/Models/StaticStore/Plans/TeamsStarterPlan2023.cs
@@ -1,13 +1,14 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Models.StaticStore;
-namespace Bit.Core.Models.StaticStore.Plans;
+namespace Bit.Core.Billing.Models.StaticStore.Plans;
public record TeamsStarterPlan2023 : Plan
{
public TeamsStarterPlan2023()
{
Type = PlanType.TeamsStarter2023;
- Product = ProductType.TeamsStarter;
+ ProductTier = ProductTierType.TeamsStarter;
Name = "Teams (Starter)";
NameLocalizationKey = "planNameTeamsStarter";
DescriptionLocalizationKey = "planDescTeams";
diff --git a/src/Core/Models/StaticStore/SponsoredPlan.cs b/src/Core/Billing/Models/StaticStore/SponsoredPlan.cs
similarity index 63%
rename from src/Core/Models/StaticStore/SponsoredPlan.cs
rename to src/Core/Billing/Models/StaticStore/SponsoredPlan.cs
index bcd23874a..d0d98159a 100644
--- a/src/Core/Models/StaticStore/SponsoredPlan.cs
+++ b/src/Core/Billing/Models/StaticStore/SponsoredPlan.cs
@@ -1,4 +1,5 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
namespace Bit.Core.Models.StaticStore;
@@ -6,8 +7,8 @@ namespace Bit.Core.Models.StaticStore;
public class SponsoredPlan
{
public PlanSponsorshipType PlanSponsorshipType { get; set; }
- public ProductType SponsoredProductType { get; set; }
- public ProductType SponsoringProductType { get; set; }
+ public ProductTierType SponsoredProductTierType { get; set; }
+ public ProductTierType SponsoringProductTierType { get; set; }
public string StripePlanId { get; set; }
public Func UsersCanSponsor { get; set; }
}
diff --git a/src/Core/Billing/Services/IProviderBillingService.cs b/src/Core/Billing/Services/IProviderBillingService.cs
index bc1aa0042..fbed616a6 100644
--- a/src/Core/Billing/Services/IProviderBillingService.cs
+++ b/src/Core/Billing/Services/IProviderBillingService.cs
@@ -1,8 +1,8 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Models;
-using Bit.Core.Enums;
using Bit.Core.Models.Business;
namespace Bit.Core.Billing.Services;
diff --git a/src/Core/Models/Business/OrganizationLicense.cs b/src/Core/Models/Business/OrganizationLicense.cs
index 9cdc1f9f5..cfc374ad8 100644
--- a/src/Core/Models/Business/OrganizationLicense.cs
+++ b/src/Core/Models/Business/OrganizationLicense.cs
@@ -4,6 +4,7 @@ using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.Json.Serialization;
using Bit.Core.AdminConsole.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Enums;
using Bit.Core.Services;
using Bit.Core.Settings;
diff --git a/src/Core/Models/Business/OrganizationUpgrade.cs b/src/Core/Models/Business/OrganizationUpgrade.cs
index 6992f492a..4928ecf65 100644
--- a/src/Core/Models/Business/OrganizationUpgrade.cs
+++ b/src/Core/Models/Business/OrganizationUpgrade.cs
@@ -1,4 +1,4 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
namespace Bit.Core.Models.Business;
diff --git a/src/Core/Models/Business/ProviderSubscriptionUpdate.cs b/src/Core/Models/Business/ProviderSubscriptionUpdate.cs
index 8b29bebce..4ce372bab 100644
--- a/src/Core/Models/Business/ProviderSubscriptionUpdate.cs
+++ b/src/Core/Models/Business/ProviderSubscriptionUpdate.cs
@@ -1,5 +1,5 @@
-using Bit.Core.Billing.Extensions;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Billing.Extensions;
using Stripe;
using static Bit.Core.Billing.Utilities;
diff --git a/src/Core/Models/Business/SubscriptionUpdate.cs b/src/Core/Models/Business/SubscriptionUpdate.cs
index 011444e9a..f5afabfb9 100644
--- a/src/Core/Models/Business/SubscriptionUpdate.cs
+++ b/src/Core/Models/Business/SubscriptionUpdate.cs
@@ -1,4 +1,4 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
using Stripe;
namespace Bit.Core.Models.Business;
diff --git a/src/Core/Models/Mail/OrganizationInvitesInfo.cs b/src/Core/Models/Mail/OrganizationInvitesInfo.cs
index e726b929a..267c386a6 100644
--- a/src/Core/Models/Mail/OrganizationInvitesInfo.cs
+++ b/src/Core/Models/Mail/OrganizationInvitesInfo.cs
@@ -1,7 +1,7 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Auth.Models.Business;
+using Bit.Core.Billing.Enums;
using Bit.Core.Entities;
-using Bit.Core.Enums;
namespace Bit.Core.Models.Mail;
public class OrganizationInvitesInfo
diff --git a/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/CloudSyncSponsorshipsCommand.cs b/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/CloudSyncSponsorshipsCommand.cs
index 29ff74877..f817ef7d2 100644
--- a/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/CloudSyncSponsorshipsCommand.cs
+++ b/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/CloudSyncSponsorshipsCommand.cs
@@ -53,9 +53,9 @@ public class CloudSyncSponsorshipsCommand : ICloudSyncSponsorshipsCommand
foreach (var selfHostedSponsorship in sponsorshipsData)
{
- var requiredSponsoringProductType = StaticStore.GetSponsoredPlan(selfHostedSponsorship.PlanSponsorshipType)?.SponsoringProductType;
+ var requiredSponsoringProductType = StaticStore.GetSponsoredPlan(selfHostedSponsorship.PlanSponsorshipType)?.SponsoringProductTierType;
if (requiredSponsoringProductType == null
- || StaticStore.GetPlan(sponsoringOrg.PlanType).Product != requiredSponsoringProductType.Value)
+ || StaticStore.GetPlan(sponsoringOrg.PlanType).ProductTier != requiredSponsoringProductType.Value)
{
continue; // prevent unsupported sponsorships
}
diff --git a/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/SetUpSponsorshipCommand.cs b/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/SetUpSponsorshipCommand.cs
index c43e64f69..e8d43fd6a 100644
--- a/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/SetUpSponsorshipCommand.cs
+++ b/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/SetUpSponsorshipCommand.cs
@@ -49,10 +49,10 @@ public class SetUpSponsorshipCommand : ISetUpSponsorshipCommand
}
// Check org to sponsor's product type
- var requiredSponsoredProductType = StaticStore.GetSponsoredPlan(sponsorship.PlanSponsorshipType.Value)?.SponsoredProductType;
+ var requiredSponsoredProductType = StaticStore.GetSponsoredPlan(sponsorship.PlanSponsorshipType.Value)?.SponsoredProductTierType;
if (requiredSponsoredProductType == null ||
sponsoredOrganization == null ||
- StaticStore.GetPlan(sponsoredOrganization.PlanType).Product != requiredSponsoredProductType.Value)
+ StaticStore.GetPlan(sponsoredOrganization.PlanType).ProductTier != requiredSponsoredProductType.Value)
{
throw new BadRequestException("Can only redeem sponsorship offer on families organizations.");
}
diff --git a/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/ValidateSponsorshipCommand.cs b/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/ValidateSponsorshipCommand.cs
index 97b6b18e4..9c3f66c43 100644
--- a/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/ValidateSponsorshipCommand.cs
+++ b/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/Cloud/ValidateSponsorshipCommand.cs
@@ -59,7 +59,7 @@ public class ValidateSponsorshipCommand : CancelSponsorshipCommand, IValidateSpo
var sponsoringOrgPlan = Utilities.StaticStore.GetPlan(sponsoringOrganization.PlanType);
if (OrgDisabledForMoreThanGracePeriod(sponsoringOrganization) ||
- sponsoredPlan.SponsoringProductType != sponsoringOrgPlan.Product ||
+ sponsoredPlan.SponsoringProductTierType != sponsoringOrgPlan.ProductTier ||
existingSponsorship.ToDelete ||
SponsorshipIsSelfHostedOutOfSync(existingSponsorship))
{
diff --git a/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/CreateSponsorshipCommand.cs b/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/CreateSponsorshipCommand.cs
index f6373c3dc..a00dae2a9 100644
--- a/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/CreateSponsorshipCommand.cs
+++ b/src/Core/OrganizationFeatures/OrganizationSponsorships/FamiliesForEnterprise/CreateSponsorshipCommand.cs
@@ -30,10 +30,10 @@ public class CreateSponsorshipCommand : ICreateSponsorshipCommand
throw new BadRequestException("Cannot offer a Families Organization Sponsorship to yourself. Choose a different email.");
}
- var requiredSponsoringProductType = StaticStore.GetSponsoredPlan(sponsorshipType)?.SponsoringProductType;
+ var requiredSponsoringProductType = StaticStore.GetSponsoredPlan(sponsorshipType)?.SponsoringProductTierType;
if (requiredSponsoringProductType == null ||
sponsoringOrg == null ||
- StaticStore.GetPlan(sponsoringOrg.PlanType).Product != requiredSponsoringProductType.Value)
+ StaticStore.GetPlan(sponsoringOrg.PlanType).ProductTier != requiredSponsoringProductType.Value)
{
throw new BadRequestException("Specified Organization cannot sponsor other organizations.");
}
diff --git a/src/Core/OrganizationFeatures/OrganizationSubscriptions/AddSecretsManagerSubscriptionCommand.cs b/src/Core/OrganizationFeatures/OrganizationSubscriptions/AddSecretsManagerSubscriptionCommand.cs
index 6203b9dc9..08cd09e5c 100644
--- a/src/Core/OrganizationFeatures/OrganizationSubscriptions/AddSecretsManagerSubscriptionCommand.cs
+++ b/src/Core/OrganizationFeatures/OrganizationSubscriptions/AddSecretsManagerSubscriptionCommand.cs
@@ -1,7 +1,7 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.AdminConsole.Repositories;
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Business;
using Bit.Core.OrganizationFeatures.OrganizationSubscriptions.Interface;
@@ -34,7 +34,7 @@ public class AddSecretsManagerSubscriptionCommand : IAddSecretsManagerSubscripti
var signup = SetOrganizationUpgrade(organization, additionalSmSeats, additionalServiceAccounts);
_organizationService.ValidateSecretsManagerPlan(plan, signup);
- if (plan.Product != ProductType.Free)
+ if (plan.ProductTier != ProductTierType.Free)
{
await _paymentService.AddSecretsManagerToSubscription(organization, plan, additionalSmSeats, additionalServiceAccounts);
}
@@ -74,12 +74,12 @@ public class AddSecretsManagerSubscriptionCommand : IAddSecretsManagerSubscripti
}
var plan = StaticStore.Plans.FirstOrDefault(p => p.Type == organization.PlanType && p.SupportsSecretsManager);
- if (string.IsNullOrWhiteSpace(organization.GatewayCustomerId) && plan.Product != ProductType.Free)
+ if (string.IsNullOrWhiteSpace(organization.GatewayCustomerId) && plan.ProductTier != ProductTierType.Free)
{
throw new BadRequestException("No payment method found.");
}
- if (string.IsNullOrWhiteSpace(organization.GatewaySubscriptionId) && plan.Product != ProductType.Free)
+ if (string.IsNullOrWhiteSpace(organization.GatewaySubscriptionId) && plan.ProductTier != ProductTierType.Free)
{
throw new BadRequestException("No subscription found.");
}
diff --git a/src/Core/OrganizationFeatures/OrganizationSubscriptions/UpdateSecretsManagerSubscriptionCommand.cs b/src/Core/OrganizationFeatures/OrganizationSubscriptions/UpdateSecretsManagerSubscriptionCommand.cs
index 6dccf7c81..78ab35c38 100644
--- a/src/Core/OrganizationFeatures/OrganizationSubscriptions/UpdateSecretsManagerSubscriptionCommand.cs
+++ b/src/Core/OrganizationFeatures/OrganizationSubscriptions/UpdateSecretsManagerSubscriptionCommand.cs
@@ -1,4 +1,5 @@
using Bit.Core.AdminConsole.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Business;
@@ -165,7 +166,7 @@ public class UpdateSecretsManagerSubscriptionCommand : IUpdateSecretsManagerSubs
throw new BadRequestException("Organization has no access to Secrets Manager.");
}
- if (update.Plan.Product == ProductType.Free)
+ if (update.Plan.ProductTier == ProductTierType.Free)
{
// No need to check the organization is set up with Stripe
return;
diff --git a/src/Core/OrganizationFeatures/OrganizationSubscriptions/UpgradeOrganizationPlanCommand.cs b/src/Core/OrganizationFeatures/OrganizationSubscriptions/UpgradeOrganizationPlanCommand.cs
index 7d91ed737..cf234ef60 100644
--- a/src/Core/OrganizationFeatures/OrganizationSubscriptions/UpgradeOrganizationPlanCommand.cs
+++ b/src/Core/OrganizationFeatures/OrganizationSubscriptions/UpgradeOrganizationPlanCommand.cs
@@ -4,6 +4,7 @@ using Bit.Core.AdminConsole.Models.OrganizationConnectionConfigs;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Repositories;
+using Bit.Core.Billing.Enums;
using Bit.Core.Context;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
@@ -279,7 +280,7 @@ public class UpgradeOrganizationPlanCommand : IUpgradeOrganizationPlanCommand
if (success)
{
- var upgradePath = GetUpgradePath(existingPlan.Product, newPlan.Product);
+ var upgradePath = GetUpgradePath(existingPlan.ProductTier, newPlan.ProductTier);
await _referenceEventService.RaiseEventAsync(
new ReferenceEvent(ReferenceEventType.UpgradePlan, organization, _currentContext)
{
@@ -342,25 +343,25 @@ public class UpgradeOrganizationPlanCommand : IUpgradeOrganizationPlanCommand
return await _organizationRepository.GetByIdAsync(id);
}
- private static string GetUpgradePath(ProductType oldProductType, ProductType newProductType)
+ private static string GetUpgradePath(ProductTierType oldProductTierType, ProductTierType newProductTierType)
{
- var oldDescription = _upgradePath.TryGetValue(oldProductType, out var description)
+ var oldDescription = _upgradePath.TryGetValue(oldProductTierType, out var description)
? description
- : $"{oldProductType:G}";
+ : $"{oldProductTierType:G}";
- var newDescription = _upgradePath.TryGetValue(newProductType, out description)
+ var newDescription = _upgradePath.TryGetValue(newProductTierType, out description)
? description
- : $"{newProductType:G}";
+ : $"{newProductTierType:G}";
return $"{oldDescription} → {newDescription}";
}
- private static readonly Dictionary _upgradePath = new()
+ private static readonly Dictionary _upgradePath = new()
{
- [ProductType.Free] = "2-person org",
- [ProductType.Families] = "Families",
- [ProductType.TeamsStarter] = "Teams Starter",
- [ProductType.Teams] = "Teams",
- [ProductType.Enterprise] = "Enterprise"
+ [ProductTierType.Free] = "2-person org",
+ [ProductTierType.Families] = "Families",
+ [ProductTierType.TeamsStarter] = "Teams Starter",
+ [ProductTierType.Teams] = "Teams",
+ [ProductTierType.Enterprise] = "Enterprise"
};
}
diff --git a/src/Core/Tools/Models/Business/ReferenceEvent.cs b/src/Core/Tools/Models/Business/ReferenceEvent.cs
index 5e68b8cce..114d67414 100644
--- a/src/Core/Tools/Models/Business/ReferenceEvent.cs
+++ b/src/Core/Tools/Models/Business/ReferenceEvent.cs
@@ -1,8 +1,8 @@
#nullable enable
using System.Text.Json.Serialization;
+using Bit.Core.Billing.Enums;
using Bit.Core.Context;
-using Bit.Core.Enums;
using Bit.Core.Tools.Entities;
using Bit.Core.Tools.Enums;
diff --git a/src/Core/Utilities/CoreHelpers.cs b/src/Core/Utilities/CoreHelpers.cs
index af658a409..c263ccdbe 100644
--- a/src/Core/Utilities/CoreHelpers.cs
+++ b/src/Core/Utilities/CoreHelpers.cs
@@ -13,9 +13,9 @@ using Azure.Storage.Queues.Models;
using Bit.Core.AdminConsole.Context;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.Auth.Enums;
+using Bit.Core.Billing.Enums;
using Bit.Core.Context;
using Bit.Core.Entities;
-using Bit.Core.Enums;
using Bit.Core.Identity;
using Bit.Core.Settings;
using IdentityModel;
diff --git a/src/Core/Utilities/StaticStore.cs b/src/Core/Utilities/StaticStore.cs
index 51c8fdd0c..78fcd0d99 100644
--- a/src/Core/Utilities/StaticStore.cs
+++ b/src/Core/Utilities/StaticStore.cs
@@ -1,8 +1,9 @@
using System.Collections.Immutable;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Billing.Models.StaticStore.Plans;
using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
using Bit.Core.Models.StaticStore;
-using Bit.Core.Models.StaticStore.Plans;
namespace Bit.Core.Utilities;
@@ -142,11 +143,11 @@ public static class StaticStore
new SponsoredPlan
{
PlanSponsorshipType = PlanSponsorshipType.FamiliesForEnterprise,
- SponsoredProductType = ProductType.Families,
- SponsoringProductType = ProductType.Enterprise,
+ SponsoredProductTierType = ProductTierType.Families,
+ SponsoringProductTierType = ProductTierType.Enterprise,
StripePlanId = "2021-family-for-enterprise-annually",
UsersCanSponsor = (OrganizationUserOrganizationDetails org) =>
- GetPlan(org.PlanType).Product == ProductType.Enterprise,
+ GetPlan(org.PlanType).ProductTier == ProductTierType.Enterprise,
}
};
diff --git a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs
index 9a4573e77..ee46643fe 100644
--- a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs
+++ b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs
@@ -1,5 +1,6 @@
using AutoMapper;
using AutoMapper.QueryableExtensions;
+using Bit.Core.Billing.Enums;
using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations;
using Bit.Core.Repositories;
diff --git a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs
index c1656d3df..bb7d9bf90 100644
--- a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs
+++ b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs
@@ -1,4 +1,5 @@
-using Bit.Core.Enums;
+using Bit.Core.Billing.Enums;
+using Bit.Core.Enums;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries;
diff --git a/test/Api.IntegrationTest/AdminConsole/Public/Controllers/MembersControllerTests.cs b/test/Api.IntegrationTest/AdminConsole/Public/Controllers/MembersControllerTests.cs
index cdb509984..a977899e2 100644
--- a/test/Api.IntegrationTest/AdminConsole/Public/Controllers/MembersControllerTests.cs
+++ b/test/Api.IntegrationTest/AdminConsole/Public/Controllers/MembersControllerTests.cs
@@ -6,6 +6,7 @@ using Bit.Api.IntegrationTest.Factories;
using Bit.Api.IntegrationTest.Helpers;
using Bit.Api.Models.Public.Response;
using Bit.Core.AdminConsole.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Repositories;
diff --git a/test/Api.IntegrationTest/Controllers/ConfigControllerTests.cs b/test/Api.IntegrationTest/Controllers/ConfigControllerTests.cs
index 32db96dd1..73fa3aba7 100644
--- a/test/Api.IntegrationTest/Controllers/ConfigControllerTests.cs
+++ b/test/Api.IntegrationTest/Controllers/ConfigControllerTests.cs
@@ -3,6 +3,7 @@ using Bit.Api.IntegrationTest.Factories;
using Bit.Api.IntegrationTest.Helpers;
using Bit.Api.Models.Response;
using Bit.Core.AdminConsole.Entities;
+using Bit.Core.Billing.Enums;
using Xunit;
namespace Bit.Api.IntegrationTest.Controllers;
@@ -77,7 +78,7 @@ public class ConfigControllerTests : IClassFixture, IAsyn
await _factory.LoginWithNewAccount(ownerEmail);
Organization org;
- (org, _) = await OrganizationTestHelpers.SignUpAsync(_factory, plan: Core.Enums.PlanType.Free, ownerEmail: ownerEmail,
+ (org, _) = await OrganizationTestHelpers.SignUpAsync(_factory, plan: PlanType.Free, ownerEmail: ownerEmail,
name: i.ToString(), billingEmail: ownerEmail, ownerKey: i.ToString());
await OrganizationTestHelpers.CreateUserAsync(_factory, org.Id, _email, Core.Enums.OrganizationUserType.User);
}
diff --git a/test/Api.IntegrationTest/Helpers/OrganizationTestHelpers.cs b/test/Api.IntegrationTest/Helpers/OrganizationTestHelpers.cs
index 1287fb4aa..3167edcd1 100644
--- a/test/Api.IntegrationTest/Helpers/OrganizationTestHelpers.cs
+++ b/test/Api.IntegrationTest/Helpers/OrganizationTestHelpers.cs
@@ -1,5 +1,6 @@
using Bit.Api.IntegrationTest.Factories;
using Bit.Core.AdminConsole.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Business;
diff --git a/test/Api.Test/AdminConsole/Controllers/OrganizationsControllerTests.cs b/test/Api.Test/AdminConsole/Controllers/OrganizationsControllerTests.cs
index c772104b3..c9a114fe7 100644
--- a/test/Api.Test/AdminConsole/Controllers/OrganizationsControllerTests.cs
+++ b/test/Api.Test/AdminConsole/Controllers/OrganizationsControllerTests.cs
@@ -13,6 +13,7 @@ using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Models.Data;
using Bit.Core.Auth.Repositories;
using Bit.Core.Auth.Services;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Services;
using Bit.Core.Context;
using Bit.Core.Entities;
diff --git a/test/Api.Test/Billing/Controllers/OrganizationSponsorshipsControllerTests.cs b/test/Api.Test/Billing/Controllers/OrganizationSponsorshipsControllerTests.cs
index 2f0dfa49d..377bc9c2c 100644
--- a/test/Api.Test/Billing/Controllers/OrganizationSponsorshipsControllerTests.cs
+++ b/test/Api.Test/Billing/Controllers/OrganizationSponsorshipsControllerTests.cs
@@ -1,6 +1,7 @@
using Bit.Api.Billing.Controllers;
using Bit.Api.Models.Request.Organizations;
using Bit.Core.AdminConsole.Entities;
+using Bit.Core.Billing.Enums;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;
@@ -21,11 +22,11 @@ namespace Bit.Api.Test.Billing.Controllers;
public class OrganizationSponsorshipsControllerTests
{
public static IEnumerable