forked from Yara724/api
car body policy and sales extended
This commit is contained in:
@@ -35,6 +35,11 @@ export interface FanavaranAuthConfig {
|
||||
password: string;
|
||||
corpId: string;
|
||||
contractId: string;
|
||||
/**
|
||||
* Vehicle-hull (بدنه) ContractId. Must not be the ثالث contract.
|
||||
* When unset, body lookups fall back to `contractId`.
|
||||
*/
|
||||
hullContractId?: string;
|
||||
location: string;
|
||||
}
|
||||
|
||||
@@ -209,6 +214,19 @@ export function getFanavaranClientProfile(
|
||||
);
|
||||
}
|
||||
|
||||
/** ثالث uses `contractId`. بدنه uses `hullContractId` when configured. */
|
||||
export function resolveFanavaranProductContractId(
|
||||
clientKey: FanavaranClientKey,
|
||||
product: "third-party" | "car-body",
|
||||
): string {
|
||||
const profile = getFanavaranClientProfile(clientKey);
|
||||
if (product === "car-body") {
|
||||
const hull = profile.auth.hullContractId?.trim();
|
||||
if (hull) return hull;
|
||||
}
|
||||
return profile.auth.contractId;
|
||||
}
|
||||
|
||||
export function listFanavaranClientProfiles(): FanavaranClientProfile[] {
|
||||
return FANAVARAN_CLIENT_KEYS.map((key) => getFanavaranClientProfile(key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user