Updated pydantic schemas, deleted client's retrieving logics on creating and updating document

This commit is contained in:
Fanilo-Nantenaina 2025-12-20 16:30:48 +03:00
parent dbb2a6f16e
commit 1240a118e5

660
api.py
View file

@ -1096,331 +1096,331 @@ templates_signature_email = {
"nom": "Demande de Signature Électronique",
"sujet": "📝 Signature requise - {{TYPE_DOC}} {{NUMERO}}",
"corps_html": """
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; background-color: #f4f7fa;">
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f4f7fa; padding: 40px 0;">
<tr>
<td align="center">
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; background-color: #f4f7fa;">
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f4f7fa; padding: 40px 0;">
<tr>
<td align="center">
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
<!-- Header -->
<tr>
<td style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 30px; text-align: center; border-radius: 8px 8px 0 0;">
<h1 style="color: #000; margin: 0; font-size: 24px; font-weight: 600;">
📝 Signature Électronique Requise
</h1>
</td>
</tr>
<!-- Header -->
<tr>
<td style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 30px; text-align: center; border-radius: 8px 8px 0 0;">
<h1 style="color: #000; margin: 0; font-size: 24px; font-weight: 600;">
📝 Signature Électronique Requise
</h1>
</td>
</tr>
<!-- Content -->
<tr>
<td style="padding: 40px 30px;">
<p style="color: #2d3748; font-size: 16px; line-height: 1.6; margin: 0 0 20px;">
Bonjour <strong>{{NOM_SIGNATAIRE}}</strong>,
</p>
<!-- Content -->
<tr>
<td style="padding: 40px 30px;">
<p style="color: #2d3748; font-size: 16px; line-height: 1.6; margin: 0 0 20px;">
Bonjour <strong>{{NOM_SIGNATAIRE}}</strong>,
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 25px;">
Nous vous invitons à signer électroniquement le document suivant :
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 25px;">
Nous vous invitons à signer électroniquement le document suivant :
</p>
<!-- Document Info Box -->
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f7fafc; border-left: 4px solid #667eea; border-radius: 4px; margin-bottom: 30px;">
<tr>
<td style="padding: 20px;">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="color: #718096; font-size: 13px; padding: 5px 0;">Type de document</td>
<td style="color: #2d3748; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{TYPE_DOC}}</td>
</tr>
<tr>
<td style="color: #718096; font-size: 13px; padding: 5px 0;">Numéro</td>
<td style="color: #2d3748; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{NUMERO}}</td>
</tr>
<tr>
<td style="color: #718096; font-size: 13px; padding: 5px 0;">Date</td>
<td style="color: #2d3748; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{DATE}}</td>
</tr>
<tr>
<td style="color: #718096; font-size: 13px; padding: 5px 0;">Montant TTC</td>
<td style="color: #2d3748; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{MONTANT_TTC}} </td>
</tr>
</table>
</td>
</tr>
</table>
<!-- Document Info Box -->
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f7fafc; border-left: 4px solid #667eea; border-radius: 4px; margin-bottom: 30px;">
<tr>
<td style="padding: 20px;">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="color: #718096; font-size: 13px; padding: 5px 0;">Type de document</td>
<td style="color: #2d3748; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{TYPE_DOC}}</td>
</tr>
<tr>
<td style="color: #718096; font-size: 13px; padding: 5px 0;">Numéro</td>
<td style="color: #2d3748; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{NUMERO}}</td>
</tr>
<tr>
<td style="color: #718096; font-size: 13px; padding: 5px 0;">Date</td>
<td style="color: #2d3748; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{DATE}}</td>
</tr>
<tr>
<td style="color: #718096; font-size: 13px; padding: 5px 0;">Montant TTC</td>
<td style="color: #2d3748; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{MONTANT_TTC}} </td>
</tr>
</table>
</td>
</tr>
</table>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 30px;">
Cliquez sur le bouton ci-dessous pour accéder au document et apposer votre signature électronique sécurisée :
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 30px;">
Cliquez sur le bouton ci-dessous pour accéder au document et apposer votre signature électronique sécurisée :
</p>
<!-- CTA Button -->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" style="padding: 10px 0 30px;">
<a href="{{SIGNER_URL}}" style="display: inline-block; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #000; text-decoration: none; padding: 16px 40px; border-radius: 6px; font-size: 16px; font-weight: 600; box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);">
Signer le document
</a>
</td>
</tr>
</table>
<!-- CTA Button -->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" style="padding: 10px 0 30px;">
<a href="{{SIGNER_URL}}" style="display: inline-block; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #000; text-decoration: none; padding: 16px 40px; border-radius: 6px; font-size: 16px; font-weight: 600; box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);">
Signer le document
</a>
</td>
</tr>
</table>
<!-- Info Box -->
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #fffaf0; border: 1px solid #fbd38d; border-radius: 4px; margin-bottom: 20px;">
<tr>
<td style="padding: 15px;">
<p style="color: #744210; font-size: 13px; line-height: 1.5; margin: 0;">
<strong>Important :</strong> Ce lien de signature est valable pendant <strong>30 jours</strong>.
Nous vous recommandons de signer ce document dès que possible.
</p>
</td>
</tr>
</table>
<!-- Info Box -->
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #fffaf0; border: 1px solid #fbd38d; border-radius: 4px; margin-bottom: 20px;">
<tr>
<td style="padding: 15px;">
<p style="color: #744210; font-size: 13px; line-height: 1.5; margin: 0;">
<strong>Important :</strong> Ce lien de signature est valable pendant <strong>30 jours</strong>.
Nous vous recommandons de signer ce document dès que possible.
</p>
</td>
</tr>
</table>
<p style="color: #718096; font-size: 13px; line-height: 1.5; margin: 0;">
<strong>🔒 Signature électronique sécurisée</strong><br>
Votre signature est protégée par notre partenaire de confiance <strong>Universign</strong>,
certifié eIDAS et conforme au RGPD. Votre identité sera vérifiée et le document sera
horodaté de manière infalsifiable.
</p>
</td>
</tr>
<p style="color: #718096; font-size: 13px; line-height: 1.5; margin: 0;">
<strong>🔒 Signature électronique sécurisée</strong><br>
Votre signature est protégée par notre partenaire de confiance <strong>Universign</strong>,
certifié eIDAS et conforme au RGPD. Votre identité sera vérifiée et le document sera
horodaté de manière infalsifiable.
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="background-color: #f7fafc; padding: 25px 30px; border-radius: 0 0 8px 8px; border-top: 1px solid #e2e8f0;">
<p style="color: #718096; font-size: 12px; line-height: 1.5; margin: 0 0 10px;">
Vous avez des questions ? Contactez-nous à <a href="mailto:{{CONTACT_EMAIL}}" style="color: #667eea; text-decoration: none;">{{CONTACT_EMAIL}}</a>
</p>
<p style="color: #a0aec0; font-size: 11px; line-height: 1.4; margin: 0;">
Cet email a été envoyé automatiquement par le système Sage 100c Dataven.<br>
Si vous avez reçu cet email par erreur, veuillez nous en informer.
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="background-color: #f7fafc; padding: 25px 30px; border-radius: 0 0 8px 8px; border-top: 1px solid #e2e8f0;">
<p style="color: #718096; font-size: 12px; line-height: 1.5; margin: 0 0 10px;">
Vous avez des questions ? Contactez-nous à <a href="mailto:{{CONTACT_EMAIL}}" style="color: #667eea; text-decoration: none;">{{CONTACT_EMAIL}}</a>
</p>
<p style="color: #a0aec0; font-size: 11px; line-height: 1.4; margin: 0;">
Cet email a été envoyé automatiquement par le système Sage 100c Dataven.<br>
Si vous avez reçu cet email par erreur, veuillez nous en informer.
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
""",
"variables_disponibles": [
"NOM_SIGNATAIRE",
"TYPE_DOC",
"NUMERO",
"DATE",
"MONTANT_TTC",
"SIGNER_URL",
"CONTACT_EMAIL",
],
},
"signature_confirmee": {
"id": "signature_confirmee",
"nom": "Confirmation de Signature",
"sujet": "✅ Document signé - {{TYPE_DOC}} {{NUMERO}}",
"corps_html": """
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; background-color: #f4f7fa;">
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f4f7fa; padding: 40px 0;">
<tr>
<td align="center">
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
</table>
</td>
</tr>
</table>
</body>
</html>
""",
"variables_disponibles": [
"NOM_SIGNATAIRE",
"TYPE_DOC",
"NUMERO",
"DATE",
"MONTANT_TTC",
"SIGNER_URL",
"CONTACT_EMAIL",
],
},
"signature_confirmee": {
"id": "signature_confirmee",
"nom": "Confirmation de Signature",
"sujet": "✅ Document signé - {{TYPE_DOC}} {{NUMERO}}",
"corps_html": """
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; background-color: #f4f7fa;">
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f4f7fa; padding: 40px 0;">
<tr>
<td align="center">
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
<!-- Header -->
<tr>
<td style="background: linear-gradient(135deg, #48bb78 0%, #38a169 100%); padding: 30px; text-align: center; border-radius: 8px 8px 0 0;">
<h1 style="color: #ffffff; margin: 0; font-size: 24px; font-weight: 600;">
Document Signé avec Succès
</h1>
</td>
</tr>
<!-- Header -->
<tr>
<td style="background: linear-gradient(135deg, #48bb78 0%, #38a169 100%); padding: 30px; text-align: center; border-radius: 8px 8px 0 0;">
<h1 style="color: #ffffff; margin: 0; font-size: 24px; font-weight: 600;">
Document Signé avec Succès
</h1>
</td>
</tr>
<!-- Content -->
<tr>
<td style="padding: 40px 30px;">
<p style="color: #2d3748; font-size: 16px; line-height: 1.6; margin: 0 0 20px;">
Bonjour <strong>{{NOM_SIGNATAIRE}}</strong>,
</p>
<!-- Content -->
<tr>
<td style="padding: 40px 30px;">
<p style="color: #2d3748; font-size: 16px; line-height: 1.6; margin: 0 0 20px;">
Bonjour <strong>{{NOM_SIGNATAIRE}}</strong>,
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 25px;">
Nous confirmons la signature électronique du document suivant :
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 25px;">
Nous confirmons la signature électronique du document suivant :
</p>
<!-- Success Box -->
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f0fff4; border-left: 4px solid #48bb78; border-radius: 4px; margin-bottom: 30px;">
<tr>
<td style="padding: 20px;">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="color: #2f855a; font-size: 13px; padding: 5px 0;">Document</td>
<td style="color: #22543d; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{TYPE_DOC}} {{NUMERO}}</td>
</tr>
<tr>
<td style="color: #2f855a; font-size: 13px; padding: 5px 0;">Signé le</td>
<td style="color: #22543d; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{DATE_SIGNATURE}}</td>
</tr>
<tr>
<td style="color: #2f855a; font-size: 13px; padding: 5px 0;">ID Transaction</td>
<td style="color: #22543d; font-size: 13px; font-family: monospace; text-align: right; padding: 5px 0;">{{TRANSACTION_ID}}</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- Success Box -->
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f0fff4; border-left: 4px solid #48bb78; border-radius: 4px; margin-bottom: 30px;">
<tr>
<td style="padding: 20px;">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="color: #2f855a; font-size: 13px; padding: 5px 0;">Document</td>
<td style="color: #22543d; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{TYPE_DOC}} {{NUMERO}}</td>
</tr>
<tr>
<td style="color: #2f855a; font-size: 13px; padding: 5px 0;">Signé le</td>
<td style="color: #22543d; font-size: 15px; font-weight: 600; text-align: right; padding: 5px 0;">{{DATE_SIGNATURE}}</td>
</tr>
<tr>
<td style="color: #2f855a; font-size: 13px; padding: 5px 0;">ID Transaction</td>
<td style="color: #22543d; font-size: 13px; font-family: monospace; text-align: right; padding: 5px 0;">{{TRANSACTION_ID}}</td>
</tr>
</table>
</td>
</tr>
</table>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 25px;">
Le document signé a été automatiquement archivé et est disponible dans votre espace client.
Un certificat de signature électronique conforme eIDAS a été généré.
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 25px;">
Le document signé a été automatiquement archivé et est disponible dans votre espace client.
Un certificat de signature électronique conforme eIDAS a été généré.
</p>
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #ebf8ff; border: 1px solid #90cdf4; border-radius: 4px; margin-bottom: 20px;">
<tr>
<td style="padding: 15px;">
<p style="color: #2c5282; font-size: 13px; line-height: 1.5; margin: 0;">
🔐 <strong>Signature certifiée :</strong> Ce document a été signé avec une signature
électronique qualifiée, ayant la même valeur juridique qu'une signature manuscrite
conformément au règlement eIDAS.
</p>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #ebf8ff; border: 1px solid #90cdf4; border-radius: 4px; margin-bottom: 20px;">
<tr>
<td style="padding: 15px;">
<p style="color: #2c5282; font-size: 13px; line-height: 1.5; margin: 0;">
🔐 <strong>Signature certifiée :</strong> Ce document a été signé avec une signature
électronique qualifiée, ayant la même valeur juridique qu'une signature manuscrite
conformément au règlement eIDAS.
</p>
</td>
</tr>
</table>
<p style="color: #718096; font-size: 14px; line-height: 1.6; margin: 0;">
Merci pour votre confiance. Notre équipe reste à votre disposition pour toute question.
</p>
</td>
</tr>
<p style="color: #718096; font-size: 14px; line-height: 1.6; margin: 0;">
Merci pour votre confiance. Notre équipe reste à votre disposition pour toute question.
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="background-color: #f7fafc; padding: 25px 30px; border-radius: 0 0 8px 8px; border-top: 1px solid #e2e8f0;">
<p style="color: #718096; font-size: 12px; line-height: 1.5; margin: 0 0 10px;">
Contact : <a href="mailto:{{CONTACT_EMAIL}}" style="color: #48bb78; text-decoration: none;">{{CONTACT_EMAIL}}</a>
</p>
<p style="color: #a0aec0; font-size: 11px; line-height: 1.4; margin: 0;">
Sage 100c Dataven - Système de signature électronique sécurisée
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="background-color: #f7fafc; padding: 25px 30px; border-radius: 0 0 8px 8px; border-top: 1px solid #e2e8f0;">
<p style="color: #718096; font-size: 12px; line-height: 1.5; margin: 0 0 10px;">
Contact : <a href="mailto:{{CONTACT_EMAIL}}" style="color: #48bb78; text-decoration: none;">{{CONTACT_EMAIL}}</a>
</p>
<p style="color: #a0aec0; font-size: 11px; line-height: 1.4; margin: 0;">
Sage 100c Dataven - Système de signature électronique sécurisée
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
""",
"variables_disponibles": [
"NOM_SIGNATAIRE",
"TYPE_DOC",
"NUMERO",
"DATE_SIGNATURE",
"TRANSACTION_ID",
"CONTACT_EMAIL",
],
},
"relance_signature": {
"id": "relance_signature",
"nom": "Relance Signature en Attente",
"sujet": "⏰ Rappel - Signature en attente {{TYPE_DOC}} {{NUMERO}}",
"corps_html": """
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; background-color: #f4f7fa;">
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f4f7fa; padding: 40px 0;">
<tr>
<td align="center">
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
</table>
</td>
</tr>
</table>
</body>
</html>
""",
"variables_disponibles": [
"NOM_SIGNATAIRE",
"TYPE_DOC",
"NUMERO",
"DATE_SIGNATURE",
"TRANSACTION_ID",
"CONTACT_EMAIL",
],
},
"relance_signature": {
"id": "relance_signature",
"nom": "Relance Signature en Attente",
"sujet": "⏰ Rappel - Signature en attente {{TYPE_DOC}} {{NUMERO}}",
"corps_html": """
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; background-color: #f4f7fa;">
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f4f7fa; padding: 40px 0;">
<tr>
<td align="center">
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
<!-- Header -->
<tr>
<td style="background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%); padding: 30px; text-align: center; border-radius: 8px 8px 0 0;">
<h1 style="color: #ffffff; margin: 0; font-size: 24px; font-weight: 600;">
Signature en Attente
</h1>
</td>
</tr>
<!-- Header -->
<tr>
<td style="background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%); padding: 30px; text-align: center; border-radius: 8px 8px 0 0;">
<h1 style="color: #ffffff; margin: 0; font-size: 24px; font-weight: 600;">
Signature en Attente
</h1>
</td>
</tr>
<!-- Content -->
<tr>
<td style="padding: 40px 30px;">
<p style="color: #2d3748; font-size: 16px; line-height: 1.6; margin: 0 0 20px;">
Bonjour <strong>{{NOM_SIGNATAIRE}}</strong>,
</p>
<!-- Content -->
<tr>
<td style="padding: 40px 30px;">
<p style="color: #2d3748; font-size: 16px; line-height: 1.6; margin: 0 0 20px;">
Bonjour <strong>{{NOM_SIGNATAIRE}}</strong>,
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 25px;">
Nous vous avons envoyé il y a <strong>{{NB_JOURS}}</strong> jours un document à signer électroniquement.
Nous constatons que celui-ci n'a pas encore été signé.
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 25px;">
Nous vous avons envoyé il y a <strong>{{NB_JOURS}}</strong> jours un document à signer électroniquement.
Nous constatons que celui-ci n'a pas encore été signé.
</p>
<!-- Warning Box -->
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #fffaf0; border-left: 4px solid #ed8936; border-radius: 4px; margin-bottom: 30px;">
<tr>
<td style="padding: 20px;">
<p style="color: #744210; font-size: 14px; line-height: 1.5; margin: 0 0 10px;">
<strong>Document en attente :</strong> {{TYPE_DOC}} {{NUMERO}}
</p>
<p style="color: #744210; font-size: 13px; line-height: 1.5; margin: 0;">
Le lien de signature expirera dans <strong>{{JOURS_RESTANTS}}</strong> jours
</p>
</td>
</tr>
</table>
<!-- Warning Box -->
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #fffaf0; border-left: 4px solid #ed8936; border-radius: 4px; margin-bottom: 30px;">
<tr>
<td style="padding: 20px;">
<p style="color: #744210; font-size: 14px; line-height: 1.5; margin: 0 0 10px;">
<strong>Document en attente :</strong> {{TYPE_DOC}} {{NUMERO}}
</p>
<p style="color: #744210; font-size: 13px; line-height: 1.5; margin: 0;">
Le lien de signature expirera dans <strong>{{JOURS_RESTANTS}}</strong> jours
</p>
</td>
</tr>
</table>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 30px;">
Pour éviter tout retard dans le traitement de votre dossier, nous vous invitons à signer ce document dès maintenant :
</p>
<p style="color: #4a5568; font-size: 15px; line-height: 1.6; margin: 0 0 30px;">
Pour éviter tout retard dans le traitement de votre dossier, nous vous invitons à signer ce document dès maintenant :
</p>
<!-- CTA Button -->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" style="padding: 10px 0 30px;">
<a href="{{SIGNER_URL}}" style="display: inline-block; background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%); color: #ffffff; text-decoration: none; padding: 16px 40px; border-radius: 6px; font-size: 16px; font-weight: 600; box-shadow: 0 4px 12px rgba(237, 137, 54, 0.4);">
Signer maintenant
</a>
</td>
</tr>
</table>
<!-- CTA Button -->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" style="padding: 10px 0 30px;">
<a href="{{SIGNER_URL}}" style="display: inline-block; background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%); color: #ffffff; text-decoration: none; padding: 16px 40px; border-radius: 6px; font-size: 16px; font-weight: 600; box-shadow: 0 4px 12px rgba(237, 137, 54, 0.4);">
Signer maintenant
</a>
</td>
</tr>
</table>
<p style="color: #718096; font-size: 13px; line-height: 1.5; margin: 0;">
Si vous rencontrez des difficultés ou avez des questions, n'hésitez pas à nous contacter.
</p>
</td>
</tr>
<p style="color: #718096; font-size: 13px; line-height: 1.5; margin: 0;">
Si vous rencontrez des difficultés ou avez des questions, n'hésitez pas à nous contacter.
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="background-color: #f7fafc; padding: 25px 30px; border-radius: 0 0 8px 8px; border-top: 1px solid #e2e8f0;">
<p style="color: #718096; font-size: 12px; line-height: 1.5; margin: 0 0 10px;">
Contact : <a href="mailto:{{CONTACT_EMAIL}}" style="color: #ed8936; text-decoration: none;">{{CONTACT_EMAIL}}</a>
</p>
<p style="color: #a0aec0; font-size: 11px; line-height: 1.4; margin: 0;">
Sage 100c Dataven - Relance automatique
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="background-color: #f7fafc; padding: 25px 30px; border-radius: 0 0 8px 8px; border-top: 1px solid #e2e8f0;">
<p style="color: #718096; font-size: 12px; line-height: 1.5; margin: 0 0 10px;">
Contact : <a href="mailto:{{CONTACT_EMAIL}}" style="color: #ed8936; text-decoration: none;">{{CONTACT_EMAIL}}</a>
</p>
<p style="color: #a0aec0; font-size: 11px; line-height: 1.4; margin: 0;">
Sage 100c Dataven - Relance automatique
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
</table>
</td>
</tr>
</table>
</body>
</html>
""",
"variables_disponibles": [
"NOM_SIGNATAIRE",
@ -1887,6 +1887,12 @@ async def creer_devis(devis: DevisRequest):
devis_data = {
"client_id": devis.client_id,
"date_devis": devis.date_devis.isoformat() if devis.date_devis else None,
"date_livraison": (
devis.date_livraison.isoformat() if devis.date_livraison else None
),
"date_expedition": (
devis.date_expedition.isoformat() if devis.date_expedition else None
),
"reference": devis.reference,
"lignes": [
{
@ -1969,17 +1975,19 @@ async def creer_commande(
commande: CommandeCreateRequest, session: AsyncSession = Depends(get_session)
):
try:
# Vérifier que le client existe
client = sage_client.lire_client(commande.client_id)
if not client:
raise HTTPException(404, f"Client {commande.client_id} introuvable")
# Préparer les données pour la gateway
commande_data = {
"client_id": commande.client_id,
"date_commande": (
commande.date_commande.isoformat() if commande.date_commande else None
),
"date_livraison": (
commande.date_livraison.isoformat() if commande.date_livraison else None
),
"date_expedition": (
commande.date_expedition.isoformat()
if commande.date_expedition
else None
),
"reference": commande.reference,
"lignes": [
{
@ -2184,12 +2192,6 @@ async def envoyer_devis_email(
id: str, request: EmailEnvoiRequest, session: AsyncSession = Depends(get_session)
):
try:
# Vérifier que le devis existe
devis = sage_client.lire_devis(id)
if not devis:
raise HTTPException(404, f"Devis {id} introuvable")
# Créer logs email pour chaque destinataire
tous_destinataires = [request.destinataire] + request.cc + request.cci
email_logs = []
@ -3141,17 +3143,17 @@ async def creer_facture(
facture: FactureCreateRequest, session: AsyncSession = Depends(get_session)
):
try:
# Vérifier que le client existe
client = sage_client.lire_client(facture.client_id)
if not client:
raise HTTPException(404, f"Client {facture.client_id} introuvable")
# Préparer les données pour la gateway
facture_data = {
"client_id": facture.client_id,
"date_facture": (
facture.date_facture.isoformat() if facture.date_facture else None
),
"date_livraison": (
facture.date_livraison.isoformat() if facture.date_livraison else None
),
"date_expedition": (
facture.date_expedition.isoformat() if facture.date_expedition else None
),
"reference": facture.reference,
"lignes": [
{
@ -3759,15 +3761,15 @@ async def creer_avoir(
avoir: AvoirCreateRequest, session: AsyncSession = Depends(get_session)
):
try:
# Vérifier que le client existe
client = sage_client.lire_client(avoir.client_id)
if not client:
raise HTTPException(404, f"Client {avoir.client_id} introuvable")
# Préparer les données pour la gateway
avoir_data = {
"client_id": avoir.client_id,
"date_avoir": (avoir.date_avoir.isoformat() if avoir.date_avoir else None),
"date_livraison": (
facture.date_livraison.isoformat() if facture.date_livraison else None
),
"date_expedition": (
facture.date_expedition.isoformat() if facture.date_expedition else None
),
"reference": avoir.reference,
"lignes": [
{
@ -3887,12 +3889,6 @@ async def creer_livraison(
livraison: LivraisonCreateRequest, session: AsyncSession = Depends(get_session)
):
try:
# Vérifier que le client existe
client = sage_client.lire_client(livraison.client_id)
if not client:
raise HTTPException(404, f"Client {livraison.client_id} introuvable")
# Préparer les données pour la gateway
livraison_data = {
"client_id": livraison.client_id,
"date_livraison": (
@ -3900,6 +3896,16 @@ async def creer_livraison(
if livraison.date_livraison
else None
),
"date_livraison_prevue": (
livraison.date_livraison_prevue.isoformat()
if livraison.date_livraison_prevue
else None
),
"date_expedition": (
livraison.date_expedition.isoformat()
if livraison.date_expedition
else None
),
"reference": livraison.reference,
"lignes": [
{