Browse Source

changed the address data used to pull sales tax for premium subscriptions (#1109)

* changed the address data used to pull sales tax for premium subscriptions

* nulled checked for extra safety

* fixes null check
pull/1111/head
Addison Beck 5 years ago committed by GitHub
parent
commit
bc4eeff604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      src/Core/Services/Implementations/StripePaymentService.cs

28
src/Core/Services/Implementations/StripePaymentService.cs

@ -444,20 +444,24 @@ namespace Bit.Core.Services @@ -444,20 +444,24 @@ namespace Bit.Core.Services
Quantity = 1,
});
var taxRates = await _taxRateRepository.GetByLocationAsync(
new Bit.Core.Models.Table.TaxRate()
if (!string.IsNullOrWhiteSpace(taxInfo?.BillingAddressCountry)
&& !string.IsNullOrWhiteSpace(taxInfo?.BillingAddressPostalCode))
{
var taxRates = await _taxRateRepository.GetByLocationAsync(
new Bit.Core.Models.Table.TaxRate()
{
Country = taxInfo.BillingAddressCountry,
PostalCode = taxInfo.BillingAddressPostalCode
}
);
var taxRate = taxRates.FirstOrDefault();
if (taxRate != null)
{
Country = customer.Address.Country,
PostalCode = customer.Address.PostalCode
subCreateOptions.DefaultTaxRates = new List<string>(1)
{
taxRate.Id
};
}
);
var taxRate = taxRates.FirstOrDefault();
if (taxRate != null)
{
subCreateOptions.DefaultTaxRates = new List<string>(1)
{
taxRate.Id
};
}
if (additionalStorageGb > 0)

Loading…
Cancel
Save