add fax filing pipeline: VitalPBX sender, attestation cover page with digital signature, compliance checker pending filing override
- filing_attestation.py: generates cover page attesting PW submitted document to recipient with date/time stamp, contact info, and digital signature - fax_sender.py: sends PDFs via VitalPBX API, polls for delivery, generates attested copy for customer records - dot-lookup.ts: if DOT has pending MCS-150 order, show green 'UPDATE SUBMITTED' instead of red 'OVERDUE' in compliance checker - requirements.txt: add pyhanko + cryptography for PDF digital signatures
This commit is contained in:
parent
e2c7cc582b
commit
1f1113d63c
4 changed files with 645 additions and 1 deletions
|
|
@ -104,7 +104,37 @@ router.get("/api/v1/dot/lookup", async (req, res) => {
|
|||
const mcs150Date = mcs150Raw ? new Date(mcs150Raw).toISOString().split("T")[0] : null;
|
||||
const isOverdue = mcs150Date ? new Date(mcs150Date) < twoYearsAgo() : null;
|
||||
|
||||
if (outdated || isOverdue) {
|
||||
// Check if we have a pending/recently-filed MCS-150 order for this DOT
|
||||
let pendingFiling: { filed_at: string; order_number: string } | null = null;
|
||||
try {
|
||||
const pendingResult = await pool.query(
|
||||
`SELECT order_number, updated_at, status FROM compliance_orders
|
||||
WHERE intake_data->>'dot_number' = $1
|
||||
AND service_slug = 'mcs150-update'
|
||||
AND status IN ('filed', 'submitted', 'processing', 'in_progress')
|
||||
ORDER BY updated_at DESC LIMIT 1`,
|
||||
[dotNumber],
|
||||
);
|
||||
if (pendingResult.rows.length > 0) {
|
||||
const row = pendingResult.rows[0] as Record<string, unknown>;
|
||||
pendingFiling = {
|
||||
filed_at: new Date(row.updated_at as string).toISOString().split("T")[0],
|
||||
order_number: row.order_number as string,
|
||||
};
|
||||
}
|
||||
} catch {}
|
||||
|
||||
if (pendingFiling) {
|
||||
// We filed it — show green/blue instead of red
|
||||
checks.push({
|
||||
id: "mcs150",
|
||||
label: "MCS-150 Biennial Update",
|
||||
status: "green",
|
||||
detail: `UPDATE SUBMITTED — filed by Performance West on ${pendingFiling.filed_at}. `
|
||||
+ `FMCSA typically reflects updates within 5-10 business days. `
|
||||
+ `If you need verification of this filing, contact us at (888) 411-0383.`,
|
||||
});
|
||||
} else if (outdated || isOverdue) {
|
||||
checks.push({
|
||||
id: "mcs150",
|
||||
label: "MCS-150 Biennial Update",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue