fix(mcs150): point intake email to per-slug wizard (not sales page) + add Trailers field

The MCS-150 intake-completion email linked customers to /order/dot-compliance,
which is the sales/checkout page -- it ignores ?order= and asks the customer to
re-pick services and pay again, so they 'cannot enter any data' (Paul Wilson's
report). Link to the per-service intake wizard /order/<slug>?order=... instead,
which loads the paid order, pre-fills from the FMCSA census, and drops payment.

Also add a Trailers field to the DOT intake fleet section and wire it through to
the MCS-150 PDF Q26 trailer row, so carriers can update trucks AND trailers.
This commit is contained in:
justin 2026-06-16 16:21:57 -05:00
parent 674979c928
commit 35f204c2b8
3 changed files with 21 additions and 4 deletions

View file

@ -319,6 +319,11 @@ def fill_mcs150(intake: dict, order_number: str = "") -> str:
intake.get("primary_vehicle_type", "straight"), "straight")
if power_units not in (None, ""):
field_updates[f"{prefix}Own"] = str(power_units)
# Simple intake also collects a flat trailer count (no owned/leased
# breakdown). Default trailers to the Owned column of the trailer row.
trailers = intake.get("trailers", "")
if trailers not in (None, "", 0, "0"):
field_updates["trailerOwn"] = str(trailers)
# Non-CMV count, if provided.
if intake.get("non_cmv_vehicles") not in (None, ""):

View file

@ -200,7 +200,7 @@ class MCS150UpdateHandler:
missing = self._missing_intake_fields(slug, intake)
if missing and not client_approved and not admin_approved:
self._request_intake_completion(
order_number, entity_name, customer_email, dot_number, missing)
order_number, entity_name, customer_email, dot_number, missing, slug)
LOG.info("[%s] Held for customer intake completion; missing=%s",
order_number, missing)
return []
@ -222,7 +222,7 @@ class MCS150UpdateHandler:
self._persist_intake(order_number, intake)
self._set_fulfillment_status(order_number, "awaiting_intake")
self._request_intake_completion(
order_number, entity_name, customer_email, dot_number, missing)
order_number, entity_name, customer_email, dot_number, missing, slug)
LOG.info("[%s] Admin-assisted %s held for intake; missing=%s",
order_number, slug, missing)
return []
@ -521,11 +521,17 @@ class MCS150UpdateHandler:
return missing
def _request_intake_completion(self, order_number, entity_name,
customer_email, dot_number, missing):
customer_email, dot_number, missing, slug=None):
"""Email the customer a census-pre-filled intake link and create a
low-priority admin todo noting we're waiting on intake completion."""
domain = os.environ.get("PUBLIC_SITE_URL", "https://performancewest.net").rstrip("/")
intake_url = f"{domain}/order/dot-compliance?order={order_number}"
# Link to the per-service intake WIZARD (/order/<slug>?order=...), which
# loads the existing paid order, pre-fills it from the FMCSA census, and
# drops the payment step. Do NOT link to /order/dot-compliance -- that is
# the sales/checkout page; it ignores ?order= and asks the customer to
# re-select services and pay again (they can't "enter any data" there).
intake_slug = slug or self.SERVICE_SLUG
intake_url = f"{domain}/order/{intake_slug}?order={order_number}"
# Customer email (no paper/mail mechanics; public form names are fine).
try: