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:
28
src/Api/Billing/Controllers/PlansController.cs
Normal file
28
src/Api/Billing/Controllers/PlansController.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user