diff --git a/src/sand-hub/sand-hub.service.ts b/src/sand-hub/sand-hub.service.ts index fee0119..1bc6444 100644 --- a/src/sand-hub/sand-hub.service.ts +++ b/src/sand-hub/sand-hub.service.ts @@ -449,11 +449,16 @@ export class SandHubService { }; } - const data = raw?.data ?? {}; + // Real ESG response wraps payload in { success: true, data: { ... } }. + // Mock data and Tejarat-format fallback are flat objects with no .data wrapper — + // in that case use raw itself so CompanyName / CompanyCode are preserved. + const data = + raw?.data != null && typeof raw?.data === "object" ? raw.data : raw; return this.mapNewApiResponseToOldFormat({ ...data, - companyId: data.CmpCod ?? data.companyId, - companyPersianName: data.CmpNam ?? data.companyPersianName, + companyId: data.CmpCod ?? data.companyId ?? data.CompanyCode, + companyPersianName: + data.CmpNam ?? data.companyPersianName ?? data.CompanyName, carGrpCod: data.CarGrpCod ?? data.carGrpCod, usgCod: data.UsgCod ?? data.usgCod, vehSysCod: data.VehSysCod ?? data.vehSysCod,