chore(debug): TEMP move de-probe into fetchPartsByPath (hyundai drill path)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-05 16:29:04 +03:00
parent 5a5ab35e7c
commit a101fe81c2

View File

@@ -397,6 +397,36 @@ export class PL24FordLegacyService {
this.logger.log(`Ford legacy: fetching parts from ${linkPath}`); this.logger.log(`Ford legacy: fetching parts from ${linkPath}`);
// TEMP DE-PROBE: full de-account flow with de's OWN catalog codes to test
// whether de is licensed (non-demo) for Hyundai/Kia/Nissan parts.
if (["hyundai_parts", "kia_parts", "nissan_parts"].includes(serviceName)) {
try {
const cfg = getServiceConfig(serviceName);
const bp = cfg
? `${cfg.basePath}/${serviceName}`
: `/hyundai-kia-automotive-group/${serviceName}`;
await this.authService.authorizeServiceForAccount(serviceName, "de");
const gh = await this.fetchP4Page(`${this.baseUrl}${bp}/group.action?lang=tr`, serviceName, true, "de");
const ghDemo = !!gh && gh.includes("NOT_LOGGED_IN_DEMO");
const mu = gh ? this.extractModeUpdsFromHtml(gh) : { mode: "", upds: "" };
const vh = await this.fetchP4Page(`${this.baseUrl}${bp}/vehicle.action?lang=tr&startup=true&mode=${mu.mode}&upds=${mu.upds}`, serviceName, true, "de");
const vhDemo = !!vh && vh.includes("NOT_LOGGED_IN_DEMO");
const rows = vh ? this.parseHyundaiKiaCatalogRows(vh) : [];
this.logger.warn(`DE-FULL ${serviceName}: groupDemo=${ghDemo} vehDemo=${vhDemo} deRows=${rows.length} first=${JSON.stringify(rows[0])}`);
if (rows.length) {
const mu2 = this.extractModeUpdsFromHtml(vh as string);
const em = mu2.mode || mu.mode;
const eu = mu2.upds || mu.upds;
const du = `${this.baseUrl}${bp}/group.action?catalog=${encodeURIComponent(rows[0].id)}&lang=tr&localMarketOnly=true&mainGroup=EN&spec=e30%3D&startup=false&mode=${em}&upds=${eu}`;
const dh = await this.fetchP4Page(du, serviceName, true, "de");
const dDemo = !!dh && dh.includes("NOT_LOGGED_IN_DEMO");
this.logger.warn(`DE-FULL ${serviceName} drill cat=${rows[0].id}: demo=${dDemo} tcRows=${dh ? (dh.match(/tc-data-row/g) || []).length : 0} len=${dh?.length}`);
}
} catch (e) {
this.logger.warn(`DE-FULL ${serviceName} probe failed: ${(e as Error).message}`);
}
}
try { try {
const account = await this.resolveAccount(userId, serviceName); const account = await this.resolveAccount(userId, serviceName);
const isImageBoard = linkPath.includes("image-board.action"); const isImageBoard = linkPath.includes("image-board.action");