1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 23:52:50 -05:00

[PM-3892] Implement dollar threshold for all subscriptions (#3283)

* Initial commit

* Fix the failing text

* Fix the unpaid invoice issue

* fix the unpaid invoice issue

* Changes for the threshold amount

* remove the billing threshold

* Add some comments to the old method

* Fixing issues on secret manager test

* import missing package

* Resolve pr comments

* Refactor PreviewUpcomingInvoiceAndPayAsync method

* Resolve some pr comments

* Resolving the comment around constant

* Resolve pr comment

* Add new class

* Resolve pr comments

* Change the prorateThreshold from 5 to 500 dollars

* Fix the failing test

* Fix the server returns a 500 error with the banner
This commit is contained in:
cyprain-okeke
2023-11-01 15:19:28 +01:00
committed by GitHub
parent f9fc43dbb1
commit d9faa9a6df
8 changed files with 692 additions and 56 deletions

View File

@ -0,0 +1,7 @@
namespace Bit.Core.Models.Business;
public class InvoicePreviewResult
{
public bool IsInvoicedNow { get; set; }
public string PaymentIntentClientSecret { get; set; }
}

View File

@ -0,0 +1,9 @@
using Stripe;
namespace Bit.Core.Models.Business;
public class PendingInoviceItems
{
public IEnumerable<InvoiceItem> PendingInvoiceItems { get; set; }
public IDictionary<string, InvoiceItem> PendingInvoiceItemsDict { get; set; }
}

View File

@ -44,7 +44,7 @@ public class SecretsManagerSubscribeUpdate : SubscriptionUpdate
{
updatedItems.Add(new SubscriptionItemOptions
{
Price = _plan.SecretsManager.StripeSeatPlanId,
Plan = _plan.SecretsManager.StripeSeatPlanId,
Quantity = _additionalSeats
});
}
@ -53,7 +53,7 @@ public class SecretsManagerSubscribeUpdate : SubscriptionUpdate
{
updatedItems.Add(new SubscriptionItemOptions
{
Price = _plan.SecretsManager.StripeServiceAccountPlanId,
Plan = _plan.SecretsManager.StripeServiceAccountPlanId,
Quantity = _additionalServiceAccounts
});
}
@ -63,14 +63,14 @@ public class SecretsManagerSubscribeUpdate : SubscriptionUpdate
{
updatedItems.Add(new SubscriptionItemOptions
{
Price = _plan.SecretsManager.StripeSeatPlanId,
Plan = _plan.SecretsManager.StripeSeatPlanId,
Quantity = _previousSeats,
Deleted = _previousSeats == 0 ? true : (bool?)null,
});
updatedItems.Add(new SubscriptionItemOptions
{
Price = _plan.SecretsManager.StripeServiceAccountPlanId,
Plan = _plan.SecretsManager.StripeServiceAccountPlanId,
Quantity = _previousServiceAccounts,
Deleted = _previousServiceAccounts == 0 ? true : (bool?)null,
});