feat(FlowController): Ajoute la soumission DocuSeal et l'envoi d'email après la génération du devis.

This commit is contained in:
Serreau Jovann
2026-02-05 10:20:27 +01:00
parent e33fc7eb47
commit ff67f1fc68

View File

@@ -6,14 +6,17 @@ use App\Entity\CustomerAddress;
use App\Entity\Devis;
use App\Entity\DevisLine;
use App\Entity\DevisOptions;
use App\Event\Signature\DevisSend;
use App\Logger\AppLogger;
use App\Repository\DevisRepository;
use App\Repository\OptionsRepository;
use App\Repository\OrderSessionRepository;
use App\Repository\ProductRepository;
use App\Service\Pdf\DevisPdfService;
use App\Service\Signature\Client;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -31,7 +34,9 @@ class FlowController extends AbstractController
private readonly DevisRepository $devisRepository,
private readonly ProductRepository $productRepository,
private readonly OptionsRepository $optionsRepository,
private readonly KernelInterface $kernel
private readonly KernelInterface $kernel,
private readonly Client $signatureClient,
private readonly EventDispatcherInterface $eventDispatcher
) {
}
@@ -241,6 +246,13 @@ class FlowController extends AbstractController
$this->savePdfFile($devis, $devisService->generate(), 'devis_', 'setDevisFile');
$em->flush();
// 10. DocuSeal Submission
$this->signatureClient->createSubmissionDevis($devis);
// 11. Send Email
$this->eventDispatcher->dispatch(new DevisSend($devis));
} catch (\Exception $e) {
$this->appLogger->record('ERROR', 'Erreur génération PDF Devis auto: ' . $e->getMessage());
}