using FastEndpoints; using AccountsBLL.Payment; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.Payment { public class GetSelectListPayment : BaseEndpoint> { private readonly IPaymentBLL _paymentBLL; public GetSelectListPayment(IPaymentBLL paymentBLL) { _paymentBLL = paymentBLL; } public override void Configure() { Post("/Payment/GetSelectListPayment"); AllowAnonymous(); } public record GetSelectListPaymentParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync( GetSelectListPaymentParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _paymentBLL.GetSelectListPayment( req.FirstNumber, req.MaxResult, req.CriteriaDTO, LoginDTO! ); return await GB5Shared.ResponseStandard.Response .CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response .CreateExceptionError( ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500 ); } } } }