using EntitlementBLL.Interfaces; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace EntitlementSL.Endpoints.Plan; // Pricing-page endpoint — resolves the caller's PartnerProductId from LoginDTO when // authenticated, or from the PartnerProductId query param (resolved tenant/domain) when // anonymous, and returns only that product's plan catalogue (mirrors Partner's own // brand-resolution chain, applied to commercial tiers instead of visual branding). public class GetPlanList : BaseEndpoint> { private readonly IPlanBLL _PlanBLL; public GetPlanList(IPlanBLL planBLL) => _PlanBLL = planBLL; public override void Configure() { Get("/lic/Plan.svc/GetList"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: QueryParam] int? PartnerProductId ); protected override string? GetCacheKey(Params req, LoginDTO loginDTO) => KeyGenerator.KeyGeneration(req.PartnerProductId ?? -1, EntityConstant.OBJECTENTITLEMENTPLAN, CacheKeyLevel.CLIENT_LEVEL, loginDTO); protected override async Task> ExecuteAsync(Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _PlanBLL.GetListForPartnerProductAsync(req.PartnerProductId, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponseEnumerable(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } }