feat(workflows): collections-handoff block after dunning exhausts

New escalate_to_collections action: when the 3-reminder loop ends still
unpaid, consolidate ONE email to the admin — customer data, outstanding
(invoice + late fees − paid), and the invoice PDF attached — ready to forward
to an Inkasso agency / for Betreibung. Internal mail, sent immediately; does
NOT touch the invoice. New invoice_collections_handoff email template (en +
native de, seeded by the boot self-heal). Wired into the built-in dunning
flow: loop 'exit' → collections → end (seed v4, re-seeds the disabled
built-in). Selectable + labelled in the canvas editor. Tests 9/9, tsc 0,
build green.
This commit is contained in:
Luca
2026-06-23 12:37:50 +02:00
parent dcdbeb9cc5
commit b78bd979dc
6 changed files with 129 additions and 7 deletions
@@ -20,6 +20,7 @@ const lbl = 'block text-xs text-neutral-500 dark:text-neutral-400 mb-1';
const ACTIONS = [
['queue_payment_check', 'Send payment-check email (dunning gate)'],
['escalate_to_collections', 'Hand off to collections (email admin)'],
['send_email', 'Send email'],
['reserve_date', 'Reserve the event date'],
['prepare_quote', 'Prepare a quote (draft)'],
@@ -40,7 +40,7 @@ const SOURCE_HANDLES: Record<string, string[]> = {
const WAIT_ANCHOR_LABEL: Record<string, string> = { dueDate: 'due date', issueDate: 'invoice date', eventDate: 'event date' };
const ACTION_LABEL: Record<string, string> = {
queue_payment_check: 'Send payment-check email', send_email: 'Send email', reserve_date: 'Reserve the date',
queue_payment_check: 'Send payment-check email', escalate_to_collections: 'Collections handoff', send_email: 'Send email', reserve_date: 'Reserve the date',
prepare_quote: 'Prepare quote', prepare_contract: 'Prepare contract', prepare_invoice: 'Prepare invoice',
prepare_event: 'Create event', prepare_gallery: 'Create gallery', send_document: 'Send document',
webhook: 'Call webhook', noop: 'Do nothing', set_context: 'Set value',