INSR-10442: Simplify isITAC conversion, more robust client-specific payload handling
This commit is contained in:
parent
6ba3a55274
commit
64de868c96
2 changed files with 17 additions and 7 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
import { useMainStore } from "@/store";
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
export function updateClaimRegistrationPayload(payload) {
|
export function updateClaimRegistrationPayload(payload) {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
payload.additionalInfo = {
|
payload.additionalInfo = {
|
||||||
offeredItac: mainStore.isITAC ? 'true' : 'false',
|
offeredItac: mainStore.isITAC.toString(),
|
||||||
qualifiedForItac: mainStore.isITAC ? 'true' : 'false'
|
qualifiedForItac: mainStore.isITAC.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,10 +1,20 @@
|
||||||
import { useMainStore } from "@/store";
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
export async function updateClientSpecificFieldsForClaimRegistration(payload) {
|
export async function updateClientSpecificFieldsForClaimRegistration(payload) {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
|
const parentAccountNumber = mainStore?.order?.parentAccountNumber;
|
||||||
|
if (!parentAccountNumber) { return; }
|
||||||
|
|
||||||
|
let clientMapper;
|
||||||
try {
|
try {
|
||||||
const clientMapper = await import(`@/helpers/client-mappers/Client${mainStore.order.parentAccountNumber}Coverage.js`);
|
clientMapper = await import(`@/helpers/client-mappers/Client${parentAccountNumber}Coverage.js`);
|
||||||
clientMapper.updateClaimRegistrationPayload(payload);
|
} catch (error) {
|
||||||
|
// No client-specific mapper found; proceed with the default payload.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
catch (error) { }
|
|
||||||
|
if (typeof clientMapper.updateClaimRegistrationPayload === 'function') {
|
||||||
|
await clientMapper.updateClaimRegistrationPayload(payload);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue