new-site/api/src
justin f6419759e6 portal: converge all compliance orders on the single ERPNext portal
Root cause of customers being unable to log in: ERPNext (portal.performancewest.net)
is the intended single portal and already surfaces compliance/trucking orders
(performancewest_erpnext/www/orders.py reads compliance_orders by email). But
only the Stripe checkout path provisioned the ERPNext Website User up-front
(findOrCreateCustomer). PayPal / crypto / remediation-pipeline orders go straight
to handlePaymentComplete, which created NO portal user and never set
portal_user_created -> no login + no set-password invite (exactly what happened
to the Paul Wilson / Compound Technologies PayPal order).

- handlePaymentComplete: add ensureCompliancePortalUser() in the shared
  post-payment path so EVERY paid compliance order (any payment method) gets an
  ERPNext portal account + the set-password invite. Idempotent.
- Guard against placeholder emails (synthetic@/pipeline.com etc): skip portal
  provisioning and the set-password invite for non-deliverable addresses.
- compliance-orders API: validate email format AND reject placeholder addresses
  at order creation (was: presence-only, so synthetic@pipeline.com passed).
- delivery_worker: never email a set-password invite to a placeholder address.

Note: the legacy PG-customers login (api/routes/portal-auth.ts, /account/*) is
CRTC/formation-era and only backfills canada_crtc_orders/orders, never
compliance_orders. ERPNext is now the consistent portal for compliance.
2026-06-02 22:44:34 -05:00
..
lib Initial commit — Performance West telecom compliance platform 2026-04-27 06:54:22 -05:00
middleware Add PUT to CORS allowed methods (needed for intake save) 2026-04-28 18:29:00 -05:00
routes portal: converge all compliance orders on the single ERPNext portal 2026-06-02 22:44:34 -05:00
config.ts Initial commit — Performance West telecom compliance platform 2026-04-27 06:54:22 -05:00
create-admin.ts Initial commit — Performance West telecom compliance platform 2026-04-27 06:54:22 -05:00
db.ts Initial commit — Performance West telecom compliance platform 2026-04-27 06:54:22 -05:00
email.ts Fix 6 bugs found in compliance and checkout flows 2026-04-27 09:56:12 -05:00
erpnext-client.ts Initial commit — Performance West telecom compliance platform 2026-04-27 06:54:22 -05:00
fx.ts Initial commit — Performance West telecom compliance platform 2026-04-27 06:54:22 -05:00
index.ts add order timeline API: step names + estimated business-day completion dates per service 2026-05-30 22:48:44 -05:00
sanctions.ts Initial commit — Performance West telecom compliance platform 2026-04-27 06:54:22 -05:00