chore(debug): TEMP de full-flow probe for Hyundai/Kia/Nissan licensing (revert after)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -148,6 +148,37 @@ export class PL24FordLegacyService {
|
||||
|
||||
this.logger.log(`Ford legacy: fetching sub-groups from ${linkPath}`);
|
||||
|
||||
// TEMP DE-PROBE: run the FULL de-account flow with de's OWN catalog codes
|
||||
// (de group.action → de vehicle.action → de drill) to definitively test
|
||||
// whether the de account 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 {
|
||||
const account = await this.resolveAccount(userId, serviceName);
|
||||
const html = await this.fetchP4Page(linkPath, serviceName, false, account);
|
||||
|
||||
Reference in New Issue
Block a user