using ComplianceBLL.GSTOutward; using ComplianceDAL.DTO.GSTOutward; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace ComplianceSL.Endpoints.GSTOutward; public class FileGSTReturn : BaseEndpoint> { private readonly IGSTOutwardBLL _bll; public FileGSTReturn(IGSTOutwardBLL bll) => _bll = bll; public override void Configure() { Post("/GSTOutward/FileGSTReturn"); AllowAnonymous(); } public record FileGSTReturnParameters( [property: FromHeader] string Login, [property: FromHeader] string? GSTHeader, [property: FromBody] FileGSTReturnRequestDTO Request ); protected override string? GetCacheKey(FileGSTReturnParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync(FileGSTReturnParameters req, LoginDTO login, CancellationToken ct) { try { var header = GSTHeaderParser.Parse(req.GSTHeader); var result = await _bll.FileGSTReturnAsync(req.Request, header, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.CLIENT_LEVEL, login, ex.Message, 500); } } }