mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
Implemented tax collection for subscriptions (#1017)
* Implemented tax collection for subscriptions * Cleanup for Sales Tax * Cleanup for Sales Tax * Changes a constraint to an index for checking purposes * Added and implemented a ReadById method for TaxRate * Code review fixes for Tax Rate implementation * Code review fixes for Tax Rate implementation * Made the SalesTax migration script rerunnable
This commit is contained in:
@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Models.Api;
|
||||
using System.Linq;
|
||||
using Bit.Core.Repositories;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
@ -10,6 +12,12 @@ namespace Bit.Api.Controllers
|
||||
[Authorize("Web")]
|
||||
public class PlansController : Controller
|
||||
{
|
||||
private readonly ITaxRateRepository _taxRateRepository;
|
||||
public PlansController(ITaxRateRepository taxRateRepository)
|
||||
{
|
||||
_taxRateRepository = taxRateRepository;
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
public ListResponseModel<PlanResponseModel> Get()
|
||||
{
|
||||
@ -17,5 +25,13 @@ namespace Bit.Api.Controllers
|
||||
var responses = data.Select(plan => new PlanResponseModel(plan));
|
||||
return new ListResponseModel<PlanResponseModel>(responses);
|
||||
}
|
||||
|
||||
[HttpGet("sales-tax-rates")]
|
||||
public async Task<ListResponseModel<TaxRateResponseModel>> GetTaxRates()
|
||||
{
|
||||
var data = await _taxRateRepository.GetAllActiveAsync();
|
||||
var responses = data.Select(x => new TaxRateResponseModel(x));
|
||||
return new ListResponseModel<TaxRateResponseModel>(responses);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user