feat: Check DDMA Payments reads Plan Pays from DDMA claim status, fills app payments and saves a PDF
Adds a Check DDMA Payments card (date range, Go, auto-check schedule) above Check MH Payments. Go logs into DDMA (with OTP), searches Check Claim Status by service date range, reads claim numbers and Plan Pays across pages, matches them to app claims to fill the paid amount, creates patient + payment for unmatched paid claims, and saves the results page as a PDF in uploads/DDMAPayment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ import helpers_cca_eligibility as hcca
|
||||
import helpers_cca_claim as hcca_claim
|
||||
import helpers_cca_preauth as hcca_preauth
|
||||
import helpers_ddma_claim as hddma_claim
|
||||
import helpers_ddma_payment as hddma_payment
|
||||
import helpers_deltains_claim as hdeltains_claim
|
||||
import helpers_uniteddh_claim as huniteddh_claim
|
||||
import helpers_uniteddh_preauth as huniteddh_preauth
|
||||
@@ -474,6 +475,46 @@ async def ddma_eligibility(request: Request):
|
||||
return {"status": "started", "session_id": sid}
|
||||
|
||||
|
||||
# Endpoint: DDMA payment check (background, OTP)
|
||||
|
||||
async def _ddma_payment_worker_wrapper(sid: str, data: dict, url: str):
|
||||
"""Background worker for DDMA payment check — acquires semaphore, updates counters."""
|
||||
global active_jobs, waiting_jobs
|
||||
async with semaphore:
|
||||
async with lock:
|
||||
waiting_jobs -= 1
|
||||
active_jobs += 1
|
||||
try:
|
||||
await hddma_payment.start_ddma_payment_run(sid, data, url)
|
||||
finally:
|
||||
async with lock:
|
||||
active_jobs -= 1
|
||||
|
||||
|
||||
@app.post("/ddma-payment-check")
|
||||
async def ddma_payment_check(request: Request):
|
||||
"""
|
||||
Starts a DDMA payment check session in the background (logs in to DDMA).
|
||||
Body: { "data": { "massddmaUsername", "massddmaPassword", "fromDate", "toDate" } }
|
||||
Returns: { status: "started", session_id: "<uuid>" }
|
||||
"""
|
||||
global waiting_jobs
|
||||
|
||||
body = await request.json()
|
||||
data = body.get("data", {})
|
||||
|
||||
sid = hddma_payment.make_session_entry()
|
||||
hddma_payment.sessions[sid]["type"] = "ddma_payment_check"
|
||||
hddma_payment.sessions[sid]["last_activity"] = time.time()
|
||||
|
||||
async with lock:
|
||||
waiting_jobs += 1
|
||||
|
||||
asyncio.create_task(_ddma_payment_worker_wrapper(sid, data, url="https://www.deltadentalma.com/sign-in"))
|
||||
|
||||
return {"status": "started", "session_id": sid}
|
||||
|
||||
|
||||
# Endpoint: DDWA (Delta Dental of Washington) eligibility (background, OTP)
|
||||
|
||||
async def _ddwa_worker_wrapper(sid: str, data: dict, url: str):
|
||||
@@ -1373,6 +1414,8 @@ async def submit_otp(request: Request):
|
||||
res = hdentaquest.submit_otp(sid, otp)
|
||||
elif sid in hddma_claim.sessions:
|
||||
res = hddma_claim.submit_otp(sid, otp)
|
||||
elif sid in hddma_payment.sessions:
|
||||
res = hddma_payment.submit_otp(sid, otp)
|
||||
elif sid in hdeltains_claim.sessions:
|
||||
res = hdeltains_claim.submit_otp(sid, otp)
|
||||
elif sid in huniteddh_claim.sessions:
|
||||
@@ -1424,6 +1467,8 @@ async def session_status(sid: str):
|
||||
s = hcca_preauth.get_session_status(sid)
|
||||
elif sid in hddma_claim.sessions:
|
||||
s = hddma_claim.get_session_status(sid)
|
||||
elif sid in hddma_payment.sessions:
|
||||
s = hddma_payment.get_session_status(sid)
|
||||
elif sid in hdeltains_claim.sessions:
|
||||
s = hdeltains_claim.get_session_status(sid)
|
||||
elif sid in huniteddh_claim.sessions:
|
||||
|
||||
Reference in New Issue
Block a user