feat: email confirmation paiement recu E-Flex + mention credit dans process
- Email eflex_paiement_recu au client lors du paiement manuel admin (reference, echeance, montant, methode, date, progression) - Bandeau vert si toutes echeances payees Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -295,7 +295,7 @@ class EFlexController extends AbstractController
|
||||
* Enregistre un paiement manuel (virement, CB externe, etc.).
|
||||
*/
|
||||
#[Route('/{id}/manual-payment/{lineId}', name: 'manual_payment', requirements: ['id' => '\d+', 'lineId' => '\d+'], methods: ['POST'])]
|
||||
public function manualPayment(int $id, int $lineId, Request $request): Response
|
||||
public function manualPayment(int $id, int $lineId, Request $request, MailerService $mailer, Environment $twig): Response
|
||||
{
|
||||
$eflex = $this->em->getRepository(EFlex::class)->find($id);
|
||||
if (null === $eflex) {
|
||||
@@ -322,7 +322,36 @@ class EFlexController extends AbstractController
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
$this->addFlash('success', 'Echeance '.$line->getPosition().' marquee comme payee ('.$method.').');
|
||||
// Email de confirmation au client
|
||||
$customer = $eflex->getCustomer();
|
||||
if (null !== $customer->getEmail()) {
|
||||
try {
|
||||
$methodLabels = [
|
||||
'virement' => 'Virement bancaire',
|
||||
'cb_externe' => 'Carte bancaire (externe)',
|
||||
'cheque' => 'Cheque',
|
||||
'especes' => 'Especes',
|
||||
];
|
||||
|
||||
$mailer->sendEmail(
|
||||
$customer->getEmail(),
|
||||
'Paiement recu - Echeance '.$line->getPosition().'/'.$eflex->getNbLines().' - '.$eflex->getReference(),
|
||||
$twig->render('emails/eflex_paiement_recu.html.twig', [
|
||||
'customer' => $customer,
|
||||
'eflex' => $eflex,
|
||||
'line' => $line,
|
||||
'methodLabel' => $methodLabels[$method] ?? $method,
|
||||
]),
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
);
|
||||
} catch (\Throwable) {
|
||||
// silencieux
|
||||
}
|
||||
}
|
||||
|
||||
$this->addFlash('success', 'Echeance '.$line->getPosition().' marquee comme payee ('.$method.'). Email de confirmation envoye.');
|
||||
|
||||
return $this->redirectToRoute('app_admin_eflex_show', ['id' => $id]);
|
||||
}
|
||||
|
||||
55
templates/emails/eflex_paiement_recu.html.twig
Normal file
55
templates/emails/eflex_paiement_recu.html.twig
Normal file
@@ -0,0 +1,55 @@
|
||||
{% extends 'email/base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<table width="600" cellpadding="0" cellspacing="0" style="margin: 0 auto;">
|
||||
<tr>
|
||||
<td style="padding: 32px;">
|
||||
{% set greeting = customer.raisonSociale ? 'Chez ' ~ customer.raisonSociale : 'Bonjour ' ~ customer.firstName %}
|
||||
<h1 style="font-family: Arial, Helvetica, sans-serif; font-size: 22px; font-weight: 700; color: #111827; margin: 0 0 16px;">{{ greeting }},</h1>
|
||||
|
||||
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #374151; line-height: 22px; margin: 0 0 16px;">
|
||||
Nous confirmons la reception de votre paiement pour l'echeance <strong>{{ line.position }}/{{ eflex.nbLines }}</strong> du contrat <strong>{{ eflex.reference }}</strong>.
|
||||
</p>
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="margin: 20px 0; border: 1px solid #e5e7eb;">
|
||||
<tr>
|
||||
<td style="padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; background: #f9fafb; width: 35%;">Reference</td>
|
||||
<td style="padding: 10px 16px; font-family: monospace; font-size: 13px; font-weight: 700;">{{ eflex.reference }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; background: #f9fafb;">Echeance</td>
|
||||
<td style="padding: 10px 16px; font-size: 13px; font-weight: 700;">{{ line.label }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; background: #f9fafb;">Montant</td>
|
||||
<td style="padding: 10px 16px; font-family: monospace; font-size: 16px; font-weight: 700; color: #16a34a;">{{ line.amount|number_format(2, ',', ' ') }} €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; background: #f9fafb;">Methode</td>
|
||||
<td style="padding: 10px 16px; font-size: 13px; font-weight: 700;">{{ methodLabel }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; background: #f9fafb;">Date de paiement</td>
|
||||
<td style="padding: 10px 16px; font-size: 13px;">{{ line.paidAt ? line.paidAt|date('d/m/Y') : 'Aujourd\'hui' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; background: #f9fafb;">Progression</td>
|
||||
<td style="padding: 10px 16px; font-size: 13px; font-weight: 700;">{{ eflex.nbPaid }}/{{ eflex.nbLines }} echeances payees ({{ eflex.progress }}%)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% if eflex.nbPaid >= eflex.nbLines %}
|
||||
<div style="background: #f0fdf4; border: 1px solid #bbf7d0; padding: 12px 16px; margin: 16px 0;">
|
||||
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: 700; color: #16a34a; margin: 0;">
|
||||
Toutes les echeances ont ete payees. Votre contrat E-Flex est termine.
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #9ca3af; margin: 16px 0 0;">
|
||||
Pour toute question : <a href="mailto:contact@e-cosplay.fr" style="color: #fabf04;">contact@e-cosplay.fr</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user