mirror of
https://github.com/bitwarden/server.git
synced 2025-07-18 16:11:28 -05:00
[AC-1486] Feature: SM Billing (#3073)
* [AC-1423] Add AddonProduct and BitwardenProduct properties to BillingSubscriptionItem (#3037) * [AC-1423] Add AddonProduct and BitwardenProduct properties to BillingSubscriptionItem * [AC-1423] Add helper to StaticStore.cs to find a Plan by StripePlanId * [AC-1423] Use the helper method to set SubscriptionInfo.BitwardenProduct * Add SecretsManagerBilling feature flag to Constants * [AC 1409] Secrets Manager Subscription Stripe Integration (#3019) * [AC-1418] Add missing SecretsManagerPlan property to OrganizationResponseModel (#3055) * [AC 1460] Update Stripe Configuration (#3070) * [AC 1410] Secrets Manager subscription adjustment back-end changes (#3036) * Create UpgradeSecretsManagerSubscription command * [AC-1495] Extract UpgradePlanAsync into a command (#3081) * This is a pure lift & shift with no refactors * [AC-1503] Fix Stripe integration on organization upgrade (#3084) * Fix SM parameters not being passed to Stripe * [AC-1504] Allow SM max autoscale limits to be disabled (#3085) * [AC-1488] Changed SM Signup and Upgrade paths to set SmServiceAccounts to include the plan BaseServiceAccount (#3086) * [AC-1510] Enable access to Secrets Manager to Organization owner for new Subscription (#3089) * Revert changes to ReferenceEvent code (#3091) This will be done in AC-1481 * Add UsePasswordManager to sync data (#3114) * [AC-1522] Fix service account check on upgrading (#3111) * [AC-1521] Address checkmarx security feedback (#3124) * Reinstate target attribute but add noopener noreferrer * Update date on migration script --------- Co-authored-by: Shane Melton <smelton@bitwarden.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: cyprain-okeke <cokeke@bitwarden.com> Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com> Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com> Co-authored-by: Rui Tome <rtome@bitwarden.com>
This commit is contained in:
@ -39,12 +39,13 @@ public static class SecretsManagerPlanStore
|
||||
HasCustomPermissions = true,
|
||||
UpgradeSortOrder = 3,
|
||||
DisplaySortOrder = 3,
|
||||
StripeSeatPlanId = "sm-enterprise-seat-monthly",
|
||||
StripeServiceAccountPlanId = "service-account-monthly",
|
||||
StripeSeatPlanId = "secrets-manager-enterprise-seat-monthly",
|
||||
StripeServiceAccountPlanId = "secrets-manager-service-account-monthly",
|
||||
BasePrice = 0,
|
||||
SeatPrice = 13,
|
||||
AdditionalPricePerServiceAccount = 0.5M,
|
||||
AllowSeatAutoscale = true,
|
||||
AllowServiceAccountsAutoscale = true
|
||||
},
|
||||
new Plan
|
||||
{
|
||||
@ -77,12 +78,13 @@ public static class SecretsManagerPlanStore
|
||||
HasCustomPermissions = true,
|
||||
UpgradeSortOrder = 3,
|
||||
DisplaySortOrder = 3,
|
||||
StripeSeatPlanId = "sm-enterprise-seat-annually",
|
||||
StripeServiceAccountPlanId = "service-account-annually",
|
||||
StripeSeatPlanId = "secrets-manager-enterprise-seat-annually",
|
||||
StripeServiceAccountPlanId = "secrets-manager-service-account-annually",
|
||||
BasePrice = 0,
|
||||
SeatPrice = 144,
|
||||
AdditionalPricePerServiceAccount = 6,
|
||||
AllowSeatAutoscale = true,
|
||||
AllowServiceAccountsAutoscale = true
|
||||
},
|
||||
new Plan
|
||||
{
|
||||
@ -107,12 +109,13 @@ public static class SecretsManagerPlanStore
|
||||
UsersGetPremium = true,
|
||||
UpgradeSortOrder = 2,
|
||||
DisplaySortOrder = 2,
|
||||
StripeSeatPlanId = "sm-teams-seat-monthly",
|
||||
StripeServiceAccountPlanId = "service-account-monthly",
|
||||
StripeSeatPlanId = "secrets-manager-teams-seat-monthly",
|
||||
StripeServiceAccountPlanId = "secrets-manager-service-account-monthly",
|
||||
BasePrice = 0,
|
||||
SeatPrice = 7,
|
||||
AdditionalPricePerServiceAccount = 0.5M,
|
||||
AllowSeatAutoscale = true,
|
||||
AllowServiceAccountsAutoscale = true
|
||||
},
|
||||
new Plan
|
||||
{
|
||||
@ -139,12 +142,13 @@ public static class SecretsManagerPlanStore
|
||||
|
||||
UpgradeSortOrder = 2,
|
||||
DisplaySortOrder = 2,
|
||||
StripeSeatPlanId = "sm-teams-seat-annually",
|
||||
StripeServiceAccountPlanId = "service-account-annually",
|
||||
StripeSeatPlanId = "secrets-manager-teams-seat-annually",
|
||||
StripeServiceAccountPlanId = "secrets-manager-service-account-annually",
|
||||
BasePrice = 0,
|
||||
SeatPrice = 72,
|
||||
AdditionalPricePerServiceAccount = 6,
|
||||
AllowSeatAutoscale = true,
|
||||
AllowServiceAccountsAutoscale = true
|
||||
},
|
||||
new Plan
|
||||
{
|
||||
@ -158,7 +162,7 @@ public static class SecretsManagerPlanStore
|
||||
BaseServiceAccount = 3,
|
||||
MaxProjects = 3,
|
||||
MaxUsers = 2,
|
||||
MaxServiceAccount = 3,
|
||||
MaxServiceAccounts = 3,
|
||||
UpgradeSortOrder = -1, // Always the lowest plan, cannot be upgraded to
|
||||
DisplaySortOrder = -1,
|
||||
AllowSeatAutoscale = false,
|
||||
|
@ -139,4 +139,53 @@ public class StaticStore
|
||||
|
||||
public static SponsoredPlan GetSponsoredPlan(PlanSponsorshipType planSponsorshipType) =>
|
||||
SponsoredPlans.FirstOrDefault(p => p.PlanSponsorshipType == planSponsorshipType);
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the stripe plan id is an addon item by checking if the provided stripe plan id
|
||||
/// matches either the <see cref="Plan.StripeStoragePlanId"/> or <see cref="Plan.StripeServiceAccountPlanId"/>
|
||||
/// in any <see cref="Plans"/>.
|
||||
/// </summary>
|
||||
/// <param name="stripePlanId"></param>
|
||||
/// <returns>
|
||||
/// True if the stripePlanId is a addon product, false otherwise
|
||||
/// </returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="Plan"/> by comparing the provided stripeId to the various
|
||||
/// Stripe plan ids within a <see cref="Plan"/>.
|
||||
/// The following <see cref="Plan"/> properties are checked:
|
||||
/// <list type="bullet">
|
||||
/// <item><see cref="Plan.StripePlanId"/></item>
|
||||
/// <item><see cref="Plan.StripeSeatPlanId"/></item>
|
||||
/// <item><see cref="Plan.StripeStoragePlanId"/></item>
|
||||
/// <item><see cref="Plan.StripeServiceAccountPlanId"/></item>
|
||||
/// <item><see cref="Plan.StripePremiumAccessPlanId"/></item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="stripeId"></param>
|
||||
/// <returns>The plan if a matching stripeId was found, null otherwise</returns>
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user