2022-06-29 19:46:41 -04:00
|
|
|
|
using Bit.Api.Models.Response;
|
2020-12-04 12:05:16 -05:00
|
|
|
|
using Bit.Core.Repositories;
|
2020-08-11 14:19:56 -04:00
|
|
|
|
using Bit.Core.Utilities;
|
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Api.Controllers;
|
2022-08-29 16:06:55 -04:00
|
|
|
|
|
2020-08-11 14:19:56 -04:00
|
|
|
|
[Route("plans")]
|
|
|
|
|
|
[Authorize("Web")]
|
|
|
|
|
|
public class PlansController : Controller
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly ITaxRateRepository _taxRateRepository;
|
|
|
|
|
|
public PlansController(ITaxRateRepository taxRateRepository)
|
|
|
|
|
|
{
|
2020-12-04 12:05:16 -05:00
|
|
|
|
_taxRateRepository = taxRateRepository;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-11 14:19:56 -04:00
|
|
|
|
[HttpGet("")]
|
2022-07-08 17:40:36 +01:00
|
|
|
|
[AllowAnonymous]
|
2020-08-11 14:19:56 -04:00
|
|
|
|
public ListResponseModel<PlanResponseModel> Get()
|
|
|
|
|
|
{
|
|
|
|
|
|
var data = StaticStore.Plans;
|
|
|
|
|
|
var responses = data.Select(plan => new PlanResponseModel(plan));
|
|
|
|
|
|
return new ListResponseModel<PlanResponseModel>(responses);
|
|
|
|
|
|
}
|
2020-12-04 12:05:16 -05:00
|
|
|
|
|
|
|
|
|
|
[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);
|
2020-08-11 14:19:56 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|