From 3682de195b46eae692db3ff4a1476b00d3a6e216 Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Sat, 4 Jul 2026 23:51:22 +0200 Subject: [PATCH] fix(invoices): correct payment-check email template key so dunning email sends MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.) --- backend/src/services/invoice/payments.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/services/invoice/payments.js b/backend/src/services/invoice/payments.js index bc745684..c8b3f0f8 100644 --- a/backend/src/services/invoice/payments.js +++ b/backend/src/services/invoice/payments.js @@ -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