forked from Yara724/api
inquiry refresh service + fanavaran client config
This commit is contained in:
98
src/core/config/fanavaran-client.config.ts
Normal file
98
src/core/config/fanavaran-client.config.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
export type FanavaranClientKey = "parsian" | "tejaratno";
|
||||
|
||||
export interface FanavaranAuthConfig {
|
||||
appName: string;
|
||||
secret: string;
|
||||
username: string;
|
||||
password: string;
|
||||
corpId: string;
|
||||
contractId: string;
|
||||
location: string;
|
||||
}
|
||||
|
||||
export interface FanavaranPayloadDefaults {
|
||||
AccidentCityId: number;
|
||||
AccidentReportTypeId: number;
|
||||
AccidentVehicleUsedId: number;
|
||||
ClaimExpertId: number;
|
||||
CompensationReferenceId: number;
|
||||
CulpritLicenceTypeId: number;
|
||||
CulpritTypeId: number;
|
||||
}
|
||||
|
||||
export interface FanavaranClientProfile {
|
||||
key: FanavaranClientKey;
|
||||
auth: FanavaranAuthConfig;
|
||||
defaults: FanavaranPayloadDefaults;
|
||||
}
|
||||
|
||||
const FANAVARAN_CLIENT_PROFILES: Record<
|
||||
FanavaranClientKey,
|
||||
FanavaranClientProfile
|
||||
> = {
|
||||
tejaratno: {
|
||||
key: "tejaratno",
|
||||
auth: {
|
||||
appName: "fanhab",
|
||||
secret: "5Fa@N#A2B",
|
||||
username: "fanhabUser",
|
||||
password: "Fan#@2U$3er",
|
||||
corpId: "3539",
|
||||
contractId: "263",
|
||||
location: "100",
|
||||
},
|
||||
defaults: {
|
||||
AccidentCityId: 701,
|
||||
AccidentReportTypeId: 155,
|
||||
AccidentVehicleUsedId: 1,
|
||||
ClaimExpertId: 1589,
|
||||
CompensationReferenceId: 167,
|
||||
CulpritLicenceTypeId: 2,
|
||||
CulpritTypeId: 337,
|
||||
},
|
||||
},
|
||||
parsian: {
|
||||
key: "parsian",
|
||||
auth: {
|
||||
appName: "ParsianService",
|
||||
secret: "P@r30@n$erv!ce",
|
||||
username: "ParsianServiceUser",
|
||||
password: "P@r30@n123",
|
||||
corpId: "543",
|
||||
contractId: "28",
|
||||
location: "210050",
|
||||
},
|
||||
defaults: {
|
||||
AccidentCityId: 701,
|
||||
AccidentReportTypeId: 155,
|
||||
AccidentVehicleUsedId: 1,
|
||||
ClaimExpertId: 154,
|
||||
CompensationReferenceId: 167,
|
||||
CulpritLicenceTypeId: 2,
|
||||
CulpritTypeId: 337,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/** Resolve active Fanavaran tenant from env (`FANAVARAN_CLIENT`) with optional CLIENT_ID fallback. */
|
||||
export function resolveFanavaranClientKey(): FanavaranClientKey {
|
||||
const explicit = process.env.FANAVARAN_CLIENT?.trim().toLowerCase();
|
||||
if (explicit === "parsian" || explicit === "tejaratno") {
|
||||
return explicit;
|
||||
}
|
||||
|
||||
// Optional deployment hint when FANAVARAN_CLIENT is not set.
|
||||
if (String(process.env.CLIENT_ID ?? "") === "8") {
|
||||
return "parsian";
|
||||
}
|
||||
|
||||
return "tejaratno";
|
||||
}
|
||||
|
||||
export function resolveFanavaranClientProfile(): FanavaranClientProfile {
|
||||
return FANAVARAN_CLIENT_PROFILES[resolveFanavaranClientKey()];
|
||||
}
|
||||
|
||||
export function fanavaranManualSubmitPath(claimCaseId: string): string {
|
||||
return `/v2/claim-request-management/fanavaran-submit/${claimCaseId}`;
|
||||
}
|
||||
Reference in New Issue
Block a user