feat: select DDMA provider by NPI settings instead of always first

Pass the user's primary NPI provider name through the eligibility and
claim routes so the Selenium workers click the matching option in the
DDMA member-search provider dropdown (data-testid=member-search_provider_select-btn)
rather than always falling back to the first entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gitead
2026-06-11 15:32:01 -04:00
parent 75c49ab1df
commit 6cfca0d015
4 changed files with 122 additions and 0 deletions

View File

@@ -67,10 +67,15 @@ router.post(
});
}
// Fetch NPI providers to pick the target provider on the DDMA portal
const npiProviders = await storage.getNpiProvidersByUser(req.user.id);
const primaryProvider = npiProviders[0]; // sorted by sortOrder asc, then id asc
const enrichedData = {
...rawData,
massddmaUsername: credentials.username,
massddmaPassword: credentials.password,
providerName: primaryProvider?.providerName ?? "",
};
const socketId: string | undefined = req.body.socketId;

View File

@@ -40,11 +40,16 @@ router.post("/ddma-claim", async (req: Request, res: Response): Promise<any> =>
});
}
// Fetch NPI providers to pick the target provider on the DDMA portal
const npiProviders = await storage.getNpiProvidersByUser(req.user.id);
const primaryProvider = npiProviders[0]; // sorted by sortOrder asc, then id asc
const enrichedPayload = {
claim: {
...claimData,
massddmaUsername: credentials.username,
massddmaPassword: credentials.password,
providerName: primaryProvider?.providerName ?? "",
},
};