car body policy and sales extended

This commit is contained in:
2026-09-05 18:37:42 +03:30
parent eb072ef080
commit eb636bdbdd
10 changed files with 1097 additions and 14 deletions

View File

@@ -78,9 +78,13 @@ export class FanavaranLookupService {
async fetchFromFanavaran(
clientKey: FanavaranClientKey,
url: string,
options?: { contractIdOverride?: string },
): Promise<unknown> {
try {
const headers = await this.fanavaranAuthService.getRequestHeaders(clientKey);
const headers = await this.fanavaranAuthService.getRequestHeaders(
clientKey,
{ contractIdOverride: options?.contractIdOverride },
);
this.logger.log(
`[${clientKey}] Calling Fanavaran lookup API: ${url}`,
@@ -236,46 +240,52 @@ export class FanavaranLookupService {
async inquiryByVin(
clientKey: FanavaranClientKey,
vin: string,
options?: { contractIdOverride?: string },
): Promise<unknown> {
const url = `${FANAVARAN_LOOKUP_BASE_URL}/car/vehicles/inquiry-by-vin?vin=${encodeURIComponent(vin)}`;
return this.fetchFromFanavaran(clientKey, url);
return this.fetchFromFanavaran(clientKey, url, options);
}
async myPolicies(
clientKey: FanavaranClientKey,
nationalCode: string,
insuranceLineId: number = 5,
options?: { contractIdOverride?: string },
): Promise<unknown> {
const url =
`${FANAVARAN_LOOKUP_BASE_URL}/common/Policies/inquiry-my-policies` +
`?InsuranceLineId=${insuranceLineId}` +
`&NationalCode=${encodeURIComponent(nationalCode)}`;
return this.fetchFromFanavaran(clientKey, url);
return this.fetchFromFanavaran(clientKey, url, options);
}
async thirdPartyPolicyById(
clientKey: FanavaranClientKey,
policyId: number,
options?: { contractIdOverride?: string },
): Promise<unknown> {
const url = `${FANAVARAN_LOOKUP_BASE_URL}/car/third-party-car-policies/${policyId}`;
return this.fetchFromFanavaran(clientKey, url);
return this.fetchFromFanavaran(clientKey, url, options);
}
async bodyPolicyById(
clientKey: FanavaranClientKey,
policyId: number,
options?: { contractIdOverride?: string },
): Promise<unknown> {
const url = `${FANAVARAN_LOOKUP_BASE_URL}/car/vehicle-hull-policies/${policyId}`;
return this.fetchFromFanavaran(clientKey, url);
return this.fetchFromFanavaran(clientKey, url, options);
}
async vehicleById(
clientKey: FanavaranClientKey,
vehicleId: number,
versionNo: number = 1,
versionNo?: number,
options?: { contractIdOverride?: string },
): Promise<unknown> {
const url = `${FANAVARAN_LOOKUP_BASE_URL}/car/vehicles/${vehicleId}?versionno=${versionNo}`;
return this.fetchFromFanavaran(clientKey, url);
const query = versionNo == null ? "" : `?versionno=${versionNo}`;
const url = `${FANAVARAN_LOOKUP_BASE_URL}/car/vehicles/${vehicleId}${query}`;
return this.fetchFromFanavaran(clientKey, url, options);
}
async customerById(