fix(checkout): don't skip ERPNext SO for synthetic@pipeline.com (real customers use it)

ensureComplianceSalesOrder skipped the FMCSA-census placeholder email, but a real
paying customer (Paul Wilson) genuinely uses synthetic@pipeline.com, so his SO
never got created/regenerated. A Sales Order is internal bookkeeping, not an
outbound email, so the placeholder skip is unnecessary here (the email/portal
guard in ensureCompliancePortalUser still protects actual sends).
This commit is contained in:
justin 2026-06-10 07:05:21 -05:00
parent 7708086130
commit 1fe942c109

View file

@ -300,7 +300,11 @@ export async function ensureComplianceSalesOrder(
const first = rows[0];
const email = ((first.customer_email as string) || "").toLowerCase().trim();
const name = (first.customer_name as string) || email.split("@")[0] || "Customer";
if (!email || email === "synthetic@pipeline.com") return;
// NOTE: unlike portal provisioning, we do NOT skip the FMCSA-census placeholder
// email here -- a Sales Order is internal bookkeeping (not an outbound email),
// and some real customers genuinely use that address. We only need a non-empty
// email to attach an ERPNext Customer.
if (!email) return;
const { customerName: erpnextCustomer } = await findOrCreateCustomer(email, name);
if (!erpnextCustomer) return;