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. |
||
|---|---|---|
| .. | ||
| lib | ||
| middleware | ||
| routes | ||
| config.ts | ||
| create-admin.ts | ||
| db.ts | ||
| email.ts | ||
| erpnext-client.ts | ||
| fx.ts | ||
| index.ts | ||
| sanctions.ts | ||