diff --git a/src/helpers/client-mappers/Client900040Coverage.js b/src/helpers/client-mappers/Client900040Coverage.js index bed99f42..9008de2e 100644 --- a/src/helpers/client-mappers/Client900040Coverage.js +++ b/src/helpers/client-mappers/Client900040Coverage.js @@ -1,9 +1,9 @@ -import { useMainStore } from "@/store"; +import { useMainStore } from '@/store'; export function updateClaimRegistrationPayload(payload) { const mainStore = useMainStore(); payload.additionalInfo = { - offeredItac: mainStore.isITAC ? 'true' : 'false', - qualifiedForItac: mainStore.isITAC ? 'true' : 'false' + offeredItac: mainStore.isITAC.toString(), + qualifiedForItac: mainStore.isITAC.toString() } } \ No newline at end of file diff --git a/src/helpers/coverage-helper.js b/src/helpers/coverage-helper.js index 32d2b18e..18991e64 100644 --- a/src/helpers/coverage-helper.js +++ b/src/helpers/coverage-helper.js @@ -1,10 +1,20 @@ -import { useMainStore } from "@/store"; +import { useMainStore } from '@/store'; export async function updateClientSpecificFieldsForClaimRegistration(payload) { const mainStore = useMainStore(); + const parentAccountNumber = mainStore?.order?.parentAccountNumber; + if (!parentAccountNumber) { return; } + + let clientMapper; try { - const clientMapper = await import(`@/helpers/client-mappers/Client${mainStore.order.parentAccountNumber}Coverage.js`); - clientMapper.updateClaimRegistrationPayload(payload); + clientMapper = await import(`@/helpers/client-mappers/Client${parentAccountNumber}Coverage.js`); + } catch (error) { + // No client-specific mapper found; proceed with the default payload. + return; } - catch (error) { } + + if (typeof clientMapper.updateClaimRegistrationPayload === 'function') { + await clientMapper.updateClaimRegistrationPayload(payload); + } + } \ No newline at end of file