From 6aed74d2419963cd85463a25c1bc3d5693c56988 Mon Sep 17 00:00:00 2001 From: Alex Morask <144709477+amorask-bitwarden@users.noreply.github.com> Date: Mon, 2 Oct 2023 09:42:50 -0400 Subject: [PATCH] Hide additional tax inputs when country doesn't support Stripe Tax [AC-1665] (#6363) * Revert "Removed countries that Stripe doesn't support (#6035)" This reverts commit a81c70360a2ede456afb60258775c133b228a4bd. * Hide additional tax options when selected country doesn't support Stripe tax * Conner's feedback --- .../billing/settings/tax-info.component.html | 190 +++++++++++++++++- .../billing/settings/tax-info.component.ts | 84 +++++++- 2 files changed, 269 insertions(+), 5 deletions(-) diff --git a/apps/web/src/app/billing/settings/tax-info.component.html b/apps/web/src/app/billing/settings/tax-info.component.html index cbeac4c3dd..caf92f4189 100644 --- a/apps/web/src/app/billing/settings/tax-info.component.html +++ b/apps/web/src/app/billing/settings/tax-info.component.html @@ -21,72 +21,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -104,7 +279,10 @@ /> -
+
-
+
@@ -125,7 +306,10 @@
-
+
diff --git a/apps/web/src/app/billing/settings/tax-info.component.ts b/apps/web/src/app/billing/settings/tax-info.component.ts index af47a6821e..a7ceea0b2d 100644 --- a/apps/web/src/app/billing/settings/tax-info.component.ts +++ b/apps/web/src/app/billing/settings/tax-info.component.ts @@ -73,7 +73,7 @@ export class TaxInfoComponent { this.taxInfo.postalCode = taxInfo.postalCode; this.taxInfo.country = taxInfo.country || "US"; this.taxInfo.includeTaxId = - this.taxInfo.country !== "US" && + this.countrySupportsTax(this.taxInfo.country) && (!!taxInfo.taxId || !!taxInfo.line1 || !!taxInfo.line2 || @@ -166,7 +166,7 @@ export class TaxInfoComponent { } changeCountry() { - if (this.taxInfo.country === "US") { + if (!this.countrySupportsTax(this.taxInfo.country)) { this.taxInfo.includeTaxId = false; this.taxInfo.taxId = null; this.taxInfo.line1 = null; @@ -177,6 +177,10 @@ export class TaxInfoComponent { this.onCountryChanged.emit(); } + countrySupportsTax(countryCode: string) { + return this.taxSupportedCountryCodes.includes(countryCode); + } + private hasChanged(): boolean { for (const key in this.taxInfo) { // eslint-disable-next-line @@ -186,4 +190,80 @@ export class TaxInfoComponent { } return false; } + + private taxSupportedCountryCodes: string[] = [ + "CN", + "FR", + "DE", + "CA", + "GB", + "AU", + "IN", + "AD", + "AR", + "AT", + "BE", + "BO", + "BR", + "BG", + "CL", + "CO", + "CR", + "HR", + "CY", + "CZ", + "DK", + "DO", + "EC", + "EG", + "SV", + "EE", + "FI", + "GE", + "GR", + "HK", + "HU", + "IS", + "ID", + "IQ", + "IE", + "IL", + "IT", + "JP", + "KE", + "KR", + "LV", + "LI", + "LT", + "LU", + "MY", + "MT", + "MX", + "NL", + "NZ", + "NO", + "PE", + "PH", + "PL", + "PT", + "RO", + "RU", + "SA", + "RS", + "SG", + "SK", + "SI", + "ZA", + "ES", + "SE", + "CH", + "TW", + "TH", + "TR", + "UA", + "AE", + "UY", + "VE", + "VN", + ]; }