mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
Cannot divide by zero if total amount excluding tax is zero.
This commit is contained in:
parent
55595e3ae4
commit
0e7414ccbe
@ -1251,7 +1251,7 @@ public class StripePaymentService : IPaymentService
|
||||
{
|
||||
var invoice = await _stripeAdapter.InvoiceCreatePreviewAsync(options);
|
||||
|
||||
var effectiveTaxRate = invoice.Tax != null && invoice.TotalExcludingTax != null
|
||||
var effectiveTaxRate = invoice.Tax != null && invoice.TotalExcludingTax != null && invoice.TotalExcludingTax.Value != 0
|
||||
? invoice.Tax.Value.ToMajor() / invoice.TotalExcludingTax.Value.ToMajor()
|
||||
: 0M;
|
||||
|
||||
@ -1409,7 +1409,7 @@ public class StripePaymentService : IPaymentService
|
||||
{
|
||||
var invoice = await _stripeAdapter.InvoiceCreatePreviewAsync(options);
|
||||
|
||||
var effectiveTaxRate = invoice.Tax != null && invoice.TotalExcludingTax != null
|
||||
var effectiveTaxRate = invoice.Tax != null && invoice.TotalExcludingTax != null && invoice.TotalExcludingTax.Value != 0
|
||||
? invoice.Tax.Value.ToMajor() / invoice.TotalExcludingTax.Value.ToMajor()
|
||||
: 0M;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user