src/Services/Filter.php line 395

Open in your IDE?
  1. <?php
  2. namespace App\Services;
  3. use DateTime;
  4. use App\Entity\User;
  5. use App\Entity\Ticket;
  6. use App\Entity\Chambre;
  7. use App\Entity\Annonce;
  8. use App\Entity\Caution;
  9. use App\Entity\Command;
  10. use App\Entity\Company;
  11. use App\Entity\Product;
  12. use App\Entity\Transporteur;
  13. use App\Repository\AvisRepository;
  14. use App\Repository\UserRepository;
  15. use App\Repository\PhotosRepository;
  16. use App\Repository\TicketRepository;
  17. use App\Repository\CautionRepository;
  18. use App\Repository\CommandRepository;
  19. use App\Repository\CompanyRepository;
  20. use App\Repository\ProductRepository;
  21. use App\Repository\LocationRepository;
  22. use App\Repository\WishListRepository;
  23. use App\Repository\MessagingRepository;
  24. use App\Repository\AbonnementRepository;
  25. use App\Repository\DepartmentRepository;
  26. use Doctrine\ORM\EntityManagerInterface;
  27. use App\Repository\SubCategoryRepository;
  28. use App\Repository\TransporteurRepository;
  29. use App\Repository\ProductOptionRepository;
  30. use App\Repository\AnnonceCompanyRepository;
  31. use App\Repository\CommandProductRepository;
  32. use App\Repository\ContactProductRepository;
  33. use App\Repository\TransporteurWeightPriceRepository;
  34. use Psr\Log\LoggerInterface;
  35. use Stripe\Charge;
  36. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  37. class Filter
  38. {
  39.    /**
  40.     * @var DepartmentRepository
  41.     */
  42.    private $departmentRepository;
  43.    /**
  44.     * @var SubCategoryRepository
  45.     */
  46.    private $subCategoryRepository;
  47.    /**
  48.     * @var CommandRepository
  49.     */
  50.    private $commandRepository;
  51.    /**
  52.     * @var ProductRepository
  53.     */
  54.    private $productRepository;
  55.    /**
  56.     * @var AvisRepository
  57.     */
  58.    private $avisRepository;
  59.    /**
  60.     * @var CommandProductRepository
  61.     */
  62.    private $commandProductRepository;
  63.    /**
  64.     * @var WishListRepository
  65.     */
  66.    private $wishListRepository;
  67.    /**
  68.     * @var MessagingRepository
  69.     */
  70.    private $messagingRepository;
  71.    /**
  72.     * @var TicketRepository
  73.     */
  74.    private $ticketRepository;
  75.    /**
  76.     * @var ContactProductRepository
  77.     */
  78.    private $contactProductRepository;
  79.    /**
  80.     * @var ProductOptionRepository
  81.     */
  82.    private $productOptionRepository;
  83.    /**
  84.     * @var TransporteurWeightPriceRepository
  85.     */
  86.    private $transporteurWeightPriceRepository;
  87.    /**
  88.     * @var TransporteurRepository
  89.     */
  90.    private $transporteurRepository;
  91.    /**
  92.     * @var PhotosRepository
  93.     */
  94.    private $photosRepository;
  95.    /**
  96.     * @var AbonnementRepository
  97.     */
  98.    private $abonnementRepository;
  99.    /**
  100.     * @var CompanyRepository
  101.     */
  102.    private $companyRepository;
  103.    /**
  104.     * @var UserRepository
  105.     */
  106.    private $userRepository;
  107.    /**
  108.     * @var MangoPayService
  109.     */
  110.    private $mangoPayService;
  111.    /**
  112.     * @var LocationRepository
  113.     */
  114.    private $locationRepository;
  115.    /**
  116.     * @var CautionRepository
  117.     */
  118.    private $caution;
  119.    /**
  120.     * @var StripeConnectService
  121.     */
  122.    private $stripeConnectService;
  123.    private $em;
  124.    private LoggerInterface $logger;
  125.    public function __construct(
  126.       TicketRepository $ticketRepository,
  127.       WishListRepository $wishListRepository,
  128.       CommandProductRepository $commandProductRepository,
  129.       AvisRepository $avisRepository,
  130.       ProductRepository $productRepository,
  131.       DepartmentRepository $departmentRepository,
  132.       SubCategoryRepository $subCategoryRepository,
  133.       CommandRepository $commandRepository,
  134.       MessagingRepository $messagingRepository,
  135.       ContactProductRepository $contactProductRepository,
  136.       ProductOptionRepository $productOptionRepository,
  137.       TransporteurRepository $transporteurRepository,
  138.       TransporteurWeightPriceRepository $transporteurWeightPriceRepository,
  139.       PhotosRepository $photosRepository,
  140.       AbonnementRepository $abonnementRepository,
  141.       CompanyRepository $companyRepository,
  142.       UserRepository $userRepository,
  143.       MangoPayService $mangoPayService,
  144.       LocationRepository $locationRepository,
  145.       CautionRepository $caution,
  146.       EntityManagerInterface $em,
  147.       StripeConnectService $stripeConnectService,
  148.       LoggerInterface $logger
  149.    ) {
  150.       $this->departmentRepository $departmentRepository;
  151.       $this->subCategoryRepository $subCategoryRepository;
  152.       $this->commandRepository $commandRepository;
  153.       $this->productRepository $productRepository;
  154.       $this->avisRepository $avisRepository;
  155.       $this->commandProductRepository $commandProductRepository;
  156.       $this->wishListRepository $wishListRepository;
  157.       $this->messagingRepository $messagingRepository;
  158.       $this->ticketRepository $ticketRepository;
  159.       $this->contactProductRepository $contactProductRepository;
  160.       $this->productOptionRepository $productOptionRepository;
  161.       $this->transporteurWeightPriceRepository $transporteurWeightPriceRepository;
  162.       $this->transporteurRepository $transporteurRepository;
  163.       $this->photosRepository $photosRepository;
  164.       $this->abonnementRepository $abonnementRepository;
  165.       $this->companyRepository $companyRepository;
  166.       $this->userRepository $userRepository;
  167.       $this->mangoPayService $mangoPayService;
  168.       $this->locationRepository $locationRepository;
  169.       $this->caution $caution;
  170.       $this->stripeConnectService $stripeConnectService;
  171.       $this->em $em;
  172.       $this->logger $logger;
  173.    }
  174.    public function getDepartments()
  175.    {
  176.       return $this->departmentRepository->getDepartmentsIfProduct();
  177.    }
  178.    public function getSubcategories()
  179.    {
  180.       return $this->subCategoryRepository->findBy([], ['id' => 'DESC']);
  181.    }
  182.    public function filterActiveProducts($products)
  183.    {
  184.       return $products->filter(function ($product) {
  185.          // Check if the product and its related entities meet all the conditions
  186.          $company $product->getCompany();
  187.          $subCategories $product->getSubCategories();
  188.          // Apply the same conditions as in the findAllServices method
  189.          return
  190.             $product->getIsActivated() &&
  191.             !$product->getIsDesactivatedByAdmin() &&
  192.             $company && $company->getIsConfirmed() &&
  193.             $company->getIsValidDocument() &&
  194.             $subCategories->exists(function ($key$subCategory) {
  195.                return $subCategory->getIsService() || !$subCategory->getIsService();
  196.             });
  197.       })->count();
  198.    }
  199.    public function getCommandsByCompany(Company $company)
  200.    {
  201.       return $this->commandRepository->getCommandsByCompany($company);
  202.    }
  203.    public function getOtherProducts(Product $product)
  204.    {
  205.       return $this->productRepository->getOtherProductsCompany($product);
  206.    }
  207.    public function getOtherProductsCompany(Company $company)
  208.    {
  209.       return $this->productRepository->getOtherProductsByCompany($company);
  210.    }
  211.    public function getAvisUserExist(User $userProduct $product)
  212.    {
  213.       $isExist $this->avisRepository->findOneBy(['client' => $user'product' => $product]);
  214.       if (!$isExist) {
  215.          return false;
  216.       }
  217.       return true;
  218.    }
  219.    public function getIfCommandNotFinish(Command $commandCompany $company)
  220.    {
  221.       $commandProducts $this->commandProductRepository->getCommandCompanyNotFinish($command$company);
  222.       return count($commandProducts);
  223.    }
  224.    public function getIfIsWish(User $userProduct $product)
  225.    {
  226.       $isWish =  $this->wishListRepository->findOneBy(['user' => $user'product' => $product]);
  227.       if ($isWish) {
  228.          return true;
  229.       }
  230.       return false;
  231.    }
  232.    public function getMessagingByTicket(Ticket $ticket)
  233.    {
  234.       return $this->messagingRepository->findBy(['ticket' => $ticket]);
  235.    }
  236.    public function getTicketIsNew(Company $company)
  237.    {
  238.       $tickets $this->ticketRepository->getTicketsByProductsIsNew($company);
  239.       if (empty($tickets)) {
  240.          return false;
  241.       }
  242.       return true;
  243.    }
  244.    public function getTicketIsNewForClient(User $user)
  245.    {
  246.       $tickets $this->ticketRepository->getTicketsByProductsIsNewForClient($user);
  247.       if (empty($tickets)) {
  248.          return false;
  249.       }
  250.       return true;
  251.    }
  252.    public function getTicketIsNewByTicket(Ticket $ticket)
  253.    {
  254.       $tickets $this->ticketRepository->getTicketsIsNewByTicket($ticket);
  255.       if (!$tickets) {
  256.          return false;
  257.       }
  258.       return true;
  259.    }
  260.    public function getTicketIsNewByTicketForClient(Ticket $ticket)
  261.    {
  262.       $tickets $this->ticketRepository->getTicketsIsNewByTicketForClient($ticket);
  263.       if (!$tickets) {
  264.          return false;
  265.       }
  266.       return true;
  267.    }
  268.    public function getNotifsContactProduct(Company $company)
  269.    {
  270.       $contactsProduct $this->contactProductRepository->getNotifContactsProduct($company);
  271.       if (!$contactsProduct) {
  272.          return false;
  273.       }
  274.       return true;
  275.    }
  276.    public function getProductOption(int $id)
  277.    {
  278.       return $this->productOptionRepository->find($id);
  279.    }
  280.    public function getProductOptionByProduit(Product $product)
  281.    {
  282.       return $this->productOptionRepository->findProduitOptionByProduit($product);
  283.    }
  284.    public function getTransporteurWeightByWeight(?string $weight)
  285.    {
  286.       if ($weight === null) {
  287.          return null;
  288.       }
  289.       return $this->transporteurWeightPriceRepository->getTransporteursPriceByWeight($weight);
  290.    }
  291.    public function getTransporteurWeightById(int $id)
  292.    {
  293.       return $this->transporteurWeightPriceRepository->getTransporteurWeightById($id);
  294.    }
  295.    public function getByTransporteurAndWeight(Transporteur $transporteurstring $weightint $quantity)
  296.    {
  297.       $weightInInt str_replace('g'''$weight);
  298.       $weightInInt = (int) str_replace('kg'''$weightInInt);
  299.       $totalWeight $weightInInt $quantity;
  300.       $totalWeightString $this->calculWeightQuantity($totalWeight$quantity);
  301.       $transporteurObject $this->transporteurWeightPriceRepository->getByTransporteurAndWeight($transporteur$totalWeightString);
  302.       if (!$transporteurObject) {
  303.          $transporteurObject null;
  304.          for ($i $totalWeight$i <= 30$i++) {
  305.             $totalWeightString $this->calculWeightQuantity($i$quantity);
  306.             $transporteurObject $this->transporteurWeightPriceRepository->getByTransporteurAndWeight($transporteur$totalWeightString);
  307.             if ($transporteurObject) {
  308.                break;
  309.             }
  310.          }
  311.       }
  312.       return $transporteurObject;
  313.    }
  314.    public function calculWeightQuantity(string $totalWeightint $quantity)
  315.    {
  316.       if ($totalWeight == 250 || $totalWeight == 500) {
  317.          $totalWeight $totalWeight 'g';
  318.       } elseif ($totalWeight >= 1000) {
  319.          $totalWeight = ($totalWeight 1000) . 'kg';
  320.       } else {
  321.          $totalWeight $totalWeight 'kg';
  322.       }
  323.       return $totalWeight;
  324.    }
  325.    public function limite_motsafficher(string $texteint $longeur_max)
  326.    {
  327.       if (strlen($texte) > $longeur_max) {
  328.          $texte substr($texte0$longeur_max);
  329.          $dernier_espace strrpos($texte" ");
  330.          $texte substr($texte0$dernier_espace) . "...";
  331.       }
  332.       return $texte;
  333.    }
  334.    public function getphotoProduit(Product $product)
  335.    {
  336.       $image $this->photosRepository->findOneBy(['product' => $product]);
  337.       return $image->getUrl();
  338.    }
  339.    public function getCompanyAbonnee(Company $company)
  340.    {
  341.       $companyAbonne $this->abonnementRepository->findBy(['company' => $company]);
  342.       return $companyAbonne;
  343.    }
  344.    public function getCompany()
  345.    {
  346.       $company $this->companyRepository->findBy(['isConfirmed' => true'isValidDocument' => true]);
  347.       return $company;
  348.    }
  349.    public function getPhotounProductsCompany(Company $company)
  350.    {
  351.       return $this->productRepository->getPhotoProductsByCompany($company);
  352.    }
  353.    public function getCompanyAvoirProduit(Product $product)
  354.    {
  355.       return $this->companyRepository->CompanyAvoirProduit($product);
  356.    }
  357.    public function getProducttous(Company $company)
  358.    {
  359.       $produits $this->productRepository->getAllProductsByCompany($company);
  360.       return $produits;
  361.    }
  362.    public function getproductById($id)
  363.    {
  364.       return $this->productRepository->findOneBy(['id' => $id]);
  365.    }
  366.    public function recuperUrlMercure()
  367.    {
  368.       return ['mercureHubUrl' => $_ENV['MERCURE_PUBLISH_URL'], 'mercureClientUrl' => $_ENV['MERCURE_DISC_PUBLISH_URL_TWO']];
  369.    }
  370.    public function conterNewMessage($tickets$nbrmessage)
  371.    {
  372.       foreach ($tickets as $ticket) {
  373.          $nb 0;
  374.          foreach ($nbrmessage as $nbrsms) {
  375.             $nb $ticket->getId() == $nbrsms['id'] ? $nbrsms['nbmessage'] : $nb;
  376.             $ticket->setNbMessage($nb);
  377.          }
  378.       }
  379.       return $tickets;
  380.    }
  381.    public function diferenceetredate($network)
  382.    {
  383.       $datej = new DateTime('now');
  384.       $difd $network->diff($datej);
  385.       return $res $difd->true false;
  386.    }
  387.    public function voirDestinataire(Ticket $ticket$utilisateur)
  388.    {
  389.       $destinataire "";
  390.       if ($ticket->getProduct()) {
  391.          if ($ticket->getCreatedBy()->getId() == $utilisateur->getId()) {
  392.             $destinataire $ticket->getProduct()->getCompany();
  393.          } else {
  394.             $destinataire $ticket->getCreatedBy();
  395.          }
  396.       } else {
  397.          $resultats $this->ticketRepository->getDestinataire($ticket)[0];
  398.          if ($resultats['DestinataireId'] == $utilisateur->getId()) {
  399.             if ($ticket->getTypeExpeditaire() == 'client') {
  400.                $destinataire $this->userRepository->findOneById($resultats['expeditaireId']);
  401.             } else {
  402.                $destinataire $this->companyRepository->findOneById($resultats['expeditaireId']);
  403.             }
  404.          } else {
  405.             if ($ticket->getTypeDestinataire() == 'client') {
  406.                $destinataire $this->userRepository->findOneById($resultats['DestinataireId']);
  407.             } else {
  408.                $destinataire $this->companyRepository->findOneById($resultats['DestinataireId']);
  409.             }
  410.          }
  411.       }
  412.       return $destinataire;
  413.    }
  414.    public function getLocationUse(User $userProduct $produit)
  415.    {
  416.       $location $this->locationRepository->getLocationByClientProduit($user$produit) ?? null;
  417.       return $location[0] ?? null;
  418.    }
  419.    public function retour_caution()
  420.    {
  421.       $dateDuJour = new DateTime();
  422.       $cautions $this->caution->findBy(['isTrancefert' => null'isReturn' => null]);
  423.       
  424.       foreach ($cautions as $key => $caution) {
  425.          $datedif date_diff($dateDuJour$caution->getLocation()->getEndAt())->format('%a') + 1;
  426.          $location $caution->getLocation();
  427.          $locationAppFee $location->getAppFees()->first() ?? null;
  428.          
  429.          if ($datedif >= 15) {
  430.             $montant $caution->getMontant();
  431.             try {
  432.                if ($locationAppFee != null) {
  433.                   $locationCharge $this->retrieveCautionCharge($caution);
  434.                   
  435.                   if ($locationCharge) {
  436.                      if ($locationCharge->application_fee) {
  437.                         $this->stripeConnectService->refundApplicationFee($locationCharge->application_fee$montant 100);
  438.                         $caution->setIsReturn(true);
  439.                      } else {
  440.                         $this->logger->error('Aucun commission trouvée pour la caution ID ' $caution->getId());
  441.                      }
  442.                   } else {
  443.                      $this->logger->error('Aucun charge trouvé pour la caution ID ' $caution->getId());
  444.                   }
  445.                   
  446.                }
  447.             } catch (\Throwable $th) {
  448.                $this->logger->error('Erreur lors du remboursement de la caution ID ' $caution->getId() . ' : ' $th->getMessage());
  449.                continue; // Passer à la caution suivante en cas d'erreur
  450.             }
  451.             $this->em->persist($caution);
  452.             $this->em->flush();
  453.          }
  454.       }
  455.    }
  456.    function getParticipantByRoom(Chambre $chambre)
  457.    {
  458.       $participant $chambre->getParticipant()->toArray();
  459.       // $participantByRoom = [];
  460.       // foreach ($participant as $key => $value) {
  461.       //     if ($value->getUserClient() == $user) {
  462.       //         $participantByRoom[] = $value;
  463.       //     }
  464.       // }
  465.       // return $participantByRoom;
  466.       return $participant;
  467.    }
  468.    public function geolocation($department)
  469.    {
  470.       $lat null;
  471.       $lng null;
  472.       if ($department) {
  473.          $address $department;
  474.          $prepAddr str_replace(' ''+'$address);
  475.          $url 'https://maps.googleapis.com/maps/api/geocode/json?address=' $prepAddr '&key=AIzaSyDEvz8MLiFhskwnuRnoZ-OR_ZOUS9ol3Bg';
  476.          $source file_get_contents($url);
  477.          $obj json_decode($source);
  478.          if ($obj->status == 'OK') {
  479.             $status $obj->status;
  480.             $lat $obj->results[0]->geometry->location->lat;
  481.             $lng $obj->results[0]->geometry->location->lng;
  482.          } else {
  483.             $lat 48.856614;
  484.             $lng 2.3522219;
  485.             $status $obj->status;
  486.          }
  487.       } else {
  488.          $address 'France';
  489.          $prepAddr str_replace(' ''+'$address);
  490.          $url 'https://maps.googleapis.com/maps/api/geocode/json?address=' $prepAddr '&key=AIzaSyDEvz8MLiFhskwnuRnoZ-OR_ZOUS9ol3Bg';
  491.          $source file_get_contents($url);
  492.          $obj json_decode($source);
  493.          if ($obj->status == 'OK') {
  494.             $status $obj->status;
  495.             $lat $obj->results[0]->geometry->location->lat;
  496.             $lng $obj->results[0]->geometry->location->lng;
  497.          } else {
  498.             $lat 48.856614;
  499.             $lng 2.3522219;
  500.             $status $obj->status;
  501.          }
  502.       }
  503.       $coordinates = [$lat$lng$status];
  504.       return $coordinates;
  505.    }
  506.    public function listecouleurs()
  507.    {
  508.       return $listes =
  509.          [
  510.             [
  511.                "name" => "Abricot"
  512.             ],
  513.             [
  514.                "name" => "Acajou"
  515.             ],
  516.             [
  517.                "name" => "Aigue-marine"
  518.             ],
  519.             [
  520.                "name" => "Alezan (chevaux)"
  521.             ],
  522.             [
  523.                "name" => "Amande"
  524.             ],
  525.             [
  526.                "name" => "Amarante"
  527.             ],
  528.             [
  529.                "name" => "Ambre"
  530.             ],
  531.             [
  532.                "name" => "Améthyste"
  533.             ],
  534.             [
  535.                "name" => "Anthracite"
  536.             ],
  537.             [
  538.                "name" => "Aquilain (chevaux)"
  539.             ],
  540.             [
  541.                "name" => "Ardoise"
  542.             ],
  543.             [
  544.                "name" => "Argent (héraldique)"
  545.             ],
  546.             [
  547.                "name" => "Aubergine"
  548.             ],
  549.             [
  550.                "name" => "Auburn (cheveux)"
  551.             ],
  552.             [
  553.                "name" => "Aurore"
  554.             ],
  555.             [
  556.                "name" => "Avocat"
  557.             ],
  558.             [
  559.                "name" => "Azur"
  560.             ],
  561.             [
  562.                "name" => "Azur (héraldique)"
  563.             ],
  564.             [
  565.                "name" => "Baillet (chevaux, vieilli)"
  566.             ],
  567.             [
  568.                "name" => "Basané (teint)"
  569.             ],
  570.             [
  571.                "name" => "Beige ou Bureau"
  572.             ],
  573.             [
  574.                "name" => "Beurre"
  575.             ],
  576.             [
  577.                "name" => "Bis"
  578.             ],
  579.             [
  580.                "name" => "Bisque"
  581.             ],
  582.             [
  583.                "name" => "Bistre"
  584.             ],
  585.             [
  586.                "name" => "Bitume (pigment)"
  587.             ],
  588.             [
  589.                "name" => "Blanc"
  590.             ],
  591.             [
  592.                "name" => "Blanc cassé"
  593.             ],
  594.             [
  595.                "name" => "Blanc lunaire"
  596.             ],
  597.             [
  598.                "name" => "Blé"
  599.             ],
  600.             [
  601.                "name" => "Bleu"
  602.             ],
  603.             [
  604.                "name" => "Bleu acier"
  605.             ],
  606.             [
  607.                "name" => "Bleu barbeau ou bleuet"
  608.             ],
  609.             [
  610.                "name" => "Bleu canard"
  611.             ],
  612.             [
  613.                "name" => "Bleu céleste"
  614.             ],
  615.             [
  616.                "name" => "Bleu charrette"
  617.             ],
  618.             [
  619.                "name" => "Bleu ciel"
  620.             ],
  621.             [
  622.                "name" => "Bleu de cobalt (pigment)"
  623.             ],
  624.             [
  625.                "name" => "Bleu de Prusse (pigment), de Berlin ou bleu hussard"
  626.             ],
  627.             [
  628.                "name" => "Bleu électrique"
  629.             ],
  630.             [
  631.                "name" => "Bleu givré"
  632.             ],
  633.             [
  634.                "name" => "Bleu Klein"
  635.             ],
  636.             [
  637.                "name" => "Bleu Majorelle"
  638.             ],
  639.             [
  640.                "name" => "Bleu marine"
  641.             ],
  642.             [
  643.                "name" => "Bleu nuit"
  644.             ],
  645.             [
  646.                "name" => "Bleu outremer"
  647.             ],
  648.             [
  649.                "name" => "Bleu paon"
  650.             ],
  651.             [
  652.                "name" => "Bleu Persan"
  653.             ],
  654.             [
  655.                "name" => "Bleu pétrole"
  656.             ],
  657.             [
  658.                "name" => "Bleu roi ou de France"
  659.             ],
  660.             [
  661.                "name" => "Bleu turquin"
  662.             ],
  663.             [
  664.                "name" => "Blond (cheveux)"
  665.             ],
  666.             [
  667.                "name" => "Blond vénitien (cheveux)"
  668.             ],
  669.             [
  670.                "name" => "Bordeaux"
  671.             ],
  672.             [
  673.                "name" => "Bouton d'or"
  674.             ],
  675.             [
  676.                "name" => "Brique"
  677.             ],
  678.             [
  679.                "name" => "Bronze"
  680.             ],
  681.             [
  682.                "name" => "Brou de noix"
  683.             ],
  684.             [
  685.                "name" => "Brun"
  686.             ],
  687.             [
  688.                "name" => "Caca d'oie"
  689.             ],
  690.             [
  691.                "name" => "Cacao"
  692.             ],
  693.             [
  694.                "name" => "Cachou (pigments)"
  695.             ],
  696.             [
  697.                "name" => "Cæruleum"
  698.             ],
  699.             [
  700.                "name" => "Café"
  701.             ],
  702.             [
  703.                "name" => "Café au lait"
  704.             ],
  705.             [
  706.                "name" => "Cannelle"
  707.             ],
  708.             [
  709.                "name" => "Capucine"
  710.             ],
  711.             [
  712.                "name" => "Caramel (pigments)"
  713.             ],
  714.             [
  715.                "name" => "Carmin (pigment)"
  716.             ],
  717.             [
  718.                "name" => "Carmin d'alizarine (pigment PR83)"
  719.             ],
  720.             [
  721.                "name" => "Carotte"
  722.             ],
  723.             [
  724.                "name" => "Chamois"
  725.             ],
  726.             [
  727.                "name" => "Chartreuse"
  728.             ],
  729.             [
  730.                "name" => "Châtain (cheveux)"
  731.             ],
  732.             [
  733.                "name" => "Chaudron"
  734.             ],
  735.             [
  736.                "name" => "Chocolat"
  737.             ],
  738.             [
  739.                "name" => "Cinabre (pigment)"
  740.             ],
  741.             [
  742.                "name" => "Citrouille"
  743.             ],
  744.             [
  745.                "name" => "Coquille d'œuf"
  746.             ],
  747.             [
  748.                "name" => "Corail"
  749.             ],
  750.             [
  751.                "name" => "Cramoisi"
  752.             ],
  753.             [
  754.                "name" => "Crème"
  755.             ],
  756.             [
  757.                "name" => "Cuisse de nymphe"
  758.             ],
  759.             [
  760.                "name" => "Cuivre"
  761.             ],
  762.             [
  763.                "name" => "Cyan"
  764.             ],
  765.             [
  766.                "name" => "Écarlate"
  767.             ],
  768.             [
  769.                "name" => "Écru"
  770.             ],
  771.             [
  772.                "name" => "Émeraude"
  773.             ],
  774.             [
  775.                "name" => "Fauve"
  776.             ],
  777.             [
  778.                "name" => "Flave"
  779.             ],
  780.             [
  781.                "name" => "Fraise"
  782.             ],
  783.             [
  784.                "name" => "Fraise écrasée"
  785.             ],
  786.             [
  787.                "name" => "Framboise"
  788.             ],
  789.             [
  790.                "name" => "Fuchsia"
  791.             ],
  792.             [
  793.                "name" => "Fumée"
  794.             ],
  795.             [
  796.                "name" => "Garance (pigment)"
  797.             ],
  798.             [
  799.                "name" => "Glauque"
  800.             ],
  801.             [
  802.                "name" => "Glycine"
  803.             ],
  804.             [
  805.                "name" => "Grège"
  806.             ],
  807.             [
  808.                "name" => "Grenadine"
  809.             ],
  810.             [
  811.                "name" => "Grenat"
  812.             ],
  813.             [
  814.                "name" => "Gris"
  815.             ],
  816.             [
  817.                "name" => "Gris acier"
  818.             ],
  819.             [
  820.                "name" => "Gris de Payne (mélange de pigments)"
  821.             ],
  822.             [
  823.                "name" => "Gris fer"
  824.             ],
  825.             [
  826.                "name" => "Gris perle"
  827.             ],
  828.             [
  829.                "name" => "Groseille"
  830.             ],
  831.             [
  832.                "name" => "Guède ou Pastel des teinturiers (pigment)"
  833.             ],
  834.             [
  835.                "name" => "Gueules (héraldique)"
  836.             ],
  837.             [
  838.                "name" => "Héliotrope"
  839.             ],
  840.             [
  841.                "name" => "Incarnat"
  842.             ],
  843.             [
  844.                "name" => "Indigo"
  845.             ],
  846.             [
  847.                "name" => "Indigo (teinture)"
  848.             ],
  849.             [
  850.                "name" => "Isabelle"
  851.             ],
  852.             [
  853.                "name" => "Ivoire"
  854.             ],
  855.             [
  856.                "name" => "Jaune"
  857.             ],
  858.             [
  859.                "name" => "Jaune canari"
  860.             ],
  861.             [
  862.                "name" => "Jaune citron"
  863.             ],
  864.             [
  865.                "name" => "Jaune d'or"
  866.             ],
  867.             [
  868.                "name" => "Jaune de cobalt ou auréolin (pigment)"
  869.             ],
  870.             [
  871.                "name" => "Jaune de Mars (pigment)"
  872.             ],
  873.             [
  874.                "name" => "Jaune de Naples (pigment)"
  875.             ],
  876.             [
  877.                "name" => "Jaune impérial"
  878.             ],
  879.             [
  880.                "name" => "Jaune mimosa"
  881.             ],
  882.             [
  883.                "name" => "Kaki"
  884.             ],
  885.             [
  886.                "name" => "Lapis-lazuli"
  887.             ],
  888.             [
  889.                "name" => "Lavallière (reliure)"
  890.             ],
  891.             [
  892.                "name" => "Lavande"
  893.             ],
  894.             [
  895.                "name" => "Lie de vin"
  896.             ],
  897.             [
  898.                "name" => "Lilas"
  899.             ],
  900.             [
  901.                "name" => "Lime ou vert citron"
  902.             ],
  903.             [
  904.                "name" => "Lin"
  905.             ],
  906.             [
  907.                "name" => "Magenta"
  908.             ],
  909.             [
  910.                "name" => "Maïs"
  911.             ],
  912.             [
  913.                "name" => "Malachite"
  914.             ],
  915.             [
  916.                "name" => "Mandarine"
  917.             ],
  918.             [
  919.                "name" => "Marron"
  920.             ],
  921.             [
  922.                "name" => "Mastic"
  923.             ],
  924.             [
  925.                "name" => "Mauve (couleur)"
  926.             ],
  927.             [
  928.                "name" => "Menthe"
  929.             ],
  930.             [
  931.                "name" => "Moutarde"
  932.             ],
  933.             [
  934.                "name" => "Nacarat"
  935.             ],
  936.             [
  937.                "name" => "Nankin"
  938.             ],
  939.             [
  940.                "name" => "Noir"
  941.             ],
  942.             [
  943.                "name" => "Noir animal (pigment)"
  944.             ],
  945.             [
  946.                "name" => "Noir d'aniline (pigment)"
  947.             ],
  948.             [
  949.                "name" => "Noir d'ivoire (pigment)"
  950.             ],
  951.             [
  952.                "name" => "Noir de carbone (pigment)"
  953.             ],
  954.             [
  955.                "name" => "Noir de fumée (pigment)"
  956.             ],
  957.             [
  958.                "name" => "Noisette"
  959.             ],
  960.             [
  961.                "name" => "Ocre (pigment)"
  962.             ],
  963.             [
  964.                "name" => "Ocre rouge (pigment)"
  965.             ],
  966.             [
  967.                "name" => "Olive"
  968.             ],
  969.             [
  970.                "name" => "Or"
  971.             ],
  972.             [
  973.                "name" => "Orange"
  974.             ],
  975.             [
  976.                "name" => "Orange brûlé"
  977.             ],
  978.             [
  979.                "name" => "Orchidée"
  980.             ],
  981.             [
  982.                "name" => "Orpiment (pigment)"
  983.             ],
  984.             [
  985.                "name" => "Paille"
  986.             ],
  987.             [
  988.                "name" => "Parme"
  989.             ],
  990.             [
  991.                "name" => "Pelure d'oignon (œnologie)"
  992.             ],
  993.             [
  994.                "name" => "Pervenche"
  995.             ],
  996.             [
  997.                "name" => "Pistache"
  998.             ],
  999.             [
  1000.                "name" => "Poil de chameau"
  1001.             ],
  1002.             [
  1003.                "name" => "Ponceau ou Coquelicot"
  1004.             ],
  1005.             [
  1006.                "name" => "Pourpre (héraldique)"
  1007.             ],
  1008.             [
  1009.                "name" => "Prasin"
  1010.             ],
  1011.             [
  1012.                "name" => "Prune"
  1013.             ],
  1014.             [
  1015.                "name" => "Puce"
  1016.             ],
  1017.             [
  1018.                "name" => "Rose"
  1019.             ],
  1020.             [
  1021.                "name" => "Rose Mountbatten"
  1022.             ],
  1023.             [
  1024.                "name" => "Rouge"
  1025.             ],
  1026.             [
  1027.                "name" => "Rouge anglais"
  1028.             ],
  1029.             [
  1030.                "name" => "Rouge cardinal"
  1031.             ],
  1032.             [
  1033.                "name" => "Rouge cerise"
  1034.             ],
  1035.             [
  1036.                "name" => "Rouge d'Andrinople"
  1037.             ],
  1038.             [
  1039.                "name" => "Rouge de Falun (pigment)"
  1040.             ],
  1041.             [
  1042.                "name" => "Rouge feu"
  1043.             ],
  1044.             [
  1045.                "name" => "Rouge feu"
  1046.             ],
  1047.             [
  1048.                "name" => "Rouge sang"
  1049.             ],
  1050.             [
  1051.                "name" => "Rouge tomette"
  1052.             ],
  1053.             [
  1054.                "name" => "Rouille"
  1055.             ],
  1056.             [
  1057.                "name" => "Roux"
  1058.             ],
  1059.             [
  1060.                "name" => "Rubis"
  1061.             ],
  1062.             [
  1063.                "name" => "Sable"
  1064.             ],
  1065.             [
  1066.                "name" => "Sable (héraldique)"
  1067.             ],
  1068.             [
  1069.                "name" => "Safre"
  1070.             ],
  1071.             [
  1072.                "name" => "Sang de bœuf"
  1073.             ],
  1074.             [
  1075.                "name" => "Sanguine"
  1076.             ],
  1077.             [
  1078.                "name" => "Saphir"
  1079.             ],
  1080.             [
  1081.                "name" => "Sarcelle"
  1082.             ],
  1083.             [
  1084.                "name" => "Saumon"
  1085.             ],
  1086.             [
  1087.                "name" => "Sépia (pigment)"
  1088.             ],
  1089.             [
  1090.                "name" => "Sinople (héraldique)"
  1091.             ],
  1092.             [
  1093.                "name" => "Smalt (pigment)"
  1094.             ],
  1095.             [
  1096.                "name" => "Smaragdin (pigment)"
  1097.             ],
  1098.             [
  1099.                "name" => "Soufre"
  1100.             ],
  1101.             [
  1102.                "name" => "Souris"
  1103.             ],
  1104.             [
  1105.                "name" => "Tabac"
  1106.             ],
  1107.             [
  1108.                "name" => "Taupe"
  1109.             ],
  1110.             [
  1111.                "name" => "Terre d'ombre"
  1112.             ],
  1113.             [
  1114.                "name" => "Terre de Sienne (pigment)"
  1115.             ],
  1116.             [
  1117.                "name" => "Terre de Sienne brûlée (pigment)"
  1118.             ],
  1119.             [
  1120.                "name" => "Tomate"
  1121.             ],
  1122.             [
  1123.                "name" => "Topaze"
  1124.             ],
  1125.             [
  1126.                "name" => "Tourterelle ou Colombin"
  1127.             ],
  1128.             [
  1129.                "name" => "Turquoise"
  1130.             ],
  1131.             [
  1132.                "name" => "Vanille"
  1133.             ],
  1134.             [
  1135.                "name" => "Vermeil"
  1136.             ],
  1137.             [
  1138.                "name" => "Vermillon"
  1139.             ],
  1140.             [
  1141.                "name" => "Vert"
  1142.             ],
  1143.             [
  1144.                "name" => "Vert bouteille"
  1145.             ],
  1146.             [
  1147.                "name" => "Vert céladon"
  1148.             ],
  1149.             [
  1150.                "name" => "Vert d'eau"
  1151.             ],
  1152.             [
  1153.                "name" => "Vert de chrome"
  1154.             ],
  1155.             [
  1156.                "name" => "Vert de Hooker"
  1157.             ],
  1158.             [
  1159.                "name" => "Vert de vessie"
  1160.             ],
  1161.             [
  1162.                "name" => "Vert épinard"
  1163.             ],
  1164.             [
  1165.                "name" => "Vert impérial"
  1166.             ],
  1167.             [
  1168.                "name" => "Vert lichen"
  1169.             ],
  1170.             [
  1171.                "name" => "Vert perroquet"
  1172.             ],
  1173.             [
  1174.                "name" => "Vert poireau"
  1175.             ],
  1176.             [
  1177.                "name" => "Vert pomme"
  1178.             ],
  1179.             [
  1180.                "name" => "Vert prairie"
  1181.             ],
  1182.             [
  1183.                "name" => "Vert printemps"
  1184.             ],
  1185.             [
  1186.                "name" => "Vert sapin"
  1187.             ],
  1188.             [
  1189.                "name" => "Vert sauge"
  1190.             ],
  1191.             [
  1192.                "name" => "Vert tilleul"
  1193.             ],
  1194.             [
  1195.                "name" => "Vert Véronèse (pigment)"
  1196.             ],
  1197.             [
  1198.                "name" => "Vert-de-gris (pigment)"
  1199.             ],
  1200.             [
  1201.                "name" => "Vert-jaune"
  1202.             ],
  1203.             [
  1204.                "name" => "Violet"
  1205.             ],
  1206.             [
  1207.                "name" => "Violet d'évêque"
  1208.             ],
  1209.             [
  1210.                "name" => "Violine (pigment)"
  1211.             ],
  1212.             [
  1213.                "name" => "Viride (pigment)"
  1214.             ],
  1215.             [
  1216.                "name" => "Zinzolin"
  1217.             ]
  1218.          ];
  1219.    }
  1220.    public function retrieveCautionCharge(Caution $caution): ?Charge {
  1221.       $checkout_session $this->stripeConnectService->retrieveCheckoutSession($caution->getLocation()->getPayinId());
  1222.       $payment_intent $this->stripeConnectService->retrievePaymentIntent($checkout_session->payment_intent);
  1223.       $charge $this->stripeConnectService->retrieveLatestCharge($payment_intent->latest_charge);
  1224.       return $charge;
  1225.    }
  1226. }