mirror of
https://github.com/bitwarden/server.git
synced 2025-02-01 23:31:41 +01:00
Billing addr line1 fix, pr feedback
This commit is contained in:
parent
1552ff7b29
commit
b2cb9a2f69
@ -634,7 +634,6 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpPut("tax")]
|
||||
[HttpPost("tax")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task PutTaxInfo([FromBody]TaxInfoUpdateRequestModel model)
|
||||
{
|
||||
|
@ -484,7 +484,6 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpPut("{id}/tax")]
|
||||
[HttpPost("{id}/tax")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task PutTaxInfo(string id, [FromBody]OrganizationTaxInfoUpdateRequestModel model)
|
||||
{
|
||||
|
@ -4,7 +4,8 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class TaxInfoResponseModel
|
||||
{
|
||||
public TaxInfoResponseModel () { }
|
||||
public TaxInfoResponseModel() { }
|
||||
|
||||
public TaxInfoResponseModel(TaxInfo taxInfo)
|
||||
{
|
||||
if (taxInfo == null)
|
||||
|
@ -26,9 +26,13 @@
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(BillingAddressCountry) ||
|
||||
string.IsNullOrWhiteSpace(TaxIdNumber))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(_taxIdType))
|
||||
{
|
||||
return _taxIdType;
|
||||
}
|
||||
|
||||
switch (BillingAddressCountry)
|
||||
{
|
||||
@ -44,7 +48,9 @@
|
||||
case "CA":
|
||||
// May break for those in Québec given the assumption of QST
|
||||
if (BillingAddressState?.Contains("bec") ?? false)
|
||||
{
|
||||
_taxIdType = "ca_qst";
|
||||
}
|
||||
_taxIdType = "ca_bn";
|
||||
break;
|
||||
case "CL":
|
||||
|
@ -165,7 +165,7 @@ namespace Bit.Core.Services
|
||||
Country = taxInfo.BillingAddressCountry,
|
||||
PostalCode = taxInfo.BillingAddressPostalCode,
|
||||
// Line1 is required in Stripe's API, suggestion in Docs is to use Business Name intead.
|
||||
Line1 = taxInfo.BillingAddressLine1 ?? org.BusinessName,
|
||||
Line1 = taxInfo.BillingAddressLine1 ?? string.Empty,
|
||||
Line2 = taxInfo.BillingAddressLine2,
|
||||
City = taxInfo.BillingAddressCity,
|
||||
State = taxInfo.BillingAddressState,
|
||||
@ -1536,7 +1536,7 @@ namespace Bit.Core.Services
|
||||
|
||||
// Line1 is required, so if missing we're using the subscriber name
|
||||
// see: https://stripe.com/docs/api/customers/create#create_customer-address-line1
|
||||
if (address != null && address.Line1 == subscriber.BillingName())
|
||||
if (address != null && string.IsNullOrWhiteSpace(address.Line1))
|
||||
{
|
||||
address.Line1 = null;
|
||||
}
|
||||
@ -1565,7 +1565,7 @@ namespace Bit.Core.Services
|
||||
{
|
||||
Address = new AddressOptions
|
||||
{
|
||||
Line1 = taxInfo.BillingAddressLine1 ?? subscriber.BillingName(),
|
||||
Line1 = taxInfo.BillingAddressLine1 ?? string.Empty,
|
||||
Line2 = taxInfo.BillingAddressLine2,
|
||||
City = taxInfo.BillingAddressCity,
|
||||
State = taxInfo.BillingAddressState,
|
||||
|
Loading…
Reference in New Issue
Block a user