1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-06 05:28:15 -05:00
bitwarden/src/Core/Billing/Extensions/CustomerExtensions.cs
Alex Morask 622ef902ed
[PM-18578] Don't enable automatic tax for non-taxable non-US businesses during invoice.upcoming (#5443)
* Only enable automatic tax for US subscriptions or EU subscriptions that are taxable.

* Run dotnet format
2025-02-25 13:36:12 -05:00

26 lines
715 B
C#

using Bit.Core.Billing.Constants;
using Stripe;
namespace Bit.Core.Billing.Extensions;
public static class CustomerExtensions
{
public static bool HasBillingLocation(this Customer customer)
=> customer is
{
Address:
{
Country: not null and not "",
PostalCode: not null and not ""
}
};
/// <summary>
/// Determines if a Stripe customer supports automatic tax
/// </summary>
/// <param name="customer"></param>
/// <returns></returns>
public static bool HasTaxLocationVerified(this Customer customer) =>
customer?.Tax?.AutomaticTax == StripeConstants.AutomaticTaxStatus.Supported;
}