1
0
mirror of https://github.com/bitwarden/server synced 2025-12-14 23:33:41 +00:00

[PM-26793] Fetch premium plan from pricing service (#6450)

* Fetch premium plan from pricing service

* Run dotnet format
This commit is contained in:
Alex Morask
2025-10-22 14:13:16 -05:00
committed by GitHub
parent 0a7e6ae3ca
commit 6a3fc08957
17 changed files with 191 additions and 63 deletions

View File

@@ -0,0 +1,28 @@
using Bit.Api.Models.Response;
using Bit.Core.Billing.Pricing;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Api.Billing.Controllers;
[Route("plans")]
[Authorize("Web")]
public class PlansController(
IPricingClient pricingClient) : Controller
{
[HttpGet("")]
[AllowAnonymous]
public async Task<ListResponseModel<PlanResponseModel>> Get()
{
var plans = await pricingClient.ListPlans();
var responses = plans.Select(plan => new PlanResponseModel(plan));
return new ListResponseModel<PlanResponseModel>(responses);
}
[HttpGet("premium")]
public async Task<IResult> GetPremiumPlanAsync()
{
var premiumPlan = await pricingClient.GetAvailablePremiumPlan();
return TypedResults.Ok(premiumPlan);
}
}