diff --git a/src/Api/Models/Response/SubscriptionResponseModel.cs b/src/Api/Models/Response/SubscriptionResponseModel.cs
index 3ec1b975e3..4c0ee9338b 100644
--- a/src/Api/Models/Response/SubscriptionResponseModel.cs
+++ b/src/Api/Models/Response/SubscriptionResponseModel.cs
@@ -1,4 +1,5 @@
using Bit.Core.Entities;
+using Bit.Core.Enums;
using Bit.Core.Models.Api;
using Bit.Core.Models.Business;
using Bit.Core.Utilities;
@@ -82,6 +83,8 @@ public class BillingSubscription
Interval = item.Interval;
Quantity = item.Quantity;
SponsoredSubscriptionItem = item.SponsoredSubscriptionItem;
+ AddonSubscriptionItem = item.AddonSubscriptionItem;
+ BitwardenProduct = item.BitwardenProduct;
}
public string Name { get; set; }
@@ -89,6 +92,8 @@ public class BillingSubscription
public int Quantity { get; set; }
public string Interval { get; set; }
public bool SponsoredSubscriptionItem { get; set; }
+ public bool AddonSubscriptionItem { get; set; }
+ public BitwardenProductType BitwardenProduct { get; set; }
}
}
diff --git a/src/Core/Models/Business/SubscriptionInfo.cs b/src/Core/Models/Business/SubscriptionInfo.cs
index 61aa060cd4..c72e291de0 100644
--- a/src/Core/Models/Business/SubscriptionInfo.cs
+++ b/src/Core/Models/Business/SubscriptionInfo.cs
@@ -1,4 +1,5 @@
-using Stripe;
+using Bit.Core.Enums;
+using Stripe;
namespace Bit.Core.Models.Business;
@@ -46,12 +47,20 @@ public class SubscriptionInfo
Name = item.Plan.Nickname;
Amount = item.Plan.Amount.GetValueOrDefault() / 100M;
Interval = item.Plan.Interval;
+ AddonSubscriptionItem =
+ Utilities.StaticStore.IsAddonSubscriptionItem(item.Plan.Id);
+ BitwardenProduct =
+ Utilities.StaticStore.GetPlanByStripeId(item.Plan.Id)?.BitwardenProduct ?? BitwardenProductType.PasswordManager;
}
Quantity = (int)item.Quantity;
SponsoredSubscriptionItem = Utilities.StaticStore.SponsoredPlans.Any(p => p.StripePlanId == item.Plan.Id);
}
+ public BitwardenProductType BitwardenProduct { get; set; }
+
+ public bool AddonSubscriptionItem { get; set; }
+
public string Name { get; set; }
public decimal Amount { get; set; }
public int Quantity { get; set; }
diff --git a/src/Core/Utilities/StaticStore.cs b/src/Core/Utilities/StaticStore.cs
index c5183296a9..ad11b2cfd0 100644
--- a/src/Core/Utilities/StaticStore.cs
+++ b/src/Core/Utilities/StaticStore.cs
@@ -139,4 +139,53 @@ public class StaticStore
public static SponsoredPlan GetSponsoredPlan(PlanSponsorshipType planSponsorshipType) =>
SponsoredPlans.FirstOrDefault(p => p.PlanSponsorshipType == planSponsorshipType);
+
+ ///
+ /// Determines if the stripe plan id is an addon item by checking if the provided stripe plan id
+ /// matches either the or
+ /// in any .
+ ///
+ ///
+ ///
+ /// True if the stripePlanId is a addon product, false otherwise
+ ///
+ public static bool IsAddonSubscriptionItem(string stripePlanId)
+ {
+ if (PasswordManagerPlans.Select(p => p.StripeStoragePlanId).Contains(stripePlanId))
+ {
+ return true;
+ }
+
+ if (SecretManagerPlans.Select(p => p.StripeServiceAccountPlanId).Contains(stripePlanId))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ ///
+ /// Get a by comparing the provided stripeId to the various
+ /// Stripe plan ids within a .
+ /// The following properties are checked:
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The plan if a matching stripeId was found, null otherwise
+ public static Plan GetPlanByStripeId(string stripeId)
+ {
+ return Plans.FirstOrDefault(p =>
+ p.StripePlanId == stripeId ||
+ p.StripeSeatPlanId == stripeId ||
+ p.StripeStoragePlanId == stripeId ||
+ p.StripeServiceAccountPlanId == stripeId ||
+ p.StripePremiumAccessPlanId == stripeId
+ );
+ }
}