feat: MetLife Dental claim submission via ClaimConnect; MetLife fee schedule

Reuses the MetLife eligibility login (persistent profile, email MFA, OTP
from app or browser), then Submit Claims -> ClaimConnect -> DentalXChange
Single Claim: billing/rendering provider, member ID, last name, payer
Metlife 65978, patient picked by DOB/name, signature on file Yes, one
claim item per CDT code (date, code, tooth, surfaces, fee; Add Claim Item
past 3), Finish, Submit Claim, then Back to Claim to read the Claim ID and
save the page as PDF. Waits out Wicket ajax/veil before each click.

MetLife now has its own fee schedule (seeded from DDMA) instead of falling
back to MassHealth prices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 00:01:39 -04:00
co-authored by Claude Opus 5.5
parent db7d74a13b
commit a5beeb7ba9
15 changed files with 1793 additions and 1 deletions
@@ -99,6 +99,7 @@ interface ClaimFormProps {
onHandleForUnitedDHSeleniumPreAuth: (data: ClaimPreAuthData) => void;
onHandleForTuftsSCOSeleniumPreAuth: (data: ClaimPreAuthData) => void;
onHandleForDDMASeleniumClaim: (data: ClaimFormData) => void;
onHandleForMetLifeSeleniumClaim: (data: ClaimFormData) => void;
onHandleForDeltainsSeleniumClaim: (data: ClaimFormData) => void;
onHandleForUnitedDHSeleniumClaim: (data: ClaimFormData) => void;
onHandleForTuftsSCOSeleniumClaim: (data: ClaimFormData) => void;
@@ -123,6 +124,7 @@ export function ClaimForm({
onHandleForUnitedDHSeleniumPreAuth,
onHandleForTuftsSCOSeleniumPreAuth,
onHandleForDDMASeleniumClaim,
onHandleForMetLifeSeleniumClaim,
onHandleForDeltainsSeleniumClaim,
onHandleForUnitedDHSeleniumClaim,
onHandleForTuftsSCOSeleniumClaim,
@@ -1282,6 +1284,73 @@ export function ClaimForm({
onClose();
};
// MetLife Claim: saves to DB then submits via Selenium
const handleMetLifeClaim = async (formToUse?: ClaimFormData & { uploadedFiles?: File[] }) => {
const f = formToUse ?? form;
const missingFields: string[] = [];
if (!f.memberId?.trim()) missingFields.push("Member ID");
if (!f.dateOfBirth?.trim()) missingFields.push("Date of Birth");
if (!patient?.firstName?.trim()) missingFields.push("First Name");
if (missingFields.length > 0) {
toast({
title: "Missing Required Fields",
description: `Please fill out the following field(s): ${missingFields.join(", ")}`,
variant: "destructive",
});
return;
}
const filteredServiceLines = (f.serviceLines || []).filter(
(line) => (line.procedureCode ?? "").trim() !== "",
);
if (filteredServiceLines.length === 0) {
toast({
title: "No procedure codes",
description: "Please add at least one procedure code before submitting the claim.",
variant: "destructive",
});
return;
}
const appointmentIdToUse = appointmentId ?? null;
const { uploadedFiles, insuranceSiteKey, npiProvider, ...formToCreateClaim } = f;
// Upload files to server so we get local filePaths for Selenium
const claimFilesMeta: ClaimFileMeta[] = mergeWithExistingAttachments(
uploadedFiles?.length ? await uploadAttachmentsToLocalFolder(uploadedFiles) : [],
);
const selectedNpiProviderId = npiProvider?.npiNumber
? npiProviders.find((p) => p.npiNumber === npiProvider.npiNumber)?.id ?? null
: null;
const createdClaim = await onSubmit({
...formToCreateClaim,
serviceLines: filteredServiceLines,
staffId: appointmentStaffId ?? Number(staff?.id),
patientId,
insuranceProvider: "MetLife Dental",
appointmentId: appointmentIdToUse,
claimFiles: claimFilesMeta,
...(selectedNpiProviderId ? { npiProviderId: selectedNpiProviderId } : {}),
});
onHandleForMetLifeSeleniumClaim({
...f,
serviceLines: filteredServiceLines,
staffId: appointmentStaffId ?? Number(staff?.id),
patientId,
insuranceProvider: "MetLife Dental",
appointmentId: appointmentIdToUse,
insuranceSiteKey: "METLIFE",
claimId: createdClaim.id,
claimFiles: claimFilesMeta,
});
onClose();
};
// Deltains Claim: saves to DB then submits via Selenium
const handleDeltainsClaim = async (formToUse?: ClaimFormData & { uploadedFiles?: File[] }) => {
const f = formToUse ?? form;
@@ -1577,6 +1646,8 @@ export function ClaimForm({
runWithPriceCheck(handleCCAClaim);
} else if (siteKey === "DDMA") {
runWithPriceCheck(handleDDMAClaim);
} else if (siteKey === "METLIFE" || siteKey === "METLIFEDENTAL") {
runWithPriceCheck(handleMetLifeClaim);
} else if (siteKey === "DELTAINS" || siteKey === "DELTA_INS") {
runWithPriceCheck(handleDeltainsClaim);
} else if (siteKey === "TUFTSSCO" || siteKey === "TUFTS_SCO") {
@@ -2161,6 +2232,8 @@ export function ClaimForm({
handleCCAClaim(pricedForm);
} else if (key === "ddma") {
handleDDMAClaim(pricedForm);
} else if (key === "metlife" || key === "metlifedental") {
handleMetLifeClaim(pricedForm);
} else if (key === "deltains" || key === "delta_ins") {
handleDeltainsClaim(pricedForm);
} else if (key === "united_sco" || key === "unitedco" || key === "dentalhub") {
@@ -2818,6 +2891,14 @@ export function ClaimForm({
>
Delta MA Claim
</Button>
<Button
className="w-36 bg-emerald-600 hover:bg-emerald-700 text-white"
onClick={() => runWithPriceCheck(handleMetLifeClaim)}
disabled={!isLicensed}
title={!isLicensed ? "License required" : undefined}
>
MetLife Claim
</Button>
<Button
className="w-36 bg-indigo-600 hover:bg-indigo-700 text-white"
onClick={() => runWithPriceCheck(handleDeltainsClaim)}