mirror of
https://github.com/bitwarden/server
synced 2026-01-03 00:53:37 +00:00
[PM-16684] Integrate Pricing Service behind FF (#5276)
* Remove gRPC and convert PricingClient to HttpClient wrapper * Add PlanType.GetProductTier extension Many instances of StaticStore use are just to get the ProductTierType of a PlanType, but this can be derived from the PlanType itself without having to fetch the entire plan. * Remove invocations of the StaticStore in non-Test code * Deprecate StaticStore entry points * Run dotnet format * Matt's feedback * Run dotnet format * Rui's feedback * Run dotnet format * Replacements since approval * Run dotnet format
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Immutable;
|
||||
using Bit.Core.Billing.Enums;
|
||||
using Bit.Core.Billing.Extensions;
|
||||
using Bit.Core.Billing.Models.StaticStore.Plans;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
|
||||
@@ -137,6 +138,7 @@ public static class StaticStore
|
||||
}
|
||||
|
||||
public static IDictionary<GlobalEquivalentDomainsType, IEnumerable<string>> GlobalDomains { get; set; }
|
||||
[Obsolete("Use PricingClient.ListPlans to retrieve all plans.")]
|
||||
public static IEnumerable<Plan> Plans { get; }
|
||||
public static IEnumerable<SponsoredPlan> SponsoredPlans { get; set; } = new[]
|
||||
{
|
||||
@@ -147,10 +149,11 @@ public static class StaticStore
|
||||
SponsoringProductTierType = ProductTierType.Enterprise,
|
||||
StripePlanId = "2021-family-for-enterprise-annually",
|
||||
UsersCanSponsor = (OrganizationUserOrganizationDetails org) =>
|
||||
GetPlan(org.PlanType).ProductTier == ProductTierType.Enterprise,
|
||||
org.PlanType.GetProductTier() == ProductTierType.Enterprise,
|
||||
}
|
||||
};
|
||||
|
||||
[Obsolete("Use PricingClient.GetPlan to retrieve a plan.")]
|
||||
public static Plan GetPlan(PlanType planType) => Plans.SingleOrDefault(p => p.Type == planType);
|
||||
|
||||
public static SponsoredPlan GetSponsoredPlan(PlanSponsorshipType planSponsorshipType) =>
|
||||
@@ -167,6 +170,7 @@ public static class StaticStore
|
||||
/// </returns>
|
||||
public static bool IsAddonSubscriptionItem(string stripePlanId)
|
||||
{
|
||||
// TODO: PRICING -> https://bitwarden.atlassian.net/browse/PM-16844
|
||||
return Plans.Any(p =>
|
||||
p.PasswordManager.StripeStoragePlanId == stripePlanId ||
|
||||
(p.SecretsManager?.StripeServiceAccountPlanId == stripePlanId));
|
||||
|
||||
Reference in New Issue
Block a user