mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 09:02:48 -05:00
started charging sales tax on seat/storage upgrades and auto renewals (#1034)
* started charging sales tax on seat/storage upgrades and auto renewals * Code review fixes for auto-renewing subscriptions charging sales tax
This commit is contained in:
@ -684,7 +684,7 @@ namespace Bit.Core.Services
|
||||
// Retain original collection method
|
||||
var collectionMethod = sub.CollectionMethod;
|
||||
|
||||
var subResponse = await subscriptionService.UpdateAsync(sub.Id, new SubscriptionUpdateOptions
|
||||
var subUpdateOptions = new SubscriptionUpdateOptions
|
||||
{
|
||||
Items = new List<SubscriptionItemOptions>
|
||||
{
|
||||
@ -700,7 +700,26 @@ namespace Bit.Core.Services
|
||||
DaysUntilDue = 1,
|
||||
CollectionMethod = "send_invoice",
|
||||
ProrationDate = prorationDate,
|
||||
});
|
||||
};
|
||||
|
||||
var customer = await new CustomerService().GetAsync(sub.CustomerId);
|
||||
var taxRates = await _taxRateRepository.GetByLocationAsync(
|
||||
new Bit.Core.Models.Table.TaxRate()
|
||||
{
|
||||
Country = customer.Address.Country,
|
||||
PostalCode = customer.Address.PostalCode
|
||||
}
|
||||
);
|
||||
var taxRate = taxRates.FirstOrDefault();
|
||||
if (taxRate != null && !sub.DefaultTaxRates.Any(x => x.Equals(taxRate.Id)))
|
||||
{
|
||||
subUpdateOptions.DefaultTaxRates = new List<string>(1)
|
||||
{
|
||||
taxRate.Id
|
||||
};
|
||||
}
|
||||
|
||||
var subResponse = await subscriptionService.UpdateAsync(sub.Id, subUpdateOptions);
|
||||
|
||||
string paymentIntentClientSecret = null;
|
||||
if (additionalStorage > 0)
|
||||
|
Reference in New Issue
Block a user