From f79973e053735ebead8331709673e5cdd21864f4 Mon Sep 17 00:00:00 2001 From: Xavier Jp Date: Wed, 14 Aug 2024 15:59:20 +0200 Subject: [PATCH] feat: use anciens sieges from recherche entreprise (#1190) * feat: use anciens sieges from recherche entreprise * feat: use ancien siege in insee * refactor: etablissement fetching logic * fix: typo and eslint config * chore: update snapshots * fix: test bad siret * fix: test e2e * fix: test e2e --- .eslintrc | 2 +- .../entreprise/[slug]/page.tsx | 5 +- .../_snapshots/siren-883010316.json | 124 +++----- .../_snapshots/siren-908595879.json | 124 +++----- .../_snapshots/CA-resultat-filter.json | 73 +++-- .../_snapshots/colter.json | 140 +++++---- .../_snapshots/search-130025265.json | 11 +- .../_snapshots/search-198100125.json | 11 +- .../_snapshots/search-217500016.json | 11 +- .../_snapshots/search-300025764.json | 200 +++++++++++++ .../_snapshots/search-487444697.json | 230 +++++++++++++++ .../_snapshots/search-48744469700428.json | 274 ++++++++++++++++++ .../_snapshots/search-552032534.json | 11 +- .../_snapshots/search-800329849.json | 11 +- .../_snapshots/search-843701079.json | 11 +- .../_snapshots/search-880878145.json | 11 +- .../_snapshots/search-88087814500015.json | 14 +- .../_snapshots/search-883010316.json | 11 +- .../_snapshots/search-908595879.json | 11 +- .../_snapshots/search-xavier jouppe.json | 22 +- .../simpleSearch.test.ts | 3 +- .../_snapshots/siren-300025764.json | 251 ++++++++++++++++ .../_snapshots/siren-883010316.json | 16 +- .../_snapshots/siren-908595879.json | 16 +- .../clientUniteLegaleInsee/index.test.ts | 2 +- clients/recherche-entreprise/index.ts | 2 + clients/recherche-entreprise/interface.ts | 1 + clients/sirene-insee/siren.ts | 29 +- clients/sirene-insee/siret.ts | 18 +- .../etablissement-description/index.tsx | 2 +- .../etablissement-liste-section/index.tsx | 56 ++-- components/etablissement-section/index.tsx | 3 +- components/header/changelog-notification.tsx | 2 +- .../title-section/etablissement/index.tsx | 3 +- components/tva-cell/index.tsx | 6 +- cypress/e2e/research-redirections.cy.js | 18 +- models/core/etablissement.ts | 135 ++++++--- models/core/types.ts | 6 +- models/core/unite-legale.ts | 104 +++---- 39 files changed, 1498 insertions(+), 482 deletions(-) create mode 100644 clients/_test/clientSearchRechercheEntreprise/_snapshots/search-300025764.json create mode 100644 clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json create mode 100644 clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json create mode 100644 clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json diff --git a/.eslintrc b/.eslintrc index 7973b5ea0..3b130a893 100644 --- a/.eslintrc +++ b/.eslintrc @@ -7,7 +7,7 @@ } ], "import/order": [ - "error", + "warn", { "pathGroupsExcludedImportTypes": ["builtin"], "pathGroups": [ diff --git a/app/(header-default)/entreprise/[slug]/page.tsx b/app/(header-default)/entreprise/[slug]/page.tsx index df5934a43..b2087312e 100644 --- a/app/(header-default)/entreprise/[slug]/page.tsx +++ b/app/(header-default)/entreprise/[slug]/page.tsx @@ -95,10 +95,7 @@ export default async function UniteLegalePage(props: AppRouterProps) { session={session} /> )} - + )} diff --git a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json index 136fcef79..cd3717abc 100644 --- a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json +++ b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json @@ -4,89 +4,45 @@ "page": 1 }, "result": { - "etablissements": { - "all": [ - { - "siren": "883010316", - "siret": "88301031600015", - "oldSiret": "88301031600015", - "etatAdministratif": "fermé", - "statutDiffusion": "diffusible", - "estSiege": true, - "enseigne": "", - "denomination": "", - "nic": "00015", - "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.574Z", - "dateMiseAJourInsee": "2024-03-30T08:06:53.621", - "dateDebutActivite": "", - "dateFermeture": "2020-09-01", - "adresse": "RED NEEDLES, 17 RUE DE FRANCEVILLE, 93220 GAGNY", - "adressePostale": "RED NEEDLES, 17 RUE DE FRANCEVILLE, 93220 GAGNY", - "codePostal": "93220", - "commune": "GAGNY", - "activitePrincipale": "70.22Z", - "libelleActivitePrincipale": "Conseil pour les affaires et autres conseils de gestion", - "trancheEffectif": null, - "libelleTrancheEffectif": "", - "latitude": "", - "longitude": "", - "complements": { - "estEntrepreneurIndividuel": false, - "idFiness": [], - "idBio": [], - "idcc": [], - "idOrganismeFormation": [], - "idRge": [], - "idUai": [] - }, - "anneeTrancheEffectif": null - } - ], - "open": [], - "unknown": [], - "closed": [ - { - "siren": "883010316", - "siret": "88301031600015", - "oldSiret": "88301031600015", - "etatAdministratif": "fermé", - "statutDiffusion": "diffusible", - "estSiege": true, - "enseigne": "", - "denomination": "", - "nic": "00015", - "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.574Z", - "dateMiseAJourInsee": "2024-03-30T08:06:53.621", - "dateDebutActivite": "", - "dateFermeture": "2020-09-01", - "adresse": "RED NEEDLES, 17 RUE DE FRANCEVILLE, 93220 GAGNY", - "adressePostale": "RED NEEDLES, 17 RUE DE FRANCEVILLE, 93220 GAGNY", - "codePostal": "93220", - "commune": "GAGNY", - "activitePrincipale": "70.22Z", - "libelleActivitePrincipale": "Conseil pour les affaires et autres conseils de gestion", - "trancheEffectif": null, - "libelleTrancheEffectif": "", - "latitude": "", - "longitude": "", - "complements": { - "estEntrepreneurIndividuel": false, - "idFiness": [], - "idBio": [], - "idcc": [], - "idOrganismeFormation": [], - "idRge": [], - "idUai": [] - }, - "anneeTrancheEffectif": null - } - ], - "nombreEtablissementsOuverts": 0, - "nombreEtablissements": 1, - "usePagination": false, - "currentEtablissementPage": 1 - } + "list": [ + { + "siren": "883010316", + "siret": "88301031600015", + "oldSiret": "88301031600015", + "etatAdministratif": "fermé", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "", + "nic": "00015", + "dateCreation": "2018-05-06", + "dateDerniereMiseAJour": "2024-08-14T13:22:31.517Z", + "dateMiseAJourInsee": "2024-03-30T08:06:53.621", + "dateDebutActivite": "", + "dateFermeture": "2020-09-01", + "adresse": "RED NEEDLES, 17 RUE DE FRANCEVILLE, 93220 GAGNY", + "adressePostale": "RED NEEDLES, 17 RUE DE FRANCEVILLE, 93220 GAGNY", + "codePostal": "93220", + "commune": "GAGNY", + "activitePrincipale": "70.22Z", + "libelleActivitePrincipale": "Conseil pour les affaires et autres conseils de gestion", + "trancheEffectif": null, + "libelleTrancheEffectif": "", + "latitude": "", + "longitude": "", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null + } + ], + "page": 1, + "count": 1 } } \ No newline at end of file diff --git a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json index e32be714b..3f6243553 100644 --- a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json +++ b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json @@ -4,89 +4,45 @@ "page": 1 }, "result": { - "etablissements": { - "all": [ - { - "siren": "908595879", - "siret": "90859587900010", - "oldSiret": "90859587900010", - "etatAdministratif": "en activité", - "statutDiffusion": "diffusible", - "estSiege": true, - "enseigne": "", - "denomination": "", - "nic": "00010", - "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.541Z", - "dateMiseAJourInsee": "2024-03-29T23:18:52.426", - "dateDebutActivite": "", - "dateFermeture": null, - "adresse": "10 RUE DE PENTHIEVRE, 75008 PARIS", - "adressePostale": "10 RUE DE PENTHIEVRE, 75008 PARIS", - "codePostal": "75008", - "commune": "PARIS", - "activitePrincipale": "70.21Z", - "libelleActivitePrincipale": "Conseil en relations publiques et communication", - "trancheEffectif": null, - "libelleTrancheEffectif": "", - "latitude": "", - "longitude": "", - "complements": { - "estEntrepreneurIndividuel": false, - "idFiness": [], - "idBio": [], - "idcc": [], - "idOrganismeFormation": [], - "idRge": [], - "idUai": [] - }, - "anneeTrancheEffectif": null - } - ], - "open": [ - { - "siren": "908595879", - "siret": "90859587900010", - "oldSiret": "90859587900010", - "etatAdministratif": "en activité", - "statutDiffusion": "diffusible", - "estSiege": true, - "enseigne": "", - "denomination": "", - "nic": "00010", - "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.541Z", - "dateMiseAJourInsee": "2024-03-29T23:18:52.426", - "dateDebutActivite": "", - "dateFermeture": null, - "adresse": "10 RUE DE PENTHIEVRE, 75008 PARIS", - "adressePostale": "10 RUE DE PENTHIEVRE, 75008 PARIS", - "codePostal": "75008", - "commune": "PARIS", - "activitePrincipale": "70.21Z", - "libelleActivitePrincipale": "Conseil en relations publiques et communication", - "trancheEffectif": null, - "libelleTrancheEffectif": "", - "latitude": "", - "longitude": "", - "complements": { - "estEntrepreneurIndividuel": false, - "idFiness": [], - "idBio": [], - "idcc": [], - "idOrganismeFormation": [], - "idRge": [], - "idUai": [] - }, - "anneeTrancheEffectif": null - } - ], - "unknown": [], - "closed": [], - "nombreEtablissementsOuverts": 1, - "nombreEtablissements": 1, - "usePagination": false, - "currentEtablissementPage": 1 - } + "list": [ + { + "siren": "908595879", + "siret": "90859587900010", + "oldSiret": "90859587900010", + "etatAdministratif": "en activité", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "", + "nic": "00010", + "dateCreation": "2022-01-01", + "dateDerniereMiseAJour": "2024-08-14T13:22:31.485Z", + "dateMiseAJourInsee": "2024-03-29T23:18:52.426", + "dateDebutActivite": "", + "dateFermeture": null, + "adresse": "10 RUE DE PENTHIEVRE, 75008 PARIS", + "adressePostale": "10 RUE DE PENTHIEVRE, 75008 PARIS", + "codePostal": "75008", + "commune": "PARIS", + "activitePrincipale": "70.21Z", + "libelleActivitePrincipale": "Conseil en relations publiques et communication", + "trancheEffectif": null, + "libelleTrancheEffectif": "", + "latitude": "", + "longitude": "", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null + } + ], + "page": 1, + "count": 1 } } \ No newline at end of file diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/CA-resultat-filter.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/CA-resultat-filter.json index eb5bca2ca..a80253d2d 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/CA-resultat-filter.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/CA-resultat-filter.json @@ -48,10 +48,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "FINANCIERE GANYMEDE", @@ -96,7 +97,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -136,7 +138,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -223,7 +226,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, { "siren": "414971929", @@ -259,7 +263,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": true }, { "siren": "414971929", @@ -295,7 +300,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "nombreEtablissements": 4, @@ -366,10 +372,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "FRANK HATEM & EUGENIE ROSEC (UCER - GANYMEDE)", @@ -412,7 +419,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [ @@ -450,7 +458,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "unknown": [], @@ -549,10 +558,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "MCDC 31264 (MCDC 31264)", @@ -595,7 +605,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [ @@ -633,7 +644,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "unknown": [], @@ -716,7 +728,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "nombreEtablissements": 3, @@ -769,10 +782,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "SOL GRAND SUD (S.G.S)", @@ -815,7 +829,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [ @@ -853,7 +868,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "unknown": [], @@ -939,7 +955,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "nombreEtablissements": 2, @@ -994,10 +1011,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "PATRIMOINE OCCITAN (GANYMEDE PATRIMOINE)", @@ -1042,7 +1060,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -1082,7 +1101,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -1169,7 +1189,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 1, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/colter.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/colter.json index 84248f662..ecd81d927 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/colter.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/colter.json @@ -50,10 +50,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "COMMUNAUTE D'AGGLOMERATION SAINTES - GRANDES RIVES - L'AGGLO", @@ -100,7 +101,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [ @@ -142,7 +144,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "unknown": [], @@ -748,7 +751,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "nombreEtablissements": 54, @@ -798,10 +802,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "DEPARTEMENT DE LA HAUTE GARONNE", @@ -850,7 +855,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -894,7 +900,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -1413,7 +1420,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 72, @@ -1462,10 +1470,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "DEPARTEMENT DU PUY DE DOME", @@ -1513,7 +1522,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -1556,7 +1566,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -2147,7 +2158,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 40, @@ -2195,10 +2207,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "CARCASSONNE AGGLO", @@ -2245,7 +2258,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -2287,7 +2301,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -3405,7 +3420,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 26, @@ -3453,10 +3469,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "GRAND ANGOULEME", @@ -3503,7 +3520,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -3545,7 +3563,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -4184,7 +4203,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 19, @@ -4232,10 +4252,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "OUEST AVEYRON COMMUNAUTE", @@ -4282,7 +4303,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -4324,7 +4346,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -4833,7 +4856,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 13, @@ -4883,10 +4907,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "COMMUNAUTE DE COMMUNES D'ERDRE GESVRES (CCEG)", @@ -4935,7 +4960,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -4979,7 +5005,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -5362,7 +5389,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 28, @@ -5410,10 +5438,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "COMMUNAUTE DE COMMUNES DE L ILE D OLERON", @@ -5460,7 +5489,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -5502,7 +5532,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -5836,7 +5867,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 11, @@ -5884,10 +5916,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "COMMUNAUTE D AGGLOMERATION BEZIERS MEDITERRANEE (CABM)", @@ -5934,7 +5967,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -5976,7 +6010,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -6509,7 +6544,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 10, @@ -6557,10 +6593,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "CC DU CRESTOIS ET DU PAYS DE SAILLANS COEUR DE DROME", @@ -6607,7 +6644,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -6649,7 +6687,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], @@ -7030,7 +7069,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 7, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-130025265.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-130025265.json index 43800edd0..05fb148d1 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-130025265.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-130025265.json @@ -46,10 +46,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "DIRECTION INTERMINISTERIELLE DU NUMERIQUE (DINUM)", @@ -92,7 +93,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -130,7 +132,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-198100125.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-198100125.json index c6db3e686..b51f72857 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-198100125.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-198100125.json @@ -50,10 +50,11 @@ "0810012Y" ] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "LYCEE POLYVALENT JEAN JAURES", @@ -100,7 +101,8 @@ "0810012Y" ] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -142,7 +144,8 @@ "0810012Y" ] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-217500016.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-217500016.json index fb52960b7..4c17a5e9d 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-217500016.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-217500016.json @@ -51,10 +51,11 @@ "0755710Z" ] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "VILLE DE PARIS", @@ -102,7 +103,8 @@ "0755710Z" ] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -145,7 +147,8 @@ "0755710Z" ] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-300025764.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-300025764.json new file mode 100644 index 000000000..c0b2ea815 --- /dev/null +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-300025764.json @@ -0,0 +1,200 @@ +{ + "args": { + "page": 1, + "searchTerms": "300025764", + "searchFilterParams": "" + }, + "result": { + "currentPage": 1, + "resultCount": 1, + "pageCount": 1, + "results": [ + { + "siren": "300025764", + "oldSiren": "300025764", + "siege": { + "siren": "300025764", + "siret": "30002576400048", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "partiellement diffusible", + "estSiege": true, + "enseigne": "[NON-DIFFUSIBLE] [NON-DIFFUSIBLE] [NON-DIFFUSIBLE]", + "denomination": "[NON-DIFFUSIBLE]", + "nic": "00048", + "dateCreation": "2019-12-23", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2019-12-23", + "dateFermeture": "", + "adresse": "[NON-DIFFUSIBLE]", + "adressePostale": "[NON-DIFFUSIBLE] [NON-DIFFUSIBLE] [NON-DIFFUSIBLE], [NON-DIFFUSIBLE]", + "codePostal": "[NON-DIFFUSIBLE]", + "commune": "RENNES", + "activitePrincipale": "68.20A", + "libelleActivitePrincipale": "Location de logements (68.20A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": null, + "longitude": null, + "complements": { + "estEntrepreneurIndividuel": true, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null, + "ancienSiege": false + }, + "tva": null, + "anciensSiegesSirets": [], + "statutDiffusion": "partiellement diffusible", + "etatAdministratif": "en activité", + "nomComplet": "[NON-DIFFUSIBLE]", + "chemin": "300025764", + "natureJuridique": "1000", + "libelleNatureJuridique": "Entrepreneur individuel", + "etablissements": { + "all": [ + { + "siren": "300025764", + "siret": "30002576400048", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "partiellement diffusible", + "estSiege": true, + "enseigne": "[NON-DIFFUSIBLE] [NON-DIFFUSIBLE] [NON-DIFFUSIBLE]", + "denomination": "[NON-DIFFUSIBLE]", + "nic": "00048", + "dateCreation": "2019-12-23", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2019-12-23", + "dateFermeture": "", + "adresse": "[NON-DIFFUSIBLE]", + "adressePostale": "[NON-DIFFUSIBLE] [NON-DIFFUSIBLE] [NON-DIFFUSIBLE], [NON-DIFFUSIBLE]", + "codePostal": "[NON-DIFFUSIBLE]", + "commune": "RENNES", + "activitePrincipale": "68.20A", + "libelleActivitePrincipale": "Location de logements (68.20A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": null, + "longitude": null, + "complements": { + "estEntrepreneurIndividuel": true, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null, + "ancienSiege": false + } + ], + "open": [ + { + "siren": "300025764", + "siret": "30002576400048", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "partiellement diffusible", + "estSiege": true, + "enseigne": "[NON-DIFFUSIBLE] [NON-DIFFUSIBLE] [NON-DIFFUSIBLE]", + "denomination": "[NON-DIFFUSIBLE]", + "nic": "00048", + "dateCreation": "2019-12-23", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2019-12-23", + "dateFermeture": "", + "adresse": "[NON-DIFFUSIBLE]", + "adressePostale": "[NON-DIFFUSIBLE] [NON-DIFFUSIBLE] [NON-DIFFUSIBLE], [NON-DIFFUSIBLE]", + "codePostal": "[NON-DIFFUSIBLE]", + "commune": "RENNES", + "activitePrincipale": "68.20A", + "libelleActivitePrincipale": "Location de logements (68.20A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": null, + "longitude": null, + "complements": { + "estEntrepreneurIndividuel": true, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null, + "ancienSiege": false + } + ], + "unknown": [], + "closed": [], + "nombreEtablissementsOuverts": 1, + "nombreEtablissements": 2, + "usePagination": false, + "currentEtablissementPage": 1 + }, + "activitePrincipale": "68.20A", + "libelleActivitePrincipale": "Location de logements", + "dateCreation": "1981-10-01", + "dateFermeture": "", + "dateDerniereMiseAJour": "2023-09-21T03:34:50", + "dateMiseAJourInsee": "2024-03-22T14:26:06", + "dateMiseAJourInpi": "2024-01-14T12:34:27", + "dateDebutActivite": "", + "trancheEffectif": null, + "anneeCategorieEntreprise": "2021", + "categorieEntreprise": "PME", + "anneeTrancheEffectif": null, + "complements": { + "estBio": false, + "estEss": false, + "estServicePublic": false, + "estEntrepreneurIndividuel": true, + "estEntrepreneurSpectacle": false, + "statutEntrepreneurSpectacle": null, + "estFiness": false, + "egaproRenseignee": false, + "estRge": false, + "estOrganismeFormation": false, + "estSocieteMission": false, + "estQualiopi": false, + "estAssociation": false, + "estUai": false, + "estEntrepriseInclusive": false, + "typeEntrepriseInclusive": null + }, + "association": { + "idAssociation": null, + "data": null + }, + "colter": { + "codeColter": null + }, + "listeIdcc": [], + "matchingEtablissements": [], + "nombreEtablissements": 2, + "nombreEtablissementsOuverts": 1, + "dirigeants": [ + { + "sexe": null, + "nom": "[NON-DIFFUSIBLE]", + "prenom": "[non-diffusible]", + "role": null, + "dateNaissancePartial": "", + "lieuNaissance": "" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json new file mode 100644 index 000000000..97bf35b13 --- /dev/null +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json @@ -0,0 +1,230 @@ +{ + "args": { + "page": 1, + "searchTerms": "487444697", + "searchFilterParams": "" + }, + "result": { + "currentPage": 1, + "resultCount": 1, + "pageCount": 1, + "results": [ + { + "siren": "487444697", + "oldSiren": "487444697", + "siege": { + "siren": "487444697", + "siret": "48744469700428", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "SOLARSUD", + "nic": "00428", + "dateCreation": "2019-03-11", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2024-04-09", + "dateFermeture": "", + "adresse": "22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "adressePostale": "SOLARSUD, 22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "codePostal": "24330", + "commune": "BOULAZAC ISLE MANOIRE", + "activitePrincipale": "43.21A", + "libelleActivitePrincipale": "Travaux d’installation électrique dans tous locaux (43.21A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": "45.150722", + "longitude": "0.788652", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [ + "2609", + "1597", + "2420" + ], + "idOrganismeFormation": [], + "idRge": [ + "43SPVRGE" + ], + "idUai": [] + }, + "anneeTrancheEffectif": "2021", + "ancienSiege": false + }, + "tva": null, + "anciensSiegesSirets": [], + "statutDiffusion": "diffusible", + "etatAdministratif": "en activité", + "nomComplet": "ESSOR ENERGIES (SOLARSUD)", + "chemin": "essor-energies-487444697", + "natureJuridique": "5499", + "libelleNatureJuridique": "Société à responsabilité limitée (sans autre indication)", + "etablissements": { + "all": [ + { + "siren": "487444697", + "siret": "48744469700428", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "SOLARSUD", + "nic": "00428", + "dateCreation": "2019-03-11", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2024-04-09", + "dateFermeture": "", + "adresse": "22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "adressePostale": "SOLARSUD, 22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "codePostal": "24330", + "commune": "BOULAZAC ISLE MANOIRE", + "activitePrincipale": "43.21A", + "libelleActivitePrincipale": "Travaux d’installation électrique dans tous locaux (43.21A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": "45.150722", + "longitude": "0.788652", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [ + "2609", + "1597", + "2420" + ], + "idOrganismeFormation": [], + "idRge": [ + "43SPVRGE" + ], + "idUai": [] + }, + "anneeTrancheEffectif": "2021", + "ancienSiege": false + } + ], + "open": [ + { + "siren": "487444697", + "siret": "48744469700428", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "SOLARSUD", + "nic": "00428", + "dateCreation": "2019-03-11", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2024-04-09", + "dateFermeture": "", + "adresse": "22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "adressePostale": "SOLARSUD, 22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "codePostal": "24330", + "commune": "BOULAZAC ISLE MANOIRE", + "activitePrincipale": "43.21A", + "libelleActivitePrincipale": "Travaux d’installation électrique dans tous locaux (43.21A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": "45.150722", + "longitude": "0.788652", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [ + "2609", + "1597", + "2420" + ], + "idOrganismeFormation": [], + "idRge": [ + "43SPVRGE" + ], + "idUai": [] + }, + "anneeTrancheEffectif": "2021", + "ancienSiege": false + } + ], + "unknown": [], + "closed": [], + "nombreEtablissementsOuverts": 29, + "nombreEtablissements": 42, + "usePagination": false, + "currentEtablissementPage": 1 + }, + "activitePrincipale": "35.11Z", + "libelleActivitePrincipale": "Production d’électricité", + "dateCreation": "2005-12-06", + "dateFermeture": "", + "dateDerniereMiseAJour": "2023-09-21T03:34:50", + "dateMiseAJourInsee": "2024-05-09T05:09:57", + "dateMiseAJourInpi": "2024-05-18T17:02:54", + "dateDebutActivite": "", + "trancheEffectif": "11", + "anneeCategorieEntreprise": "2021", + "categorieEntreprise": "ETI", + "anneeTrancheEffectif": "2021", + "complements": { + "estBio": false, + "estEss": false, + "estServicePublic": false, + "estEntrepreneurIndividuel": false, + "estEntrepreneurSpectacle": false, + "statutEntrepreneurSpectacle": null, + "estFiness": false, + "egaproRenseignee": false, + "estRge": true, + "estOrganismeFormation": false, + "estSocieteMission": false, + "estQualiopi": false, + "estAssociation": false, + "estUai": false, + "estEntrepriseInclusive": false, + "typeEntrepriseInclusive": null + }, + "association": { + "idAssociation": null, + "data": null + }, + "colter": { + "codeColter": null + }, + "listeIdcc": [ + "2609", + "1597", + "2420" + ], + "matchingEtablissements": [], + "nombreEtablissements": 42, + "nombreEtablissementsOuverts": 29, + "dirigeants": [ + { + "sexe": null, + "nom": "POUYANNE (POUYANNE)", + "prenom": "David", + "role": null, + "dateNaissancePartial": "", + "lieuNaissance": "" + }, + { + "sexe": null, + "nom": "POUYANNE", + "prenom": "David", + "role": "Gérant", + "dateNaissancePartial": "", + "lieuNaissance": "" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json new file mode 100644 index 000000000..e9ea8c04a --- /dev/null +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json @@ -0,0 +1,274 @@ +{ + "args": { + "page": 1, + "searchTerms": "48744469700428", + "searchFilterParams": "" + }, + "result": { + "currentPage": 1, + "resultCount": 1, + "pageCount": 1, + "results": [ + { + "siren": "487444697", + "oldSiren": "487444697", + "siege": { + "siren": "487444697", + "siret": "48744469700428", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "SOLARSUD", + "nic": "00428", + "dateCreation": "2019-03-11", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2024-04-09", + "dateFermeture": "", + "adresse": "22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "adressePostale": "SOLARSUD, 22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "codePostal": "24330", + "commune": "BOULAZAC ISLE MANOIRE", + "activitePrincipale": "43.21A", + "libelleActivitePrincipale": "Travaux d’installation électrique dans tous locaux (43.21A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": "45.150722", + "longitude": "0.788652", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [ + "2609", + "1597", + "2420" + ], + "idOrganismeFormation": [], + "idRge": [ + "43SPVRGE" + ], + "idUai": [] + }, + "anneeTrancheEffectif": "2021", + "ancienSiege": false + }, + "tva": null, + "anciensSiegesSirets": [], + "statutDiffusion": "diffusible", + "etatAdministratif": "en activité", + "nomComplet": "ESSOR ENERGIES (SOLARSUD)", + "chemin": "essor-energies-487444697", + "natureJuridique": "5499", + "libelleNatureJuridique": "Société à responsabilité limitée (sans autre indication)", + "etablissements": { + "all": [ + { + "siren": "487444697", + "siret": "48744469700428", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "SOLARSUD", + "nic": "00428", + "dateCreation": "2019-03-11", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2024-04-09", + "dateFermeture": "", + "adresse": "22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "adressePostale": "SOLARSUD, 22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "codePostal": "24330", + "commune": "BOULAZAC ISLE MANOIRE", + "activitePrincipale": "43.21A", + "libelleActivitePrincipale": "Travaux d’installation électrique dans tous locaux (43.21A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": "45.150722", + "longitude": "0.788652", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [ + "2609", + "1597", + "2420" + ], + "idOrganismeFormation": [], + "idRge": [ + "43SPVRGE" + ], + "idUai": [] + }, + "anneeTrancheEffectif": "2021", + "ancienSiege": false + } + ], + "open": [ + { + "siren": "487444697", + "siret": "48744469700428", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "SOLARSUD", + "nic": "00428", + "dateCreation": "2019-03-11", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2024-04-09", + "dateFermeture": "", + "adresse": "22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "adressePostale": "SOLARSUD, 22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "codePostal": "24330", + "commune": "BOULAZAC ISLE MANOIRE", + "activitePrincipale": "43.21A", + "libelleActivitePrincipale": "Travaux d’installation électrique dans tous locaux (43.21A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": "45.150722", + "longitude": "0.788652", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [ + "2609", + "1597", + "2420" + ], + "idOrganismeFormation": [], + "idRge": [ + "43SPVRGE" + ], + "idUai": [] + }, + "anneeTrancheEffectif": "2021", + "ancienSiege": false + } + ], + "unknown": [], + "closed": [], + "nombreEtablissementsOuverts": 29, + "nombreEtablissements": 42, + "usePagination": false, + "currentEtablissementPage": 1 + }, + "activitePrincipale": "35.11Z", + "libelleActivitePrincipale": "Production d’électricité", + "dateCreation": "2005-12-06", + "dateFermeture": "", + "dateDerniereMiseAJour": "2023-09-21T03:34:50", + "dateMiseAJourInsee": "2024-05-09T05:09:57", + "dateMiseAJourInpi": "2024-05-18T17:02:54", + "dateDebutActivite": "", + "trancheEffectif": "11", + "anneeCategorieEntreprise": "2021", + "categorieEntreprise": "ETI", + "anneeTrancheEffectif": "2021", + "complements": { + "estBio": false, + "estEss": false, + "estServicePublic": false, + "estEntrepreneurIndividuel": false, + "estEntrepreneurSpectacle": false, + "statutEntrepreneurSpectacle": null, + "estFiness": false, + "egaproRenseignee": false, + "estRge": true, + "estOrganismeFormation": false, + "estSocieteMission": false, + "estQualiopi": false, + "estAssociation": false, + "estUai": false, + "estEntrepriseInclusive": false, + "typeEntrepriseInclusive": null + }, + "association": { + "idAssociation": null, + "data": null + }, + "colter": { + "codeColter": null + }, + "listeIdcc": [ + "2609", + "1597", + "2420" + ], + "matchingEtablissements": [ + { + "siren": "487444697", + "siret": "48744469700428", + "oldSiret": "", + "etatAdministratif": "en activité", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "SOLARSUD", + "nic": "00428", + "dateCreation": "2019-03-11", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "2024-04-09", + "dateFermeture": "", + "adresse": "22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "adressePostale": "SOLARSUD, 22 RUE MAISON BLANCHE 24330 BOULAZAC ISLE MANOIRE", + "codePostal": "24330", + "commune": "BOULAZAC ISLE MANOIRE", + "activitePrincipale": "43.21A", + "libelleActivitePrincipale": "Travaux d’installation électrique dans tous locaux (43.21A)", + "trancheEffectif": "N", + "libelleTrancheEffectif": "", + "latitude": "45.150722", + "longitude": "0.788652", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [ + "2609", + "1597", + "2420" + ], + "idOrganismeFormation": [], + "idRge": [ + "43SPVRGE" + ], + "idUai": [] + }, + "anneeTrancheEffectif": "2021", + "ancienSiege": false + } + ], + "nombreEtablissements": 42, + "nombreEtablissementsOuverts": 29, + "dirigeants": [ + { + "sexe": null, + "nom": "POUYANNE (POUYANNE)", + "prenom": "David", + "role": null, + "dateNaissancePartial": "", + "lieuNaissance": "" + }, + { + "sexe": null, + "nom": "POUYANNE", + "prenom": "David", + "role": "Gérant", + "dateNaissancePartial": "", + "lieuNaissance": "" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json index ae6be8f38..3e0829c44 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json @@ -50,10 +50,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "DANONE", @@ -100,7 +101,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -142,7 +144,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-800329849.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-800329849.json index 4c99e6751..e5d920382 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-800329849.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-800329849.json @@ -48,10 +48,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "THEATRE STEPHANE GILDAS", @@ -96,7 +97,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -136,7 +138,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json index 3abeaea56..86037df82 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json @@ -59,10 +59,11 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "BESOIN DE TOIT", @@ -118,7 +119,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [ @@ -169,7 +171,8 @@ ], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "unknown": [], diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json index 0508af672..5b38246a0 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json @@ -46,10 +46,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "cessée", "nomComplet": "GANYMEDE", @@ -92,7 +93,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [], @@ -132,7 +134,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissementsOuverts": 0, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json index 2c5624e41..39cd08762 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json @@ -46,10 +46,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "cessée", "nomComplet": "GANYMEDE", @@ -92,7 +93,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [], @@ -132,7 +134,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissementsOuverts": 0, @@ -213,7 +216,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissements": 1, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json index 8e804b86e..fd173c19f 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json @@ -46,10 +46,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "cessée", "nomComplet": "RAPHAEL DUBIGNY", @@ -92,7 +93,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [], @@ -132,7 +134,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "nombreEtablissementsOuverts": 0, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json index fd7c0a82a..6be6c2e75 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json @@ -48,10 +48,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "SEVERNAYA", @@ -96,7 +97,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [ @@ -136,7 +138,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "unknown": [], diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json index 2df872df9..85e6a6012 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json @@ -46,10 +46,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "SCI DE LASLAUDIE", @@ -92,7 +93,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [ @@ -130,7 +132,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "unknown": [], @@ -277,10 +280,11 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false }, - "allSiegesSiret": [], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "cessée", "nomComplet": "GANYMEDE", @@ -323,7 +327,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "open": [], @@ -363,7 +368,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": "2021" + "anneeTrancheEffectif": "2021", + "ancienSiege": false } ], "nombreEtablissementsOuverts": 0, diff --git a/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts b/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts index 749079df7..f6eb4ad9e 100644 --- a/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts +++ b/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts @@ -19,8 +19,9 @@ describe('clientSearchRechercheEntreprise : simple search with searchTerms', () '883010316', '908595879', '552032534', + '487444697', '41154066900016', // Entreprise non enregistrée dans la base sirene - + '48744469700428', 'xavier jouppe', ].forEach((s) => itShouldMatchSnapshotForSearch(s, 1)); }); diff --git a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json new file mode 100644 index 000000000..49cfb72fc --- /dev/null +++ b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json @@ -0,0 +1,251 @@ +{ + "args": "300025764", + "result": { + "siren": "300025764", + "oldSiren": "300025764", + "siege": { + "siren": "300025764", + "siret": "30002576400048", + "oldSiret": "", + "etatAdministratif": "inconnu", + "statutDiffusion": "diffusible", + "estSiege": true, + "enseigne": null, + "denomination": null, + "nic": "00048", + "dateCreation": "2019-12-31", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", + "dateDebutActivite": "", + "dateFermeture": "", + "adresse": "", + "adressePostale": "", + "codePostal": "", + "commune": "", + "activitePrincipale": "", + "libelleActivitePrincipale": "", + "trancheEffectif": "", + "libelleTrancheEffectif": "", + "latitude": "", + "longitude": "", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + } + }, + "tva": null, + "anciensSiegesSirets": [ + "30002576400022", + "300025764null" + ], + "statutDiffusion": "partiellement diffusible", + "etatAdministratif": "en activité", + "nomComplet": "Michel SAUVAGE", + "chemin": "300025764", + "natureJuridique": "1000", + "libelleNatureJuridique": "Entrepreneur individuel", + "etablissements": { + "all": [ + { + "siren": "300025764", + "siret": "30002576400022", + "oldSiret": "30002576400022", + "etatAdministratif": "fermé", + "statutDiffusion": "partiellement diffusible", + "estSiege": false, + "enseigne": "", + "denomination": "", + "nic": "00022", + "dateCreation": "1981-10-01", + "dateDerniereMiseAJour": "2024-08-14T13:22:05.174Z", + "dateMiseAJourInsee": "2024-03-29T23:43:34.275", + "dateDebutActivite": "", + "dateFermeture": "2019-12-31", + "adresse": "ZONE ARTISANALE, AVENUE DES FONTENELLES, 35310 CHAVAGNE", + "adressePostale": "ZONE ARTISANALE, AVENUE DES FONTENELLES, 35310 CHAVAGNE", + "codePostal": "35310", + "commune": "CHAVAGNE", + "activitePrincipale": "69.20Z", + "libelleActivitePrincipale": "Activités comptables", + "trancheEffectif": null, + "libelleTrancheEffectif": "", + "latitude": "", + "longitude": "", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null, + "ancienSiege": true + }, + { + "siren": "300025764", + "siret": "30002576400048", + "oldSiret": "30002576400048", + "etatAdministratif": "en activité", + "statutDiffusion": "partiellement diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "", + "nic": "00048", + "dateCreation": "2019-12-23", + "dateDerniereMiseAJour": "2024-08-14T13:22:05.174Z", + "dateMiseAJourInsee": "2024-03-30T00:23:00.551", + "dateDebutActivite": "", + "dateFermeture": null, + "adresse": "APPT B407 - 4EME ETAGE, 51 BOULEVARD DE VERDUN, 35000 RENNES", + "adressePostale": "APPT B407 - 4EME ETAGE, 51 BOULEVARD DE VERDUN, 35000 RENNES", + "codePostal": "35000", + "commune": "RENNES", + "activitePrincipale": "68.20A", + "libelleActivitePrincipale": "Location de logements", + "trancheEffectif": null, + "libelleTrancheEffectif": "", + "latitude": "", + "longitude": "", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null, + "ancienSiege": false + } + ], + "open": [ + { + "siren": "300025764", + "siret": "30002576400048", + "oldSiret": "30002576400048", + "etatAdministratif": "en activité", + "statutDiffusion": "partiellement diffusible", + "estSiege": true, + "enseigne": "", + "denomination": "", + "nic": "00048", + "dateCreation": "2019-12-23", + "dateDerniereMiseAJour": "2024-08-14T13:22:05.174Z", + "dateMiseAJourInsee": "2024-03-30T00:23:00.551", + "dateDebutActivite": "", + "dateFermeture": null, + "adresse": "APPT B407 - 4EME ETAGE, 51 BOULEVARD DE VERDUN, 35000 RENNES", + "adressePostale": "APPT B407 - 4EME ETAGE, 51 BOULEVARD DE VERDUN, 35000 RENNES", + "codePostal": "35000", + "commune": "RENNES", + "activitePrincipale": "68.20A", + "libelleActivitePrincipale": "Location de logements", + "trancheEffectif": null, + "libelleTrancheEffectif": "", + "latitude": "", + "longitude": "", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null, + "ancienSiege": false + } + ], + "unknown": [], + "closed": [ + { + "siren": "300025764", + "siret": "30002576400022", + "oldSiret": "30002576400022", + "etatAdministratif": "fermé", + "statutDiffusion": "partiellement diffusible", + "estSiege": false, + "enseigne": "", + "denomination": "", + "nic": "00022", + "dateCreation": "1981-10-01", + "dateDerniereMiseAJour": "2024-08-14T13:22:05.174Z", + "dateMiseAJourInsee": "2024-03-29T23:43:34.275", + "dateDebutActivite": "", + "dateFermeture": "2019-12-31", + "adresse": "ZONE ARTISANALE, AVENUE DES FONTENELLES, 35310 CHAVAGNE", + "adressePostale": "ZONE ARTISANALE, AVENUE DES FONTENELLES, 35310 CHAVAGNE", + "codePostal": "35310", + "commune": "CHAVAGNE", + "activitePrincipale": "69.20Z", + "libelleActivitePrincipale": "Activités comptables", + "trancheEffectif": null, + "libelleTrancheEffectif": "", + "latitude": "", + "longitude": "", + "complements": { + "estEntrepreneurIndividuel": false, + "idFiness": [], + "idBio": [], + "idcc": [], + "idOrganismeFormation": [], + "idRge": [], + "idUai": [] + }, + "anneeTrancheEffectif": null, + "ancienSiege": true + } + ], + "nombreEtablissementsOuverts": 1, + "nombreEtablissements": 2, + "usePagination": false, + "currentEtablissementPage": 1 + }, + "activitePrincipale": "68.20A", + "libelleActivitePrincipale": "Location de logements", + "dateCreation": "1981-10-01", + "dateFermeture": "", + "dateDerniereMiseAJour": "2023-10-5", + "dateMiseAJourInsee": "2024-03-22", + "dateMiseAJourInpi": "", + "dateDebutActivite": "2019-12-31", + "trancheEffectif": null, + "anneeCategorieEntreprise": "2021", + "categorieEntreprise": "PME", + "anneeTrancheEffectif": null, + "complements": { + "estEntrepreneurIndividuel": true, + "estEss": false, + "estBio": false, + "estEntrepreneurSpectacle": false, + "egaproRenseignee": false, + "statutEntrepreneurSpectacle": "", + "estServicePublic": false, + "estFiness": false, + "estRge": false, + "estOrganismeFormation": false, + "estSocieteMission": false, + "estQualiopi": false, + "estUai": false, + "estAssociation": false, + "estEntrepriseInclusive": false, + "typeEntrepriseInclusive": "" + }, + "association": { + "idAssociation": null + }, + "colter": { + "codeColter": null + }, + "listeIdcc": [] + } +} \ No newline at end of file diff --git a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-883010316.json b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-883010316.json index 5ed6c3c8a..c77691ca3 100644 --- a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-883010316.json +++ b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-883010316.json @@ -14,7 +14,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.662Z", + "dateDerniereMiseAJour": "2024-08-14T13:22:31.620Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", @@ -39,10 +39,8 @@ }, "anneeTrancheEffectif": null }, - "allSiegesSiret": [ - "88301031600015" - ], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "cessée", "nomComplet": "Raphael DUBIGNY", @@ -62,7 +60,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.662Z", + "dateDerniereMiseAJour": "2024-08-14T13:22:31.620Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", @@ -85,7 +83,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [], @@ -102,7 +101,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.662Z", + "dateDerniereMiseAJour": "2024-08-14T13:22:31.620Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", @@ -125,7 +124,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "nombreEtablissementsOuverts": 0, diff --git a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-908595879.json b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-908595879.json index f5914a259..10c75a5d2 100644 --- a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-908595879.json +++ b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-908595879.json @@ -14,7 +14,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.566Z", + "dateDerniereMiseAJour": "2024-08-14T13:22:31.528Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, @@ -39,10 +39,8 @@ }, "anneeTrancheEffectif": null }, - "allSiegesSiret": [ - "90859587900010" - ], "tva": null, + "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "en activité", "nomComplet": "SEVERNAYA", @@ -62,7 +60,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.598Z", + "dateDerniereMiseAJour": "2024-08-14T13:22:31.559Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, @@ -85,7 +83,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "open": [ @@ -100,7 +99,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-08-13T14:42:14.598Z", + "dateDerniereMiseAJour": "2024-08-14T13:22:31.559Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, @@ -123,7 +122,8 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null + "anneeTrancheEffectif": null, + "ancienSiege": false } ], "unknown": [], diff --git a/clients/_test/clientUniteLegaleInsee/index.test.ts b/clients/_test/clientUniteLegaleInsee/index.test.ts index 52c359fdc..581ab53df 100644 --- a/clients/_test/clientUniteLegaleInsee/index.test.ts +++ b/clients/_test/clientUniteLegaleInsee/index.test.ts @@ -4,7 +4,7 @@ import { expectClientToMatchSnapshot } from '../expect-client-to-match-snapshot' import simplifyParams from './simplify-params'; describe('clientUniteLegaleInsee', () => { - (['908595879', '883010316'] as Siren[]).forEach( + (['908595879', '883010316', '300025764'] as Siren[]).forEach( expectClientToMatchSnapshotWithSiren ); }); diff --git a/clients/recherche-entreprise/index.ts b/clients/recherche-entreprise/index.ts index 34107033b..39ec70d43 100644 --- a/clients/recherche-entreprise/index.ts +++ b/clients/recherche-entreprise/index.ts @@ -334,6 +334,7 @@ const mapToEtablissement = ( liste_enseignes, etat_administratif, est_siege = false, + ancien_siege = false, nom_commercial = '', activite_principale = '', date_creation = '', @@ -382,6 +383,7 @@ const mapToEtablissement = ( latitude, longitude, estSiege: est_siege, + ancienSiege: ancien_siege, etatAdministratif, statutDiffusion: statuDiffusionFromStatutDiffusionInsee( statut_diffusion_etablissement || 'O', diff --git a/clients/recherche-entreprise/interface.ts b/clients/recherche-entreprise/interface.ts index 87b02aeda..2dbc40f17 100644 --- a/clients/recherche-entreprise/interface.ts +++ b/clients/recherche-entreprise/interface.ts @@ -47,6 +47,7 @@ export type IDirigeant = { }; export type IEtablissementCore = { + ancien_siege: boolean; activite_principale: string; adresse: string; commune: string; diff --git a/clients/sirene-insee/siren.ts b/clients/sirene-insee/siren.ts index b79daf9e5..a23cec095 100644 --- a/clients/sirene-insee/siren.ts +++ b/clients/sirene-insee/siren.ts @@ -99,7 +99,7 @@ const clientUniteLegaleInsee = async ( } return null; }), // better empty etablissement list than failing UL - clientAllEtablissementsInsee(siren, page, options).catch((e) => null), + clientAllEtablissementsInsee(siren, page, options).catch(() => null), ]); const siege = realSiege || uniteLegale.siege; @@ -111,8 +111,17 @@ const clientUniteLegaleInsee = async ( denominationUsuelle ? ` (${denominationUsuelle})` : '' }${tmpUniteLegale.sigle ? ` (${tmpUniteLegale.sigle})` : ''}`; - const etablissements = - allEtablissements?.etablissements || createEtablissementsList([siege]); + const etablissementsList = allEtablissements?.list || [siege]; + etablissementsList.forEach( + (e) => + (e.ancienSiege = uniteLegale.anciensSiegesSirets.indexOf(e.siret) > -1) + ); + + const etablissements = createEtablissementsList( + etablissementsList, + allEtablissements?.page || 1, + allEtablissements?.count || 1 + ); return { ...uniteLegale, @@ -191,12 +200,6 @@ const mapToDomainObject = ( siege.trancheEffectif = ''; } - const allSiegesSiret = Array.from( - new Set( - periodesUniteLegale.map((e) => (siren + e.nicSiegeUniteLegale) as Siret) - ) - ); - /** * either siege nom commercial or pre 2008 unite legale nom commercial * https://www.sirene.fr/sirene/public/variable/denominationUsuelleEtablissement @@ -238,7 +241,13 @@ const mapToDomainObject = ( siren, oldSiren: originalSiren, siege, - allSiegesSiret, + anciensSiegesSirets: Array.from( + new Set( + periodesUniteLegale + .map((e) => (siren + e.nicSiegeUniteLegale) as Siret) + .filter((e) => e !== siege.siret) + ) + ), natureJuridique: categorieJuridiqueUniteLegale || '', libelleNatureJuridique: libelleFromCategoriesJuridiques( categorieJuridiqueUniteLegale diff --git a/clients/sirene-insee/siret.ts b/clients/sirene-insee/siret.ts index 131c8ca1f..5319723a0 100644 --- a/clients/sirene-insee/siret.ts +++ b/clients/sirene-insee/siret.ts @@ -2,10 +2,6 @@ import { HttpNotFound, HttpServerError } from '#clients/exceptions'; import routes from '#clients/routes'; import stubClientWithSnapshots from '#clients/stub-client-with-snaphots'; import constants from '#models/constants'; -import { - IEtablissementsList, - createEtablissementsList, -} from '#models/core/etablissements-list'; import { estActif } from '#models/core/etat-administratif'; import { IEtablissement, createDefaultEtablissement } from '#models/core/types'; import { @@ -97,7 +93,11 @@ const clientAllEtablissementsInsee = async ( siren: string, page = 1, options: InseeClientOptions -): Promise => { +): Promise<{ + list: IEtablissement[]; + page: number; + count: number; +}> => { const etablissementsPerPage = constants.resultsPerPage.etablissements; const cursor = Math.max(page - 1, 0) * etablissementsPerPage; @@ -121,11 +121,9 @@ const clientAllEtablissementsInsee = async ( ); return { - etablissements: createEtablissementsList( - allEtablissements, - page, - header.total - ), + list: allEtablissements, + page, + count: header.total, }; }; diff --git a/components/etablissement-description/index.tsx b/components/etablissement-description/index.tsx index f332da9e1..fa017c315 100644 --- a/components/etablissement-description/index.tsx +++ b/components/etablissement-description/index.tsx @@ -90,7 +90,7 @@ export const EtablissementDescription: React.FC = ({ C’est {etablissement.estSiege ? ( le siège social - ) : uniteLegale.allSiegesSiret.indexOf(etablissement.siret) > -1 ? ( + ) : etablissement.ancienSiege ? ( <> un ancien siège social ) : ( <> un établissement secondaire diff --git a/components/etablissement-liste-section/index.tsx b/components/etablissement-liste-section/index.tsx index 991856e34..5116e4f96 100644 --- a/components/etablissement-liste-section/index.tsx +++ b/components/etablissement-liste-section/index.tsx @@ -9,15 +9,12 @@ import { EAdministration } from '#models/administrations/EAdministration'; import constants from '#models/constants'; import { estNonDiffusibleStrict } from '#models/core/diffusion'; import { IEtablissement, IUniteLegale } from '#models/core/types'; -import { ISession } from '#models/user/session'; -import { Siret, formatDate, formatSiret } from '#utils/helpers'; +import { formatDate, formatSiret } from '#utils/helpers'; const EtablissementTable: React.FC<{ label?: string; etablissements: IEtablissement[]; - sieges: Siret[]; - session: ISession | null; -}> = ({ label, etablissements, sieges = [], session }) => { +}> = ({ label, etablissements }) => { const plural = etablissements.length > 1 ? 's' : ''; return ( <> @@ -63,9 +60,11 @@ const EtablissementTable: React.FC<{ )} <>{etablissement.adresse} - {etablissement.estSiege && siège social} - {sieges.indexOf(etablissement.siret) > 0 && - !etablissement.estSiege && ancien siège social} + {etablissement.estSiege ? ( + siège social + ) : etablissement.ancienSiege ? ( + ancien siège social + ) : null} )} , @@ -87,8 +86,7 @@ const EtablissementTable: React.FC<{ const EtablissementListeSection: React.FC<{ uniteLegale: IUniteLegale; - session: ISession | null; -}> = ({ uniteLegale, session }) => { +}> = ({ uniteLegale }) => { const { usePagination, nombreEtablissements, @@ -127,8 +125,6 @@ const EtablissementListeSection: React.FC<{ <> {uniteLegale.etablissements.open.length > 0 && ( - <> - - + )} {uniteLegale.etablissements.unknown.length > 0 && ( - <> - - + )} {uniteLegale.etablissements.closed.length > 0 && ( - <> - - + )} )} diff --git a/components/etablissement-section/index.tsx b/components/etablissement-section/index.tsx index 8667d1566..c90fd508a 100644 --- a/components/etablissement-section/index.tsx +++ b/components/etablissement-section/index.tsx @@ -50,8 +50,7 @@ const EtablissementSection: React.FC = ({ <> {etablissement.estSiege ? ( siège social - ) : uniteLegale.allSiegesSiret.indexOf(etablissement.siret) > - -1 ? ( + ) : etablissement.ancienSiege ? ( ancien siège social ) : ( secondaire diff --git a/components/header/changelog-notification.tsx b/components/header/changelog-notification.tsx index 6d88c15a2..68c8e35fc 100644 --- a/components/header/changelog-notification.tsx +++ b/components/header/changelog-notification.tsx @@ -1,12 +1,12 @@ 'use client'; -import { useEffect } from 'react'; import { Icon } from '#components-ui/icon/wrapper'; import { changelogData } from '#models/historique-modifications'; import { EScope, hasRights } from '#models/user/rights'; import { formatDate } from '#utils/helpers'; import { useStorage } from 'hooks'; import useSession from 'hooks/use-session'; +import { useEffect } from 'react'; import style from './changelog-notification.module.css'; const NEW_SINCE_LAST_VISIT_ID = 'new-since-last-visit'; diff --git a/components/title-section/etablissement/index.tsx b/components/title-section/etablissement/index.tsx index 4d156fd0e..a854eb754 100644 --- a/components/title-section/etablissement/index.tsx +++ b/components/title-section/etablissement/index.tsx @@ -76,8 +76,7 @@ const TitleEtablissementWithDenomination: React.FC<{ siège social - ) : uniteLegale.allSiegesSiret.indexOf(etablissement.siret) > -1 && - !etablissement.estSiege ? ( + ) : etablissement.ancienSiege ? ( <> unancien siège social diff --git a/components/tva-cell/index.tsx b/components/tva-cell/index.tsx index 0f566cc27..6dbd7c0f4 100644 --- a/components/tva-cell/index.tsx +++ b/components/tva-cell/index.tsx @@ -1,6 +1,5 @@ 'use client'; -import React from 'react'; import FAQLink from '#components-ui/faq-link'; import { Icon } from '#components-ui/icon/wrapper'; import InformationTooltip from '#components-ui/information-tooltip'; @@ -125,8 +124,9 @@ const VerifyTVA: React.FC<{ tabIndex={0} label={ <> - Attention, cette structure a plusieurs activités différentes - .
+ Attention, cette structure a plusieurs activités + différentes. +
Elle peut posséder un numéro de TVA Intracommunautaire pour chacune de ces activités.
diff --git a/cypress/e2e/research-redirections.cy.js b/cypress/e2e/research-redirections.cy.js index 7e1baef64..3da8ff58f 100644 --- a/cypress/e2e/research-redirections.cy.js +++ b/cypress/e2e/research-redirections.cy.js @@ -23,16 +23,28 @@ describe('Siren / Siret redirections', () => { cy.url().should('include', '/entreprise/123456789'); }); + it('Not found redirection', () => { + cy.visit('/'); + + cy.get('.fr-search-bar > input') + .type('123 456 789 00003') + .should('have.value', '123 456 789 00003'); + + cy.get('.fr-search-bar > button').click(); + + cy.url().should('include', '/erreur/introuvable/12345678900003'); + }); + it('Unformatted siret redirection', () => { cy.visit('/'); cy.get('.fr-search-bar > input') - .type('123 456 789 0 0003') - .should('have.value', '123 456 789 0 0003'); + .type('487 444 697 00428') + .should('have.value', '487 444 697 00428'); cy.get('.fr-search-bar > button').click(); - cy.url().should('include', '/etablissement/12345678900003'); + cy.url().should('include', '/etablissement/48744469700428'); }); it('Entreprise/etablissement page redirection', () => { diff --git a/models/core/etablissement.ts b/models/core/etablissement.ts index a89a9b5af..d0f6cc274 100644 --- a/models/core/etablissement.ts +++ b/models/core/etablissement.ts @@ -15,13 +15,17 @@ import { verifySiret, } from '#utils/helpers'; import { isProtectedSiren } from '#utils/helpers/is-protected-siren-or-siret'; -import logErrorInSentry, { logFatalErrorInSentry } from '#utils/sentry'; +import logErrorInSentry, { + logFatalErrorInSentry, + logWarningInSentry, +} from '#utils/sentry'; import getSession from '#utils/server-side-helper/app/get-session'; import { shouldUseInsee } from '.'; import { EAdministration } from '../administrations/EAdministration'; import { APINotRespondingFactory, IAPINotRespondingError, + isAPI404, isAPINotResponding, } from '../api-not-responding'; import { FetchRessourceException, IExceptionContext } from '../exceptions'; @@ -81,6 +85,9 @@ const fetchFromClients = async ( ); if (!useInsee) { + if (isAPI404(etablissementRechercheEntreprise)) { + throw new SiretNotFoundError(siret); + } if (isAPINotResponding(etablissementRechercheEntreprise)) { throw new HttpServerError('Recherche failed, return 500'); } @@ -92,35 +99,57 @@ const fetchFromClients = async ( useCache, }); + /** + * Nowhere to be found + */ + if ( + isAPI404(etablissementRechercheEntreprise) && + isAPI404(etablissementInsee) + ) { + throw new SiretNotFoundError(siret); + } + if (isAPINotResponding(etablissementInsee)) { - if (isAPINotResponding(etablissementRechercheEntreprise)) { - const etablissmentInseeFallbacked = await fetchEtablissmentFromInsee( - siret, - { - useFallback: true, - useCache, - } - ); - if (isAPINotResponding(etablissmentInseeFallbacked)) { - throw new HttpServerError('Sirene Insee fallback failed, return 500'); - } - return etablissmentInseeFallbacked; + /*** + * Sirene Insee failed + */ + if (isAPI404(etablissementRechercheEntreprise)) { + throw new SiretNotFoundError(siret); + } else if (isAPINotResponding(etablissementRechercheEntreprise)) { + throw new HttpServerError('Both API failed'); } else { return etablissementRechercheEntreprise; } } else { - if (isAPINotResponding(etablissementRechercheEntreprise)) { + /** + * Sirene succeed but siret is not in recherhce or recherche failed + */ + if ( + isAPINotResponding(etablissementRechercheEntreprise) || + isAPI404(etablissementRechercheEntreprise) + ) { + logWarningInSentry( + new FetchRessourceException({ + ressource: 'UniteLegaleRecherche', + administration: EAdministration.DINUM, + message: 'Fail to find siret in recherche API', + context: { + siret, + }, + }) + ); return etablissementInsee; - } else { - return { - ...etablissementInsee, - complements: { - ...etablissementInsee?.complements, - ...etablissementRechercheEntreprise.complements, - }, - }; } } + + // default case + return { + ...etablissementInsee, + complements: { + ...etablissementInsee?.complements, + ...etablissementRechercheEntreprise.complements, + }, + }; }; const fetchEtablissmentFromInsee = async ( @@ -137,6 +166,13 @@ const fetchEtablissmentFromInsee = async ( throw new SiretNotFoundError(siret); } + if (!options.useFallback) { + return await fetchEtablissmentFromInsee(siret, { + ...options, + useFallback: true, + }); + } + logErrorInSentry( new FetchEtablissementException({ message: 'Fail to fetch from INSEE API', @@ -153,35 +189,34 @@ const fetchEtablissmentFromInsee = async ( const fetchEtablissementFromRechercheEntreprise = async ( siret: Siret, - useCache = false + useCache = false, + useFallback = false ): Promise => { try { return await clientEtablissementRechercheEntreprise(siret, useCache); - } catch (firstFallback: any) { - if (!(firstFallback instanceof HttpNotFound)) { - try { - const useFallback = true; - return await clientEtablissementRechercheEntreprise( - siret, - useCache, - useFallback - ); - } catch (eFallback: any) { - if (!(eFallback instanceof HttpNotFound)) { - logFatalErrorInSentry( - new FetchEtablissementException({ - message: 'Fail to fetch from Search API', - cause: firstFallback, - administration: EAdministration.DINUM, - context: { - siret, - }, - }) - ); - } - } + } catch (e: any) { + if (e instanceof HttpNotFound) { + return APINotRespondingFactory(EAdministration.DINUM, 404); + } + if (!useFallback) { + return await fetchEtablissementFromRechercheEntreprise( + siret, + useCache, + true + ); } + logFatalErrorInSentry( + new FetchEtablissementException({ + message: 'Fail to fetch from Search API', + cause: e, + administration: EAdministration.DINUM, + context: { + siret, + }, + }) + ); + return APINotRespondingFactory(EAdministration.DINUM, 500); } }; @@ -211,20 +246,28 @@ const getEtablissementWithUniteLegaleFromSlug = async ( const etablissement = await getEtablissementFromSlug(slug, { isBot, }); + const uniteLegale = await getUniteLegaleFromSlug(etablissement.siren, { isBot, }); + // only for insee as recherche already holds ancienSiege at etablissement level + if (uniteLegale.anciensSiegesSirets.indexOf(etablissement.siret)) { + etablissement.ancienSiege = true; + } + return { etablissement, uniteLegale }; }; /** * Download Etablissement and the Latitude/longitude + * */ const getEtablissementWithLatLongFromSlug = async ( slug: string ): Promise => { const etablissement = await getEtablissementFromSlug(slug); + if (!etablissement.latitude || !etablissement.longitude) { const { lat, long } = await getGeoLoc(etablissement); etablissement.latitude = lat; diff --git a/models/core/types.ts b/models/core/types.ts index 5e3091cf8..b19e12d9e 100644 --- a/models/core/types.ts +++ b/models/core/types.ts @@ -25,6 +25,7 @@ export interface IEtablissement { etatAdministratif: IETATADMINSTRATIF; statutDiffusion: ISTATUTDIFFUSION; estSiege: boolean; + ancienSiege: boolean; dateCreation: string; dateDerniereMiseAJour: string; dateMiseAJourInsee: string; @@ -87,7 +88,8 @@ export interface IUniteLegale extends IEtablissementsList { oldSiren: Siren; tva: ITVAIntracommunautaire | null; siege: IEtablissement; - allSiegesSiret: Siret[]; + // only used to pass information from unitelegale to the etablissement in insee response. Prefer etablissement.ancienSiege + anciensSiegesSirets: Siret[]; natureJuridique: string; libelleNatureJuridique: string; activitePrincipale: string; @@ -123,8 +125,8 @@ export const createDefaultUniteLegale = (siren: Siren): IUniteLegale => { siren, oldSiren: siren, siege, - allSiegesSiret: [], tva: null, + anciensSiegesSirets: [], statutDiffusion: ISTATUTDIFFUSION.DIFFUSIBLE, etatAdministratif: IETATADMINSTRATIF.INCONNU, nomComplet: '', diff --git a/models/core/unite-legale.ts b/models/core/unite-legale.ts index 2639f8227..89358cd99 100644 --- a/models/core/unite-legale.ts +++ b/models/core/unite-legale.ts @@ -16,6 +16,7 @@ import { shouldUseInsee } from '.'; import { EAdministration } from '../administrations/EAdministration'; import { APINotRespondingFactory, + IAPINotRespondingError, isAPI404, isAPINotResponding, } from '../api-not-responding'; @@ -161,20 +162,10 @@ class UniteLegaleBuilder { return uniteLegaleRechercheEntreprise; } - /** - * Siren in Sirene API, not in stocks - */ - if ( - isAPI404(uniteLegaleRechercheEntreprise) && - !isAPINotResponding(uniteLegaleInsee) - ) { - return uniteLegaleInsee; - } - - /*** - * Sirene Insee failed - */ if (isAPINotResponding(uniteLegaleInsee)) { + /*** + * Sirene Insee failed + */ if (isAPI404(uniteLegaleRechercheEntreprise)) { throw new SirenNotFoundError(this._siren); } else if (isAPINotResponding(uniteLegaleRechercheEntreprise)) { @@ -182,13 +173,26 @@ class UniteLegaleBuilder { } else { return uniteLegaleRechercheEntreprise; } - } - - /** - * Recherche failed - */ - if (isAPINotResponding(uniteLegaleRechercheEntreprise)) { - return uniteLegaleInsee; + } else { + /** + * Sirene succeed but siren not in recherhce or recherche failed + */ + if ( + isAPINotResponding(uniteLegaleRechercheEntreprise) || + isAPI404(uniteLegaleRechercheEntreprise) + ) { + logWarningInSentry( + new FetchRessourceException({ + ressource: 'UniteLegaleRecherche', + administration: EAdministration.DINUM, + message: 'Fail to find siren in recherche API', + context: { + siren: this._siren, + }, + }) + ); + return uniteLegaleInsee; + } } /** @@ -227,8 +231,9 @@ class UniteLegaleBuilder { const fetchUniteLegaleFromRechercheEntreprise = async ( siren: Siren, pageEtablissements: number, - useCache: boolean -) => { + useCache: boolean, + useFallback = false +): Promise => { try { const useFallback = false; return await clientUniteLegaleRechercheEntreprise( @@ -241,34 +246,26 @@ const fetchUniteLegaleFromRechercheEntreprise = async ( if (e instanceof HttpNotFound) { return APINotRespondingFactory(EAdministration.DINUM, 404); } - if (!(e instanceof HttpNotFound)) { - try { - const forceFallback = true; - return await clientUniteLegaleRechercheEntreprise( - siren, - pageEtablissements, - forceFallback, - useCache - ); - } catch (eFallback: any) { - if (eFallback instanceof HttpNotFound) { - return APINotRespondingFactory(EAdministration.DINUM, 404); - } - if (!(eFallback instanceof HttpNotFound)) { - logFatalErrorInSentry( - new FetchRessourceException({ - cause: eFallback, - ressource: 'UniteLegale', - administration: EAdministration.DINUM, - context: { - siren, - }, - }) - ); - } - } + if (!useFallback) { + const forceFallback = true; + return await fetchUniteLegaleFromRechercheEntreprise( + siren, + pageEtablissements, + forceFallback, + useCache + ); } - // we dont care about the type of exception here as HttpNotFound and HttpServerError will both be useless to us + logFatalErrorInSentry( + new FetchRessourceException({ + cause: e, + ressource: 'UniteLegale', + administration: EAdministration.DINUM, + context: { + siren, + }, + }) + ); + return APINotRespondingFactory(EAdministration.DINUM, 500); } }; @@ -280,7 +277,7 @@ const fetchUniteLegaleFromInsee = async ( siren: Siren, page = 1, inseeOptions: InseeClientOptions -) => { +): Promise => { try { return await clientUniteLegaleInsee(siren, page, inseeOptions); } catch (e: any) { @@ -295,6 +292,13 @@ const fetchUniteLegaleFromInsee = async ( return APINotRespondingFactory(EAdministration.INSEE, 404); } + if (!inseeOptions.useFallback) { + return await fetchUniteLegaleFromInsee(siren, page, { + ...inseeOptions, + useFallback: true, + }); + } + logWarningInSentry( new FetchRessourceException({ ressource: 'UniteLegaleInsee',