using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.PayProcess; using PayRollDAL.DTO.PayProcess; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.PayProcess { // GB4 route: Payprocess.svc/Pay/Process/For/Sepration/ (POST) — PayProcessForSepration(PayProcessPostDTO). // GB4 consistently misspells "Separation" as "Sepration" (interface/impl/BLL method/query // constants) — the route below preserves that exact spelling for GB4-facing traceability. // The GB5 BLL method is named PayProcessForSeparation (correct spelling) internally. public class PayProcessForSepration : BaseEndpoint> { private readonly IPayProcessBLL _PayProcessBLL; public PayProcessForSepration(IPayProcessBLL PayProcessBLL) { _PayProcessBLL = PayProcessBLL; } public override void Configure() { Post("/Pay/Process/For/Sepration/"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: FromBody] PayProcessPostDTO PayProcessPostDTO ); // Write endpoint — no GetCacheKey override; this computes and persists real // payroll numbers and must never be served from cache. protected override string? GetCacheKey(Params req, LoginDTO login) => null; protected override async Task> ExecuteAsync( Params req, LoginDTO loginDTO, CancellationToken ct) { try { var message = await _PayProcessBLL.PayProcessForSeparation(req.PayProcessPostDTO, loginDTO); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(message, CacheKeyLevel.NOT_REQUIRED, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, loginDTO, ex.Message, 500); } } } }