From 0c8f587bf49a5de1b7b4d04f30c3715c9f55eea0 Mon Sep 17 00:00:00 2001 From: Jonas Hendrickx Date: Wed, 20 Nov 2024 13:50:45 +0100 Subject: [PATCH] refactor --- .../Billing/Controllers/OrganizationBillingController.cs | 2 -- src/Core/Billing/Models/TaxInformation.cs | 4 ++-- .../Billing/Services/Implementations/SubscriberService.cs | 8 ++------ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Api/Billing/Controllers/OrganizationBillingController.cs b/src/Api/Billing/Controllers/OrganizationBillingController.cs index 9459366e6..c179610bb 100644 --- a/src/Api/Billing/Controllers/OrganizationBillingController.cs +++ b/src/Api/Billing/Controllers/OrganizationBillingController.cs @@ -268,8 +268,6 @@ public class OrganizationBillingController( return Error.NotFound(); } - requestBody.TaxIdType = taxService.GetStripeTaxCode(requestBody.Country, requestBody.TaxId); - var taxInformation = requestBody.ToDomain(); await subscriberService.UpdateTaxInformation(organization, taxInformation); diff --git a/src/Core/Billing/Models/TaxInformation.cs b/src/Core/Billing/Models/TaxInformation.cs index 23ed3e5fa..205a08939 100644 --- a/src/Core/Billing/Models/TaxInformation.cs +++ b/src/Core/Billing/Models/TaxInformation.cs @@ -5,8 +5,8 @@ namespace Bit.Core.Billing.Models; public record TaxInformation( string Country, string PostalCode, - string TaxId, - string TaxIdType, + string? TaxId, + string? TaxIdType, string Line1, string Line2, string City, diff --git a/src/Core/Billing/Services/Implementations/SubscriberService.cs b/src/Core/Billing/Services/Implementations/SubscriberService.cs index ffa43d62d..8c23b5591 100644 --- a/src/Core/Billing/Services/Implementations/SubscriberService.cs +++ b/src/Core/Billing/Services/Implementations/SubscriberService.cs @@ -622,8 +622,8 @@ public class SubscriberService( return; } - string taxIdType; - if (string.IsNullOrWhiteSpace(taxInformation.TaxIdType)) + var taxIdType = taxInformation.TaxIdType; + if (string.IsNullOrWhiteSpace(taxIdType)) { taxIdType = taxService.GetStripeTaxCode(taxInformation.Country, taxInformation.TaxId); @@ -636,10 +636,6 @@ public class SubscriberService( throw new Exceptions.BadRequestException("billingTaxIdTypeInferenceError"); } } - else - { - taxIdType = taxInformation.TaxIdType; - } try {