mirror of
https://github.com/bitwarden/server.git
synced 2024-11-26 12:55:17 +01:00
refactor
This commit is contained in:
parent
c367db0dbe
commit
90ecc6b79e
@ -21,8 +21,7 @@ public class OrganizationBillingController(
|
|||||||
IOrganizationRepository organizationRepository,
|
IOrganizationRepository organizationRepository,
|
||||||
IPaymentService paymentService,
|
IPaymentService paymentService,
|
||||||
ISubscriberService subscriberService,
|
ISubscriberService subscriberService,
|
||||||
IPaymentHistoryService paymentHistoryService,
|
IPaymentHistoryService paymentHistoryService) : BaseBillingController
|
||||||
ITaxService taxService) : BaseBillingController
|
|
||||||
{
|
{
|
||||||
[HttpGet("metadata")]
|
[HttpGet("metadata")]
|
||||||
public async Task<IResult> GetMetadataAsync([FromRoute] Guid organizationId)
|
public async Task<IResult> GetMetadataAsync([FromRoute] Guid organizationId)
|
||||||
@ -268,8 +267,6 @@ public class OrganizationBillingController(
|
|||||||
return Error.NotFound();
|
return Error.NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
requestBody.TaxIdType = taxService.GetStripeTaxCode(requestBody.Country, requestBody.TaxId);
|
|
||||||
|
|
||||||
var taxInformation = requestBody.ToDomain();
|
var taxInformation = requestBody.ToDomain();
|
||||||
|
|
||||||
await subscriberService.UpdateTaxInformation(organization, taxInformation);
|
await subscriberService.UpdateTaxInformation(organization, taxInformation);
|
||||||
|
@ -5,8 +5,8 @@ namespace Bit.Core.Billing.Models;
|
|||||||
public record TaxInformation(
|
public record TaxInformation(
|
||||||
string Country,
|
string Country,
|
||||||
string PostalCode,
|
string PostalCode,
|
||||||
string TaxId,
|
string? TaxId,
|
||||||
string TaxIdType,
|
string? TaxIdType,
|
||||||
string Line1,
|
string Line1,
|
||||||
string Line2,
|
string Line2,
|
||||||
string City,
|
string City,
|
||||||
|
@ -622,8 +622,8 @@ public class SubscriberService(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string taxIdType;
|
var taxIdType = taxInformation.TaxIdType;
|
||||||
if (string.IsNullOrWhiteSpace(taxInformation.TaxIdType))
|
if (string.IsNullOrWhiteSpace(taxIdType))
|
||||||
{
|
{
|
||||||
taxIdType = taxService.GetStripeTaxCode(taxInformation.Country,
|
taxIdType = taxService.GetStripeTaxCode(taxInformation.Country,
|
||||||
taxInformation.TaxId);
|
taxInformation.TaxId);
|
||||||
@ -636,10 +636,6 @@ public class SubscriberService(
|
|||||||
throw new Exceptions.BadRequestException("billingTaxIdTypeInferenceError");
|
throw new Exceptions.BadRequestException("billingTaxIdTypeInferenceError");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
taxIdType = taxInformation.TaxIdType;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user