1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-06 05:28:15 -05:00
This commit is contained in:
Jonas Hendrickx 2025-03-05 15:03:20 +01:00
parent d0c5bb9278
commit 41b273e5d9
4 changed files with 10 additions and 7 deletions

View File

@ -2,6 +2,10 @@
public static class StripeConstants public static class StripeConstants
{ {
public static class Prices
{
public const string StoragePlanPersonal = "personal-storage-gb-annually";
}
public static class AutomaticTaxStatus public static class AutomaticTaxStatus
{ {
public const string Failed = "failed"; public const string Failed = "failed";

View File

@ -309,7 +309,7 @@ public class PremiumUserBillingService(
{ {
subscriptionItemOptionsList.Add(new SubscriptionItemOptions subscriptionItemOptionsList.Add(new SubscriptionItemOptions
{ {
Price = "storage-gb-annually", Price = StripeConstants.Prices.StoragePlanPersonal,
Quantity = storage Quantity = storage
}); });
} }

View File

@ -26,7 +26,6 @@ namespace Bit.Core.Services;
public class StripePaymentService : IPaymentService public class StripePaymentService : IPaymentService
{ {
private const string PremiumPlanId = "premium-annually"; private const string PremiumPlanId = "premium-annually";
private const string StoragePlanId = "personal-storage-gb-annually";
private const string ProviderDiscountId = "msp-discount-35"; private const string ProviderDiscountId = "msp-discount-35";
private const string SecretsManagerStandaloneDiscountId = "sm-standalone"; private const string SecretsManagerStandaloneDiscountId = "sm-standalone";
@ -578,7 +577,7 @@ public class StripePaymentService : IPaymentService
{ {
subCreateOptions.Items.Add(new SubscriptionItemOptions subCreateOptions.Items.Add(new SubscriptionItemOptions
{ {
Plan = StoragePlanId, Plan = StripeConstants.Prices.StoragePlanPersonal,
Quantity = additionalStorageGb Quantity = additionalStorageGb
}); });
} }
@ -1870,7 +1869,7 @@ public class StripePaymentService : IPaymentService
new() new()
{ {
Quantity = parameters.PasswordManager.AdditionalStorage, Quantity = parameters.PasswordManager.AdditionalStorage,
Plan = "storage-gb-annually" Plan = StripeConstants.Prices.StoragePlanPersonal
} }
] ]
}, },

View File

@ -11,6 +11,7 @@ using Bit.Core.AdminConsole.Services;
using Bit.Core.Auth.Enums; using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Models; using Bit.Core.Auth.Models;
using Bit.Core.Auth.Models.Business.Tokenables; using Bit.Core.Auth.Models.Business.Tokenables;
using Bit.Core.Billing.Constants;
using Bit.Core.Billing.Models; using Bit.Core.Billing.Models;
using Bit.Core.Billing.Models.Sales; using Bit.Core.Billing.Models.Sales;
using Bit.Core.Billing.Services; using Bit.Core.Billing.Services;
@ -45,7 +46,6 @@ namespace Bit.Core.Services;
public class UserService : UserManager<User>, IUserService, IDisposable public class UserService : UserManager<User>, IUserService, IDisposable
{ {
private const string PremiumPlanId = "premium-annually"; private const string PremiumPlanId = "premium-annually";
private const string StoragePlanId = "personal-storage-gb-annually";
private readonly IUserRepository _userRepository; private readonly IUserRepository _userRepository;
private readonly ICipherRepository _cipherRepository; private readonly ICipherRepository _cipherRepository;
@ -1106,12 +1106,12 @@ public class UserService : UserManager<User>, IUserService, IDisposable
} }
var secret = await BillingHelpers.AdjustStorageAsync(_paymentService, user, storageAdjustmentGb, var secret = await BillingHelpers.AdjustStorageAsync(_paymentService, user, storageAdjustmentGb,
StoragePlanId); StripeConstants.Prices.StoragePlanPersonal);
await _referenceEventService.RaiseEventAsync( await _referenceEventService.RaiseEventAsync(
new ReferenceEvent(ReferenceEventType.AdjustStorage, user, _currentContext) new ReferenceEvent(ReferenceEventType.AdjustStorage, user, _currentContext)
{ {
Storage = storageAdjustmentGb, Storage = storageAdjustmentGb,
PlanName = StoragePlanId, PlanName = StripeConstants.Prices.StoragePlanPersonal,
}); });
await SaveUserAsync(user); await SaveUserAsync(user);
return secret; return secret;