fix(invoices): correct payment-check email template key so dunning email sends

queuePaymentCheckEmail queued the admin payment-check email with template
key 'invoice_payment_check_admin', but no such template exists — the only
one is 'invoice_payment_check' (crmEmailTemplates.js:217, seeded by
migration 116), which IS the admin "Paid / Partial / Not paid" email. The
processor does an exact template_key lookup and throws "template not
found", so every dunning admin payment-check email failed, retried to the
cap, and got stuck pending.

One-word fix: queue 'invoice_payment_check'. Unbreaks the built-in
invoice-dunning flow's email step. (Rebased onto the post-decompose
invoiceService refactor — the line now lives in invoice/payments.js.)
This commit is contained in:
Luca
2026-07-04 23:51:22 +02:00
parent c3ed7f1693
commit 3682de195b
+1 -1
View File
@@ -278,7 +278,7 @@ async function queuePaymentCheckEmail(invoiceId, { skipThrottle = false } = {})
: null;
await emailProcessor.queueEmail(invoice.event_id || null, adminContact.email,
'invoice_payment_check_admin', {
'invoice_payment_check', {
invoice_number: invoice.invoice_number,
customer_name: customer?.company_name
|| customer?.display_name