using ComplianceDAL.DTO.AdapterConfig; using ComplianceDAL.DTO.GSTEInvoice; using ComplianceDAL.DTO.GSTReturn; namespace ComplianceBLL.Adapter; public interface IComplianceAdapter { // Auth — OTP request then exchange for auth token. GSTHeaderDTO bundles Username/GSTIN (and, for // the Returns family below, StateCode/AuthToken/Sek/EvcOTP) — matches GB4's GSTCafeServiceBLL, // which threads one GSTHeaderDTO through every GST Returns call instead of loose params. Task RequestOTPAsync(GSTHeaderDTO header, AdapterConfigDTO config, CancellationToken ct); Task GetAuthTokenAsync(string otp, GSTHeaderDTO header, AdapterConfigDTO config, CancellationToken ct); // E-Invoice Task GenerateEInvoiceAsync(string payloadJson, string gstin, string authToken, string sek, AdapterConfigDTO config, CancellationToken ct); Task CancelEInvoiceAsync(string irn, int cancelReasonType, string reason, string gstin, string authToken, string sek, AdapterConfigDTO config, CancellationToken ct); // E-Way Bill Task GenerateEWayBillAsync(string payloadJson, string gstin, string authToken, string sek, AdapterConfigDTO config, CancellationToken ct); Task CancelEWayBillAsync(string ewbNumber, int cancelReasonType, string reason, string gstin, string authToken, string sek, AdapterConfigDTO config, CancellationToken ct); Task UpdateVehicleAsync(string payloadJson, string gstin, string authToken, string sek, AdapterConfigDTO config, CancellationToken ct); // Matches GB4's GSTGovtSwitchFrameDAL.GenerateEWayFromIRN — a different GSP endpoint/response // shape from GenerateEWayBillAsync, used to generate an e-way bill directly off an already-generated IRN. Task GenerateEWayBillFromIRNAsync(string payloadJson, string gstin, string authToken, string sek, AdapterConfigDTO config, CancellationToken ct); // Returns — header.EvcOTP carries the file-step EVC OTP (a different concept from the OTP used to // obtain header.AuthToken/Sek above), matching GB4's GSTHeaderDTO.EvcOTP on FileGSTR1/FileGSTR3B. // header.ReturnPeriod carries GB4's LoginDTO.FP ("ret_period") — no separate returnPeriod param. Task SaveReturnAsync(string returnType, string payloadJson, GSTHeaderDTO header, AdapterConfigDTO config, CancellationToken ct); Task SubmitReturnAsync(string returnType, GSTHeaderDTO header, AdapterConfigDTO config, CancellationToken ct); Task FileReturnAsync(string returnType, GSTHeaderDTO header, AdapterConfigDTO config, CancellationToken ct); Task GetReturnStatusAsync(string referenceId, GSTHeaderDTO header, AdapterConfigDTO config, CancellationToken ct); // Inward fetch (2A/2B) Task FetchInwardDataAsync(string action, GSTHeaderDTO header, AdapterConfigDTO config, CancellationToken ct); } public class AdapterAuthResult { public bool IsSuccess { get; set; } public string AuthToken { get; set; } = string.Empty; public string Sek { get; set; } = string.Empty; // session encryption key // Raw (unencrypted) app-key generated by RequestOTPAsync — the caller must echo this back as // header.AppKey on the following GetAuthTokenAsync call (GSTN Authentication API spec: the // app-key is generated once per OTP request and reused to encrypt the OTP and decrypt the sek). public string AppKey { get; set; } = string.Empty; public string ErrorCode { get; set; } = string.Empty; public string ErrorMessage { get; set; } = string.Empty; public int HttpStatusCode { get; set; } public string RawResponse { get; set; } = string.Empty; } public class AdapterCallResult { public bool IsSuccess { get; set; } public string ReferenceId { get; set; } = string.Empty; public string StatusCode { get; set; } = string.Empty; // portal status_cd public string Body { get; set; } = string.Empty; public string ErrorCode { get; set; } = string.Empty; public string ErrorMessage { get; set; } = string.Empty; public int HttpStatusCode { get; set; } public string RawResponse { get; set; } = string.Empty; }