1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 09:32:48 -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

@ -1,4 +1,5 @@
using Bit.Core.Models.BitStripe;
using Stripe;
namespace Bit.Core.Services;
@ -16,6 +17,7 @@ public class StripeAdapter : IStripeAdapter
private readonly Stripe.BankAccountService _bankAccountService;
private readonly Stripe.PriceService _priceService;
private readonly Stripe.TestHelpers.TestClockService _testClockService;
private readonly Stripe.InvoiceItemService _invoiceItemService;
public StripeAdapter()
{
@ -31,6 +33,7 @@ public class StripeAdapter : IStripeAdapter
_bankAccountService = new Stripe.BankAccountService();
_priceService = new Stripe.PriceService();
_testClockService = new Stripe.TestHelpers.TestClockService();
_invoiceItemService = new Stripe.InvoiceItemService();
}
public Task<Stripe.Customer> CustomerCreateAsync(Stripe.CustomerCreateOptions options)
@ -79,6 +82,16 @@ public class StripeAdapter : IStripeAdapter
return _invoiceService.UpcomingAsync(options);
}
public Task<Stripe.Invoice> InvoiceCreateAsync(Stripe.InvoiceCreateOptions options)
{
return _invoiceService.CreateAsync(options);
}
public Task<Stripe.InvoiceItem> InvoiceItemCreateAsync(Stripe.InvoiceItemCreateOptions options)
{
return _invoiceItemService.CreateAsync(options);
}
public Task<Stripe.Invoice> InvoiceGetAsync(string id, Stripe.InvoiceGetOptions options)
{
return _invoiceService.GetAsync(id, options);
@ -89,6 +102,11 @@ public class StripeAdapter : IStripeAdapter
return _invoiceService.ListAsync(options);
}
public IEnumerable<InvoiceItem> InvoiceItemListAsync(InvoiceItemListOptions options)
{
return _invoiceItemService.ListAutoPaging(options);
}
public Task<Stripe.Invoice> InvoiceUpdateAsync(string id, Stripe.InvoiceUpdateOptions options)
{
return _invoiceService.UpdateAsync(id, options);