1
0
mirror of https://github.com/bitwarden/server synced 2025-12-29 22:54:00 +00:00

remove hardcoded storage values (#6571)

This commit is contained in:
Kyle Denney
2025-11-17 11:16:02 -06:00
committed by GitHub
parent c620ec2aca
commit a9bb01031a
14 changed files with 85 additions and 23 deletions

View File

@@ -7,7 +7,7 @@ namespace Bit.Core.Utilities;
public static class BillingHelpers
{
internal static async Task<string> AdjustStorageAsync(IPaymentService paymentService, IStorableSubscriber storableSubscriber,
short storageAdjustmentGb, string storagePlanId)
short storageAdjustmentGb, string storagePlanId, short baseStorageGb)
{
if (storableSubscriber == null)
{
@@ -30,9 +30,9 @@ public static class BillingHelpers
}
var newStorageGb = (short)(storableSubscriber.MaxStorageGb.Value + storageAdjustmentGb);
if (newStorageGb < 1)
if (newStorageGb < baseStorageGb)
{
newStorageGb = 1;
newStorageGb = baseStorageGb;
}
if (newStorageGb > 100)
@@ -48,7 +48,7 @@ public static class BillingHelpers
"Delete some stored data first.");
}
var additionalStorage = newStorageGb - 1;
var additionalStorage = newStorageGb - baseStorageGb;
var paymentIntentClientSecret = await paymentService.AdjustStorageAsync(storableSubscriber,
additionalStorage, storagePlanId);
storableSubscriber.MaxStorageGb = newStorageGb;