Files
meezi/src/Meezi.API/Controllers/CafePlatformController.cs
T
soroush.asadi 615d5348de
CI/CD / CI · API (dotnet build + test) (push) Successful in 42s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 30s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m10s
CI/CD / CI · Admin Web (tsc) (push) Successful in 38s
CI/CD / CI · Website (tsc) (push) Successful in 47s
CI/CD / CI · Koja (tsc) (push) Successful in 50s
CI/CD / Deploy · all services (push) Successful in 3m27s
fix(subscription): plan comparison + checkout read the live plan catalog
The merchant plan page hard-coded 4 tiers, prices and a feature matrix
that drifted from the admin-editable platform catalog (Starter tier
missing, stale prices/features). PlanComparison and CheckoutScreen now
consume /platform/plans + new /platform/features-catalog:

- columns = active plans by SortOrder (incl. Starter), names from
  DisplayNameFa/En, prices from MonthlyPriceToman
- limit rows from PlanLimitsData (int.MaxValue → "نامحدود")
- feature rows from the feature catalog, ticked via FeatureKeys
- checkout validates the ?plan= param against isBillableOnline and
  prices from the catalog — no more client-side price constants

fa/en/ar limit-row labels added.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 08:16:29 +03:30

49 lines
1.7 KiB
C#

using Microsoft.AspNetCore.Mvc;
using Meezi.Infrastructure.Services.Platform;
using Meezi.Core.Interfaces;
using Meezi.Shared;
namespace Meezi.API.Controllers;
[Route("api/cafes/{cafeId}/platform")]
public class CafePlatformController : CafeApiControllerBase
{
private readonly IPlatformCatalogService _catalog;
public CafePlatformController(IPlatformCatalogService catalog)
{
_catalog = catalog;
}
[HttpGet("features")]
public async Task<IActionResult> GetFeatures(string cafeId, ITenantContext tenant, CancellationToken cancellationToken)
{
if (EnsureCafeAccess(cafeId, tenant) is { } denied) return denied;
if (tenant.PlanTier is null)
return Ok(new ApiResponse<object>(true, new Dictionary<string, bool>()));
var features = await _catalog.GetEffectiveFeaturesForCafeAsync(
cafeId,
tenant.PlanTier.Value,
cancellationToken);
return Ok(new ApiResponse<object>(true, features));
}
[HttpGet("plans")]
public async Task<IActionResult> GetPublicPlans(CancellationToken cancellationToken)
{
var plans = await _catalog.GetPlansAsync(cancellationToken);
return Ok(new ApiResponse<object>(true, plans));
}
/// <summary>Feature catalog (key → display name / module group) so clients can
/// label the FeatureKeys returned by the plans endpoint.</summary>
[HttpGet("features-catalog")]
public async Task<IActionResult> GetFeaturesCatalog(CancellationToken cancellationToken)
{
var features = await _catalog.GetFeaturesAsync(cancellationToken);
return Ok(new ApiResponse<object>(true, features));
}
}