chore: catálogo obligaciones, cierre automático, fixes SAT y facturación
- Catálogo de obligaciones fiscales expandido a 30 entradas con campo requierePago. - Soporte de frecuencia cuatrimestral en obligaciones y declaraciones. - Automatización de cierre de obligaciones fiscales desde Documentos › Declaraciones. - Nuevas tablas obligacion_evidencias, obligacion_periodos estados y declaracion_obligaciones. - Nuevo servicio obligacion-evidencias.service.ts y endpoints REST. - Refactor de declaraciones.service.ts para vincular obligaciones y crear evidencias. - Notificaciones por email para evidencias de obligaciones. - Adjuntar PDFs en correo de declaración subida. - Fix drill-down de CFDIs: carga completa al visualizar. - Fix sincronización SAT: tipos P/N, UUID case-insensitive, no reutilizar requestId. - Fix suscripciones pending en /configuracion/planes-despacho. - Fix sugerencias de Clave Producto SAT: importar catálogo y robustecer autocomplete. - Quitar toggle manual de completado en Configuración › Obligaciones fiscales › Tareas. - Scripts de soporte para Demo Ventas y utilerías (change-user-email, resend-welcome, import-clave-prod-serv). - Documentación de cambios en docs/CAMBIOS-2026-05-04.md.
This commit is contained in:
@@ -8,8 +8,13 @@ export interface SmtpConfig {
|
||||
from: string;
|
||||
}
|
||||
|
||||
export interface EmailAttachment {
|
||||
filename: string;
|
||||
content: Buffer;
|
||||
}
|
||||
|
||||
export interface EmailTransport {
|
||||
send(to: string, subject: string, html: string): Promise<void>;
|
||||
send(to: string, subject: string, html: string, attachments?: EmailAttachment[]): Promise<void>;
|
||||
}
|
||||
|
||||
export function createEmailTransport(config: SmtpConfig | null): EmailTransport {
|
||||
@@ -21,7 +26,11 @@ export function createEmailTransport(config: SmtpConfig | null): EmailTransport
|
||||
console.warn('[EMAIL] SMTP not configured. Emails will be logged to console.');
|
||||
return {
|
||||
sendMail: async (opts: any) => {
|
||||
console.log('[EMAIL] Would send:', { to: opts.to, subject: opts.subject });
|
||||
console.log('[EMAIL] Would send:', {
|
||||
to: opts.to,
|
||||
subject: opts.subject,
|
||||
attachments: opts.attachments?.map((a: any) => a.filename ?? a.path),
|
||||
});
|
||||
return { messageId: 'mock' };
|
||||
},
|
||||
} as any;
|
||||
@@ -42,7 +51,7 @@ export function createEmailTransport(config: SmtpConfig | null): EmailTransport
|
||||
}
|
||||
|
||||
return {
|
||||
async send(to: string, subject: string, html: string) {
|
||||
async send(to: string, subject: string, html: string, attachments?: EmailAttachment[]) {
|
||||
const transport = getTransporter();
|
||||
try {
|
||||
await transport.sendMail({
|
||||
@@ -51,7 +60,9 @@ export function createEmailTransport(config: SmtpConfig | null): EmailTransport
|
||||
subject,
|
||||
html,
|
||||
text: html.replace(/<[^>]*>/g, ''),
|
||||
attachments,
|
||||
});
|
||||
console.log(`[EMAIL] Sent email to ${to} with ${attachments?.length ?? 0} attachment(s)`);
|
||||
} catch (error) {
|
||||
console.error('[EMAIL] Error sending email:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user