feat: add email notification for new payment received with PDF receipt attachment

This commit is contained in:
Marco Pedone 2026-03-09 18:30:54 +01:00
parent b496aa5d75
commit 237ecec27e

View file

@ -266,6 +266,37 @@ export const whIntentSucceededHandler = async ({
});
break;
}
await addEventToQueue({
data: {
tipo: "email",
data: {
template: {
mailType: "generic",
props: {
title: "Nuovo pagamento ricevuto",
testo: `È stato ricevuto un nuovo pagamento.`,
},
},
mail: {
subject: "Ric pagamento",
to: "web@infoalloggi.it",
attachments: [
{
filename: `ricevuta_cortesia_${ordine.ordine_id}.pdf`,
generate: {
type: "ricevuta_cortesia",
ordineId: ordine.ordine_id,
},
encoding: "base64",
contentType: "application/pdf",
},
],
},
},
},
lock_expires,
});
});
return true;
} catch (error) {