34 lines
937 B
TypeScript
34 lines
937 B
TypeScript
import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types';
|
|
|
|
export async function getKPData({ quote }: GetQuoteInputData): Promise<GetQuoteProcessData> {
|
|
const elt: NonNullable<GetQuoteProcessData['elt']> = { kasko: undefined, osago: undefined };
|
|
|
|
if (
|
|
quote?.evo_kasko_accountid &&
|
|
quote?.evo_id_elt_kasko &&
|
|
quote?.evo_id_kasko_calc &&
|
|
quote?.evo_kasko_price &&
|
|
quote?.evo_franchise !== null
|
|
) {
|
|
elt.kasko = {
|
|
key: quote?.evo_kasko_accountid,
|
|
requestId: quote?.evo_id_elt_kasko,
|
|
skCalcId: quote?.evo_id_kasko_calc,
|
|
sum: quote?.evo_kasko_price,
|
|
totalFranchise: quote?.evo_franchise,
|
|
};
|
|
}
|
|
|
|
if (quote?.evo_osago_accountid && quote?.evo_id_elt_osago && quote?.evo_osago_price) {
|
|
elt.osago = {
|
|
key: quote?.evo_osago_accountid,
|
|
numCalc: quote?.evo_id_elt_osago,
|
|
sum: quote?.evo_osago_price,
|
|
};
|
|
}
|
|
|
|
return {
|
|
elt,
|
|
};
|
|
}
|