trucking: compute coupon discounted prices on the fly (true per A/B arm) + fix CTA URL bug

Two correctness fixes that gate enabling the coupon test:

1. On-the-fly pricing. The coupon block hardcoded '$79 $47' (only true at 40%
   off) — a false claim on the 20/30% arms. Now build_trucking_campaigns.py
   reads api/src/service-catalog.ts (same source checkout uses) and computes
   coupon_price_full / coupon_price_deal per recipient as full - round(full*pct/100),
   exactly matching the server. Service-fee-only; non-discountable services
   (boc3-filing passthrough) get NO price and fall back to percent-only copy.
   Quotes the service the email is ABOUT (mcs150 $79, reactivation $149), not the
   bundle the CTA happens to link to. service-catalog.ts now ships in the worker
   image; helper degrades to percent-only if it can't be read.

2. CTA URL bug (likely a big driver of the zero-click problem). Main campaign
   CTAs render '/order/slug&utm_source=...' (no '?') -> HTTP 404, verified live.
   Deficiency CTAs would double-'?' once a coupon added '?code='. lp_link now
   owns the query (?dot=...&code=...) so every template appends with a leading
   '&' and is valid in all 4 states (main/deficiency x coupon on/off), verified
   against live URLs returning 200.

Deficiency _deal_box now shows real was/now prices (percent-only for boc3).
Tests: 7/7 pass (adds URL-wellformed + price-matches-checkout cases).
This commit is contained in:
justin 2026-06-20 17:43:11 -05:00
parent 6fce3ec9eb
commit 579919197d
4 changed files with 227 additions and 11 deletions

View file

@ -20,6 +20,9 @@ RUN playwright install chromium && playwright install-deps chromium
# Copy all scripts
COPY scripts/ /app/scripts/
COPY docs/product-facts.md /app/docs/product-facts.md
# Authoritative service prices: build_trucking_campaigns.py reads this to compute
# coupon discounted prices that match what checkout charges (service-fee only).
COPY api/src/service-catalog.ts /app/api/src/service-catalog.ts
COPY ["docs/MCS-150 Form.pdf", "/app/docs/MCS-150 Form.pdf"]
COPY ["docs/MCS-150B Form.pdf", "/app/docs/MCS-150B Form.pdf"]
COPY ["docs/MCS-150C Form.pdf", "/app/docs/MCS-150C Form.pdf"]