diff --git a/src/Api/Billing/Controllers/StripeController.cs b/src/Api/Billing/Controllers/StripeController.cs
index a4a974bb9..f5e8253bf 100644
--- a/src/Api/Billing/Controllers/StripeController.cs
+++ b/src/Api/Billing/Controllers/StripeController.cs
@@ -1,4 +1,5 @@
-using Bit.Core.Services;
+using Bit.Core.Billing.Services;
+using Bit.Core.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;
@@ -46,4 +47,15 @@ public class StripeController(
return TypedResults.Ok(setupIntent.ClientSecret);
}
+
+ [HttpGet]
+ [Route("~/tax/is-country-supported")]
+ public IResult IsCountrySupported(
+ [FromQuery] string country,
+ [FromServices] ITaxService taxService)
+ {
+ var isSupported = taxService.IsSupported(country);
+
+ return TypedResults.Ok(isSupported);
+ }
}
diff --git a/src/Core/Billing/Services/ITaxService.cs b/src/Core/Billing/Services/ITaxService.cs
index f354efd04..722b1268e 100644
--- a/src/Core/Billing/Services/ITaxService.cs
+++ b/src/Core/Billing/Services/ITaxService.cs
@@ -1,10 +1,22 @@
-using Bit.Core.Billing.Models;
-
-namespace Bit.Core.Billing.Services;
+namespace Bit.Core.Billing.Services;
public interface ITaxService
{
+ ///
+ /// Retrieves the Stripe tax code for a given country and tax ID.
+ ///
+ ///
+ ///
+ ///
+ /// Returns the Stripe tax code if the tax ID is valid for the country.
+ /// Returns null if the tax ID is invalid or the country is not supported.
+ ///
string? GetStripeTaxCode(string country, string taxId);
- IEnumerable GetTaxIdTypes();
+ ///
+ /// Returns true or false whether charging or storing tax is supported for the given country.
+ ///
+ ///
+ ///
+ bool IsSupported(string country);
}
diff --git a/src/Core/Billing/Services/TaxService.cs b/src/Core/Billing/Services/TaxService.cs
index 5ff7bc3c6..08f9ef2d0 100644
--- a/src/Core/Billing/Services/TaxService.cs
+++ b/src/Core/Billing/Services/TaxService.cs
@@ -881,15 +881,6 @@ public class TaxService : ITaxService
}
];
- ///
- /// Retrieves the Stripe tax code for a given country and tax ID.
- ///
- ///
- ///
- ///
- /// Returns the Stripe tax code if the tax ID is valid for the country.
- /// Returns null if the tax ID is invalid or the country is not supported.
- ///
public string? GetStripeTaxCode(string country, string taxId)
{
foreach (var taxIdType in _taxIdTypes.Where(x => x.Country == country))
@@ -903,5 +894,8 @@ public class TaxService : ITaxService
return null;
}
- public IEnumerable GetTaxIdTypes() => _taxIdTypes;
+ public bool IsSupported(string country)
+ {
+ return _taxIdTypes.Any(x => x.Country == country);
+ }
}