From 430326a712aed5abb0b03c3f252bf2c4d5122337 Mon Sep 17 00:00:00 2001 From: xavier jouppe Date: Thu, 15 Aug 2024 17:26:26 +0200 Subject: [PATCH 01/16] feat: split justificatif into /documents and /entreprise and /annonces --- .../a-propos/donnees-extrait-kbis/page.tsx | 7 +- .../annonces/[slug]/_components}/bodacc.tsx | 0 .../annonces/[slug]/_components}/joafe.tsx | 0 .../[slug]/_components/observations-rne.tsx | 59 +++++ app/(header-default)/annonces/[slug]/page.tsx | 14 +- .../_components/justificatifs/index.tsx | 26 ++ .../_components/justificatifs}/insee.tsx | 4 +- .../_components/justificatifs/joafe.tsx | 78 ++++++ .../[slug]/_components/justificatifs/rne.tsx | 88 +++++++ .../[slug]/_components/summary-documents.tsx | 3 + .../documents/[slug]/page.tsx | 10 +- .../[slug]/_components}/bodacc.tsx | 0 .../[slug]/_components}/dca.tsx | 0 .../donnees-financieres/[slug]/page.tsx | 6 +- .../entreprise/[slug]/page.tsx | 10 +- .../[slug]/_components/container.tsx | 97 -------- .../justificatif/[slug]/_components/index.tsx | 45 ---- .../justificatif/[slug]/_components/joafe.tsx | 71 ------ .../justificatif/[slug]/_components/rne.tsx | 227 ------------------ .../[slug]/_components/summary.tsx | 71 ------ .../justificatif/[slug]/page.tsx | 60 ----- app/robots.ts | 1 - clients/recherche-entreprise/index.ts | 37 ++- clients/recherche-entreprise/interface.ts | 13 + clients/recherche-entreprise/siren.ts | 3 +- clients/recherche-entreprise/siret.ts | 4 +- clients/sirene-insee/siren.ts | 1 + components-ui/badge/frequent.tsx | 2 +- .../summary-section.tsx | 18 +- components/title-section/tabs/index.tsx | 15 +- .../index.tsx | 75 ++++++ components/unite-legale-section/index.tsx | 87 +++++-- components/useful-shortcuts/index.tsx | 151 ------------ components/useful-shortcuts/styles.module.css | 26 -- models/core/types.ts | 15 ++ models/core/unite-legale.ts | 1 + models/immatriculation/joafe.ts | 77 ------ models/search.ts | 4 +- 38 files changed, 516 insertions(+), 890 deletions(-) rename {components/annonces-section/annonces => app/(header-default)/annonces/[slug]/_components}/bodacc.tsx (100%) rename {components/annonces-section/annonces => app/(header-default)/annonces/[slug]/_components}/joafe.tsx (100%) create mode 100644 app/(header-default)/annonces/[slug]/_components/observations-rne.tsx create mode 100644 app/(header-default)/documents/[slug]/_components/justificatifs/index.tsx rename app/(header-default)/{justificatif/[slug]/_components => documents/[slug]/_components/justificatifs}/insee.tsx (98%) create mode 100644 app/(header-default)/documents/[slug]/_components/justificatifs/joafe.tsx create mode 100644 app/(header-default)/documents/[slug]/_components/justificatifs/rne.tsx rename {components/annonces-section/comptes => app/(header-default)/donnees-financieres/[slug]/_components}/bodacc.tsx (100%) rename {components/annonces-section/comptes => app/(header-default)/donnees-financieres/[slug]/_components}/dca.tsx (100%) delete mode 100644 app/(header-default)/justificatif/[slug]/_components/container.tsx delete mode 100644 app/(header-default)/justificatif/[slug]/_components/index.tsx delete mode 100644 app/(header-default)/justificatif/[slug]/_components/joafe.tsx delete mode 100644 app/(header-default)/justificatif/[slug]/_components/rne.tsx delete mode 100644 app/(header-default)/justificatif/[slug]/_components/summary.tsx delete mode 100644 app/(header-default)/justificatif/[slug]/page.tsx create mode 100644 components/unite-legale-immatriculation-section/index.tsx delete mode 100644 components/useful-shortcuts/index.tsx delete mode 100644 components/useful-shortcuts/styles.module.css delete mode 100644 models/immatriculation/joafe.ts diff --git a/app/(header-default)/a-propos/donnees-extrait-kbis/page.tsx b/app/(header-default)/a-propos/donnees-extrait-kbis/page.tsx index dc2f07588..083e9e30f 100644 --- a/app/(header-default)/a-propos/donnees-extrait-kbis/page.tsx +++ b/app/(header-default)/a-propos/donnees-extrait-kbis/page.tsx @@ -1,6 +1,6 @@ -import { Metadata } from 'next'; import TextWrapper from '#components-ui/text-wrapper'; import { INPI, INSEE } from '#components/administrations'; +import { Metadata } from 'next'; export const metadata: Metadata = { title: 'Comment retrouver les données contenues dans un extrait KBIS ou D1 ?', @@ -52,8 +52,7 @@ export default function ExtraitKbis() { de l’entreprise concernée.

- Une fois sur la page de l’entreprise, consultez l’onglet{' '} - justificatifs et retrouvez-y les données + Une fois sur la page de l’entreprise, retrouvez les données d’immatriculations issues du Registre National des Entreprises (RNE) tenu par l’ . @@ -81,7 +80,7 @@ export default function ExtraitKbis() { NB : le lien se construit ainsi :

- https://annuaire-entreprises.data.gouv.fr/justificatif/ + https://annuaire-entreprises.data.gouv.fr/entreprise/ {'{insérer_le_numéro_siren}'}

diff --git a/components/annonces-section/annonces/bodacc.tsx b/app/(header-default)/annonces/[slug]/_components/bodacc.tsx similarity index 100% rename from components/annonces-section/annonces/bodacc.tsx rename to app/(header-default)/annonces/[slug]/_components/bodacc.tsx diff --git a/components/annonces-section/annonces/joafe.tsx b/app/(header-default)/annonces/[slug]/_components/joafe.tsx similarity index 100% rename from components/annonces-section/annonces/joafe.tsx rename to app/(header-default)/annonces/[slug]/_components/joafe.tsx diff --git a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx new file mode 100644 index 000000000..88129c7fc --- /dev/null +++ b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx @@ -0,0 +1,59 @@ +'use client'; + +import { Tag } from '#components-ui/tag'; +import { AsyncDataSectionClient } from '#components/section/data-section/client'; +import { FullTable } from '#components/table/full'; +import { EAdministration } from '#models/administrations/EAdministration'; +import { IUniteLegale } from '#models/core/types'; +import { ISession } from '#models/user/session'; +import { useAPIRouteData } from 'hooks/fetch/use-API-route-data'; + +export const ObservationsRNE: React.FC<{ + uniteLegale: IUniteLegale; + session: ISession | null; +}> = ({ uniteLegale, session }) => { + const immatriculationRNE = useAPIRouteData('rne', uniteLegale.siren, session); + + return ( + + Cette structure ne possède pas de fiche d’immatriculation au{' '} + Registre National des Entreprises (RNE) + + } + > + {(immatriculationRNE) => + immatriculationRNE.observations && + immatriculationRNE.observations.length > 0 ? ( + <> +
+

+ Cette structure possède également{' '} + {immatriculationRNE.observations.length} observation(s) au{' '} + RNE +  : +

+ [ + o.dateAjout, + o.numObservation ? {o.numObservation} : '', + o.description, + ])} + /> + + ) : ( + <> + Cette structure ne possède pas d’observations au{' '} + Registre National des Entreprises (RNE) + + ) + } +
+ ); +}; diff --git a/app/(header-default)/annonces/[slug]/page.tsx b/app/(header-default)/annonces/[slug]/page.tsx index 54b52b8e3..be39795d2 100644 --- a/app/(header-default)/annonces/[slug]/page.tsx +++ b/app/(header-default)/annonces/[slug]/page.tsx @@ -1,6 +1,3 @@ -import { Metadata } from 'next'; -import AnnoncesBodacc from '#components/annonces-section/annonces/bodacc'; -import AnnoncesJOAFESection from '#components/annonces-section/annonces/joafe'; import { DonneesPriveesSection } from '#components/donnees-privees-section'; import Title from '#components/title-section'; import { FICHE } from '#components/title-section/tabs'; @@ -16,6 +13,10 @@ import extractParamsAppRouter, { AppRouterProps, } from '#utils/server-side-helper/app/extract-params'; import getSession from '#utils/server-side-helper/app/get-session'; +import AnnoncesBodacc from 'app/(header-default)/annonces/[slug]/_components/bodacc'; +import AnnoncesJOAFESection from 'app/(header-default)/annonces/[slug]/_components/joafe'; +import { Metadata } from 'next'; +import { ObservationsRNE } from './_components/observations-rne'; export const generateMetadata = async ( props: AppRouterProps @@ -50,7 +51,12 @@ const AnnoncesPage = async (props: AppRouterProps) => { /> {estDiffusible(uniteLegale) || hasRights(session, EScope.nonDiffusible) ? ( - + <> + + {uniteLegale.dateMiseAJourInpi && ( + + )} + ) : ( )} diff --git a/app/(header-default)/documents/[slug]/_components/justificatifs/index.tsx b/app/(header-default)/documents/[slug]/_components/justificatifs/index.tsx new file mode 100644 index 000000000..4e18f1571 --- /dev/null +++ b/app/(header-default)/documents/[slug]/_components/justificatifs/index.tsx @@ -0,0 +1,26 @@ +import { IUniteLegale, isAssociation } from '#models/core/types'; +import { ISession } from '#models/user/session'; +import AvisSituationSection from './insee'; +import { JustificatifImmatriculationJOAFE } from './joafe'; +import { JustificatifImmatriculationRNE } from './rne'; + +const JustificatifsSection: React.FC<{ + uniteLegale: IUniteLegale; + session: ISession | null; +}> = ({ uniteLegale, session }) => { + return ( + <> + {isAssociation(uniteLegale) && ( + + )} + {uniteLegale.dateMiseAJourInpi && ( + + )} + + + ); +}; +export default JustificatifsSection; diff --git a/app/(header-default)/justificatif/[slug]/_components/insee.tsx b/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx similarity index 98% rename from app/(header-default)/justificatif/[slug]/_components/insee.tsx rename to app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx index f63dcfd93..045da286f 100644 --- a/app/(header-default)/justificatif/[slug]/_components/insee.tsx +++ b/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import ButtonLink from '#components-ui/button'; import IsActiveTag from '#components-ui/is-active-tag'; import { Tag } from '#components-ui/tag'; @@ -12,6 +11,7 @@ import { IEtablissement, IUniteLegale } from '#models/core/types'; import { EScope, hasRights } from '#models/user/rights'; import { ISession } from '#models/user/session'; import { formatSiret } from '#utils/helpers'; +import React from 'react'; const AvisSituationTable: React.FC<{ etablissements: IEtablissement[]; @@ -65,7 +65,7 @@ const AvisSituationNonDiffusible = () => ( const AvisSituationSection: React.FC = ({ uniteLegale, session }) => (
{!estDiffusible(uniteLegale) && diff --git a/app/(header-default)/documents/[slug]/_components/justificatifs/joafe.tsx b/app/(header-default)/documents/[slug]/_components/justificatifs/joafe.tsx new file mode 100644 index 000000000..9288c51df --- /dev/null +++ b/app/(header-default)/documents/[slug]/_components/justificatifs/joafe.tsx @@ -0,0 +1,78 @@ +'use client'; + +import AssociationCreationNotFoundAlert from '#components-ui/alerts-with-explanations/association-creation-not-found-alert'; +import ButtonLink from '#components-ui/button'; +import { Icon } from '#components-ui/icon/wrapper'; +import { PrintNever } from '#components-ui/print-visibility'; +import { AsyncDataSectionClient } from '#components/section/data-section/client'; +import { EAdministration } from '#models/administrations/EAdministration'; +import { IAssociation } from '#models/core/types'; +import { formatDate, formatIntFr } from '#utils/helpers'; +import { useFetchJOAFE } from 'hooks'; +import React from 'react'; +import { TwoColumnTable } from '../../../../../../components/table/simple'; + +type IProps = { + uniteLegale: IAssociation; +}; + +export const JustificatifImmatriculationJOAFE: React.FC = ({ + uniteLegale, +}) => { + const annoncesJOAFE = useFetchJOAFE(uniteLegale); + + return ( + + } + > + {(annoncesJOAFE) => { + const annonceCreation = annoncesJOAFE.annonces.find( + (annonce) => annonce.typeAvisLibelle === 'Création' + ); + + if (typeof annonceCreation === 'undefined') { + return ; + } else { + const downloadLink = annonceCreation.path + '?format=pdf'; + + const data = [ + ['Siren', formatIntFr(uniteLegale.siren)], + ['N°RNA', formatIntFr(uniteLegale.association.idAssociation)], + [ + 'Date d’enregistrement', + formatDate(annonceCreation.datePublication), + ], + ]; + return ( + <> +

+ Cette structure est enregistrée au{' '} + Journal Officiel des Association (JOAFE). +

+ + {downloadLink && ( + +

+ Pour accéder à l’annonce de création de l’association, + téléchargez le document ci-dessous : +

+
+ + Télécharger le justificatif + +
+
+ )} + + ); + } + }} +
+ ); +}; diff --git a/app/(header-default)/documents/[slug]/_components/justificatifs/rne.tsx b/app/(header-default)/documents/[slug]/_components/justificatifs/rne.tsx new file mode 100644 index 000000000..9fef93856 --- /dev/null +++ b/app/(header-default)/documents/[slug]/_components/justificatifs/rne.tsx @@ -0,0 +1,88 @@ +import routes from '#clients/routes'; +import ButtonLink from '#components-ui/button'; +import { Icon } from '#components-ui/icon/wrapper'; +import { PrintNever } from '#components-ui/print-visibility'; +import { INPI } from '#components/administrations'; +import { Section } from '#components/section'; +import { EAdministration } from '#models/administrations/EAdministration'; +import { estDiffusible } from '#models/core/diffusion'; +import { IUniteLegale } from '#models/core/types'; +import { EScope, hasRights } from '#models/user/rights'; +import { ISession } from '#models/user/session'; + +export const JustificatifImmatriculationRNE = ({ + uniteLegale, + session, +}: { + uniteLegale: IUniteLegale; + session: ISession | null; +}) => { + const siteLink = `${routes.rne.portail.entreprise}${uniteLegale.siren}`; + + if ( + !estDiffusible(uniteLegale) && + !hasRights(session, EScope.nonDiffusible) + ) { + return ( +
+ Le(s) dirigeant(s) se sont opposés à la diffusion de leurs données + personnelles. Pour télécharger l’extrait d’immatriculation de cette + entreprise, rendez-vous sur le site{' '} + data.inpi.fr. +
+ ); + } + return ( +
+ +

+ Pour accéder aux données contenues dans un extrait d’immatriculation + (équivalent de{' '} + + l’extrait KBIS ou D1 + + ), vous pouvez soit télécharger le{' '} + + justificatif d’immatriculation au Registre National des Entreprises + (RNE) + + , soit consulter la fiche complète sur le site de l’ + +  : +

+
    +
  • + + + Télécharger le justificatif d’immatriculation + + +
  • +
  • + + ⇢ Voir la fiche sur le site de l’INPI + +
  • +
+
+
+ ); +}; diff --git a/app/(header-default)/documents/[slug]/_components/summary-documents.tsx b/app/(header-default)/documents/[slug]/_components/summary-documents.tsx index 6270da339..35dd1c53a 100644 --- a/app/(header-default)/documents/[slug]/_components/summary-documents.tsx +++ b/app/(header-default)/documents/[slug]/_components/summary-documents.tsx @@ -7,6 +7,9 @@ export const SummaryDocuments = ({ session }: { session: ISession | null }) => ( Documents disponibles pour cette structure :
    +
  • + Justificatifs d’immatriculation +
  • {hasRights(session, EScope.conformite) && (
  • Attestations de conformite diff --git a/app/(header-default)/documents/[slug]/page.tsx b/app/(header-default)/documents/[slug]/page.tsx index 29acc1bfe..ca05ec3de 100644 --- a/app/(header-default)/documents/[slug]/page.tsx +++ b/app/(header-default)/documents/[slug]/page.tsx @@ -1,4 +1,5 @@ -import { Metadata } from 'next'; +import { HorizontalSeparator } from '#components-ui/horizontal-separator'; +import BreakPageForPrint from '#components-ui/print-break-page'; import { PrintNever } from '#components-ui/print-visibility'; import ConformiteSection from '#components/espace-agent-components/conformite-section'; import Title from '#components/title-section'; @@ -13,8 +14,10 @@ import extractParamsAppRouter, { AppRouterProps, } from '#utils/server-side-helper/app/extract-params'; import getSession from '#utils/server-side-helper/app/get-session'; +import { Metadata } from 'next'; import ActesSection from './_components/actes'; import CarteProfessionnelleTPSection from './_components/carte-professionnelle-TP-section'; +import JustificatifsSection from './_components/justificatifs'; import { SummaryDocuments } from './_components/summary-documents'; export const generateMetadata = async ( @@ -47,8 +50,11 @@ const UniteLegaleDocumentPage = async (props: AppRouterProps) => { ficheType={FICHE.DOCUMENTS} session={session} /> + + + + - {hasRights(session, EScope.conformite) && ( )} diff --git a/components/annonces-section/comptes/bodacc.tsx b/app/(header-default)/donnees-financieres/[slug]/_components/bodacc.tsx similarity index 100% rename from components/annonces-section/comptes/bodacc.tsx rename to app/(header-default)/donnees-financieres/[slug]/_components/bodacc.tsx diff --git a/components/annonces-section/comptes/dca.tsx b/app/(header-default)/donnees-financieres/[slug]/_components/dca.tsx similarity index 100% rename from components/annonces-section/comptes/dca.tsx rename to app/(header-default)/donnees-financieres/[slug]/_components/dca.tsx diff --git a/app/(header-default)/donnees-financieres/[slug]/page.tsx b/app/(header-default)/donnees-financieres/[slug]/page.tsx index 4a3b6cf9e..2f3b9ae47 100644 --- a/app/(header-default)/donnees-financieres/[slug]/page.tsx +++ b/app/(header-default)/donnees-financieres/[slug]/page.tsx @@ -1,7 +1,4 @@ -import { Metadata } from 'next'; import { HorizontalSeparator } from '#components-ui/horizontal-separator'; -import ComptesBodacc from '#components/annonces-section/comptes/bodacc'; -import { ComptesAssociationSection } from '#components/annonces-section/comptes/dca'; import { FinancesAssociationSection } from '#components/finances-section/association'; import { FinancesSocieteSection } from '#components/finances-section/societe'; import Title from '#components/title-section'; @@ -13,6 +10,9 @@ import extractParamsAppRouter, { AppRouterProps, } from '#utils/server-side-helper/app/extract-params'; import getSession from '#utils/server-side-helper/app/get-session'; +import ComptesBodacc from 'app/(header-default)/donnees-financieres/[slug]/_components/bodacc'; +import { ComptesAssociationSection } from 'app/(header-default)/donnees-financieres/[slug]/_components/dca'; +import { Metadata } from 'next'; import BilansSection from './_components'; export const generateMetadata = async ( diff --git a/app/(header-default)/entreprise/[slug]/page.tsx b/app/(header-default)/entreprise/[slug]/page.tsx index b2087312e..c6d861938 100644 --- a/app/(header-default)/entreprise/[slug]/page.tsx +++ b/app/(header-default)/entreprise/[slug]/page.tsx @@ -1,4 +1,4 @@ -import { Metadata } from 'next'; +import { HorizontalSeparator } from '#components-ui/horizontal-separator'; import AssociationSection from '#components/association-section'; import CollectiviteTerritorialeSection from '#components/collectivite-territoriale-section'; import { EspaceAgentSummarySection } from '#components/espace-agent-components/summary-section'; @@ -10,8 +10,8 @@ import ServicePublicSection from '#components/service-public-section'; import StructuredDataBreadcrumb from '#components/structured-data/breadcrumb'; import Title from '#components/title-section'; import { FICHE } from '#components/title-section/tabs'; +import { UniteLegaleImmatriculationSection } from '#components/unite-legale-immatriculation-section'; import UniteLegaleSection from '#components/unite-legale-section'; -import UsefulShortcuts from '#components/useful-shortcuts'; import { estNonDiffusibleStrict } from '#models/core/diffusion'; import { isAssociation, @@ -29,6 +29,7 @@ import extractParamsAppRouter, { AppRouterProps, } from '#utils/server-side-helper/app/extract-params'; import getSession from '#utils/server-side-helper/app/get-session'; +import { Metadata } from 'next'; export const generateMetadata = async ( props: AppRouterProps @@ -75,6 +76,9 @@ export default async function UniteLegalePage(props: AppRouterProps) { session={session} /> )} + {uniteLegale.immatriculation && ( + + )} {isCollectiviteTerritoriale(uniteLegale) && ( )} @@ -85,7 +89,7 @@ export default async function UniteLegalePage(props: AppRouterProps) { {!isBot && isAssociation(uniteLegale) && ( )} - + {uniteLegale.siege && ( { - return ( - isAPINotResponding(immatriculation) && immatriculation.errorType === 404 - ); -}; - -export interface IJustificatifs { - uniteLegale: IUniteLegale; - immatriculationJOAFE: IImmatriculationJOAFE | IAPINotRespondingError; - immatriculationRNE: IImmatriculationRNE | IAPINotRespondingError; -} - -interface IProps extends IJustificatifs { - session: ISession | null; -} - -export const ImmatriculationsSection: React.FC = ({ - immatriculationJOAFE, - immatriculationRNE, - uniteLegale, - session, -}) => { - const isAnAssociation = isAssociation(uniteLegale); - - const noAssociationImmatriculation = - !isAnAssociation || (isAnAssociation && isNotFound(immatriculationJOAFE)); - - const noRNEImmatriculation = isNotFound(immatriculationRNE); - - const noImmatriculation = - noAssociationImmatriculation && noRNEImmatriculation; - - return ( - <> - - {noImmatriculation ? ( - <> - {isAssociation(uniteLegale) ? ( - <> - -
    - - ) : isServicePublic(uniteLegale) ? null : ( - <> - -
    - - )} - - ) : ( - <> - {isAnAssociation && ( - - )} - {!noRNEImmatriculation && !isServicePublic(uniteLegale) && ( - - )} - - )} - - - - ); -}; diff --git a/app/(header-default)/justificatif/[slug]/_components/index.tsx b/app/(header-default)/justificatif/[slug]/_components/index.tsx deleted file mode 100644 index 0718804ee..000000000 --- a/app/(header-default)/justificatif/[slug]/_components/index.tsx +++ /dev/null @@ -1,45 +0,0 @@ -'use client'; - -import { Loader } from '#components-ui/loader'; -import { ClientErrorExplanations } from '#components/error-explanations'; -import { IUniteLegale } from '#models/core/types'; -import { - hasFetchError, - isDataLoading, - isUnauthorized, -} from '#models/data-fetching'; -import { ISession } from '#models/user/session'; -import { useTimeout } from 'hooks'; -import { useAPIRouteData } from 'hooks/fetch/use-API-route-data'; -import { IJustificatifs, ImmatriculationsSection } from './container'; - -const Immatriculations: React.FC<{ - uniteLegale: IUniteLegale; - immatriculationJOAFE: IJustificatifs['immatriculationJOAFE']; - session: ISession | null; -}> = ({ uniteLegale, immatriculationJOAFE, session }) => { - const immatriculationRNE = useAPIRouteData('rne', uniteLegale.siren, session); - const after100ms = useTimeout(100); - if (hasFetchError(immatriculationRNE) || isUnauthorized(immatriculationRNE)) { - return ; - } - if (isDataLoading(immatriculationRNE)) { - return ( - after100ms && ( - <> - Chargement des données en cours - - ) - ); - } - return ( - - ); -}; - -export default Immatriculations; diff --git a/app/(header-default)/justificatif/[slug]/_components/joafe.tsx b/app/(header-default)/justificatif/[slug]/_components/joafe.tsx deleted file mode 100644 index cfdc0e35f..000000000 --- a/app/(header-default)/justificatif/[slug]/_components/joafe.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import React from 'react'; -import ButtonLink from '#components-ui/button'; -import { Icon } from '#components-ui/icon/wrapper'; -import BreakPageForPrint from '#components-ui/print-break-page'; -import { PrintNever } from '#components-ui/print-visibility'; -import { DataSection } from '#components/section/data-section'; -import { EAdministration } from '#models/administrations/EAdministration'; -import { IAPINotRespondingError } from '#models/api-not-responding'; -import { IImmatriculationJOAFE } from '#models/immatriculation/joafe'; -import { formatDate, formatIntFr } from '#utils/helpers'; -import { TwoColumnTable } from '../../../../../components/table/simple'; - -type IProps = { - immatriculation: IImmatriculationJOAFE | IAPINotRespondingError; -}; - -const ImmatriculationJOAFE: React.FC = ({ immatriculation }) => ( - <> - - Cette structure n’est pas enregistrée au{' '} - Journal Officiel des Associations (JOAFE). - - } - > - {(immatriculation) => { - const data = [ - ['Siren', formatIntFr(immatriculation.siren)], - ['N°RNA', formatIntFr(immatriculation.idRna)], - [ - 'Date d’enregistrement', - formatDate(immatriculation.datePublication), - ], - ]; - return ( - <> -

    - Cette structure est enregistrée au{' '} - Journal Officiel des Association (JOAFE). -

    - - {immatriculation.downloadLink && ( - -

    - Pour accéder à l’annonce de création de l’association, - téléchargez le document ci-dessous : -

    -
    - - Télécharger le justificatif - -
    -
    - )} - - ); - }} -
    - - -); - -export default ImmatriculationJOAFE; diff --git a/app/(header-default)/justificatif/[slug]/_components/rne.tsx b/app/(header-default)/justificatif/[slug]/_components/rne.tsx deleted file mode 100644 index 8f6186357..000000000 --- a/app/(header-default)/justificatif/[slug]/_components/rne.tsx +++ /dev/null @@ -1,227 +0,0 @@ -import React from 'react'; -import routes from '#clients/routes'; -import { OpenClosedTag } from '#components-ui/badge/frequent'; -import ButtonLink from '#components-ui/button'; -import { HorizontalSeparator } from '#components-ui/horizontal-separator'; -import { Icon } from '#components-ui/icon/wrapper'; -import { PrintNever } from '#components-ui/print-visibility'; -import { Tag } from '#components-ui/tag'; -import { INPI } from '#components/administrations'; -import { DataSection } from '#components/section/data-section'; -import { FullTable } from '#components/table/full'; -import { TwoColumnTable } from '#components/table/simple'; -import { EAdministration } from '#models/administrations/EAdministration'; -import { IAPINotRespondingError } from '#models/api-not-responding'; -import { - defaultNonDiffusiblePlaceHolder, - estDiffusible, -} from '#models/core/diffusion'; -import { IUniteLegale } from '#models/core/types'; -import { IImmatriculationRNE } from '#models/immatriculation'; -import { formatDate, formatIntFr } from '#utils/helpers'; - -type IProps = { - immatriculation: IImmatriculationRNE | IAPINotRespondingError; - uniteLegale: IUniteLegale; -}; - -const ImmatriculationLinks = ({ - uniteLegale, - siteLink, -}: { - uniteLegale: IUniteLegale; - siteLink?: string; -}) => { - if (!estDiffusible(uniteLegale)) { - return ( -

    - Le(s) dirigeant(s) se sont opposés à la diffusion de leurs données - personnelles. Pour télécharger l’extrait d’immatriculation de cette - entreprise, rendez-vous sur le site{' '} - data.inpi.fr. -

    - ); - } - return ( - <> - -

    - Pour accéder aux données contenues dans un extrait d’immatriculation - (équivalent de{' '} - - l’extrait KBIS ou D1 - - ), vous pouvez soit télécharger le{' '} - - justificatif d’immatriculation au Registre National des Entreprises - (RNE) - - , soit consulter la fiche complète sur le site de l’ - -  : -

    -
      -
    • - - - Télécharger le justificatif d’immatriculation - - -
    • -
    • - - ⇢ Voir la fiche sur le site de l’INPI - -
    • -
    -
    - - ); -}; - -const ImmatriculationRNE: React.FC = ({ - immatriculation, - uniteLegale, -}) => { - return ( - <> - - Cette structure ne possède pas de fiche d’immatriculation au{' '} - Registre National des Entreprises (RNE) - - } - additionalInfoOnError={ - - } - > - {(immatriculation) => ( - <> -

    - Cette structure possède une fiche d’immatriculation au{' '} - Registre National des Entreprises (RNE) qui liste - les entreprises de France et qui est tenu par l’ - . -

    - - - - - {immatriculation.observations && - immatriculation.observations.length > 0 ? ( - <> -
    -

    - Cette structure possède également{' '} - {immatriculation.observations.length} observation(s) au{' '} - RNE -  : -

    - [ - o.dateAjout, - o.numObservation ? {o.numObservation} : '', - o.description, - ])} - /> - - ) : null} - - )} -
    - - - ); -}; - -const ImmatriculationRNETable: React.FC<{ - immatriculation: IImmatriculationRNE; - uniteLegale: IUniteLegale; -}> = ({ immatriculation, uniteLegale }) => { - const { dateRadiation, dateCessationActivite, isPersonneMorale } = - immatriculation.identite; - - const data = [ - [ - 'Statut', - , - ], - [ - 'Date d’immatriculation au RNE', - formatDate(immatriculation.identite.dateImmatriculation), - ], - [ - 'Dénomination', - estDiffusible(uniteLegale) - ? immatriculation.identite.denomination - : defaultNonDiffusiblePlaceHolder, - ], - ['Siren', formatIntFr(uniteLegale.siren)], - ['Nature de l’entreprise', immatriculation.identite.natureEntreprise], - ['Forme juridique', immatriculation.identite.libelleNatureJuridique], - [ - 'Dirigeant(s)', - - → voir les dirigeants - , - ], - [ - 'Siège social', - - → voir le détail du siège social - , - ], - [ - 'Date de début d’activité', - formatDate(immatriculation.identite.dateDebutActiv), - ], - ...(isPersonneMorale - ? [ - ['Capital', immatriculation.identite.capital], - [ - 'Date de clôture de l’exercice comptable', - immatriculation.identite.dateClotureExercice, - ], - [ - 'Durée de la personne morale', - immatriculation.identite.dureePersonneMorale, - ], - ] - : []), - ...(dateCessationActivite - ? [['Date de cessation d’activité', formatDate(dateCessationActivite)]] - : []), - ...(dateRadiation - ? [['Date de radiation', formatDate(dateRadiation)]] - : []), - ]; - - return ; -}; - -export default ImmatriculationRNE; diff --git a/app/(header-default)/justificatif/[slug]/_components/summary.tsx b/app/(header-default)/justificatif/[slug]/_components/summary.tsx deleted file mode 100644 index 2cc810db3..000000000 --- a/app/(header-default)/justificatif/[slug]/_components/summary.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { isAPINotResponding } from '#models/api-not-responding'; -import { estActif } from '#models/core/etat-administratif'; -import { formatDateLong } from '#utils/helpers'; -import { IJustificatifs } from './container'; - -const ImmatriculationSummary: React.FC = ({ - uniteLegale, - immatriculationJOAFE, - immatriculationRNE, -}) => { - return ( - - ); -}; - -export default ImmatriculationSummary; diff --git a/app/(header-default)/justificatif/[slug]/page.tsx b/app/(header-default)/justificatif/[slug]/page.tsx deleted file mode 100644 index e18657dc5..000000000 --- a/app/(header-default)/justificatif/[slug]/page.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { Metadata } from 'next'; -import Title from '#components/title-section'; -import { FICHE } from '#components/title-section/tabs'; -import { getImmatriculationJOAFE } from '#models/immatriculation/joafe'; -import { - uniteLegalePageDescription, - uniteLegalePageTitle, -} from '#utils/helpers'; -import { cachedGetUniteLegale } from '#utils/server-side-helper/app/cached-methods'; -import extractParamsAppRouter, { - AppRouterProps, -} from '#utils/server-side-helper/app/extract-params'; -import getSession from '#utils/server-side-helper/app/get-session'; -import Immatriculations from './_components'; - -export const generateMetadata = async ( - props: AppRouterProps -): Promise => { - const { slug, isBot } = extractParamsAppRouter(props); - const uniteLegale = await cachedGetUniteLegale(slug, isBot); - - return { - title: `Justificatif d’immatriculation - ${uniteLegalePageTitle( - uniteLegale - )}`, - description: uniteLegalePageDescription(uniteLegale), - robots: 'follow, noindex', - alternates: { - canonical: `https://annuaire-entreprises.data.gouv.fr/justificatif/${uniteLegale.siren}`, - }, - }; -}; - -const JustificatifPage = async (props: AppRouterProps) => { - const { slug, isBot } = extractParamsAppRouter(props); - const uniteLegale = await cachedGetUniteLegale(slug, isBot); - - const immatriculationJOAFE = await getImmatriculationJOAFE(uniteLegale); - const session = await getSession(); - return ( - <> -
    - - {!isBot && ( - <Immatriculations - uniteLegale={uniteLegale} - immatriculationJOAFE={immatriculationJOAFE} - session={session} - /> - )} - </div> - </> - ); -}; - -export default JustificatifPage; diff --git a/app/robots.ts b/app/robots.ts index 90219456c..39d8ae08d 100644 --- a/app/robots.ts +++ b/app/robots.ts @@ -22,7 +22,6 @@ export default function robots(): MetadataRoute.Robots { '/departements/', '/etablissement/', '/lp/', - '/justificatif/', '/documents/', '/donnees-financieres/', '/annonces/', diff --git a/clients/recherche-entreprise/index.ts b/clients/recherche-entreprise/index.ts index 39ec70d43..ff8af58d5 100644 --- a/clients/recherche-entreprise/index.ts +++ b/clients/recherche-entreprise/index.ts @@ -42,11 +42,12 @@ import { type ClientSearchRechercheEntreprise = { searchTerms: string; - page: number; + pageResultatsRecherche: number; searchFilterParams?: SearchFilterParams; fallbackOnStaging?: boolean; useCache?: boolean; inclureEtablissements?: boolean; + inclureImmatriculation?: boolean; pageEtablissements?: number; }; @@ -55,11 +56,12 @@ type ClientSearchRechercheEntreprise = { */ const clientSearchRechercheEntreprise = async ({ searchTerms, - page, searchFilterParams, fallbackOnStaging = false, useCache = false, inclureEtablissements = false, + inclureImmatriculation = false, + pageResultatsRecherche, pageEtablissements = 1, }: ClientSearchRechercheEntreprise): Promise<ISearchResults> => { const encodedTerms = encodeURIComponent(searchTerms); @@ -77,7 +79,7 @@ const clientSearchRechercheEntreprise = async ({ } let url = route; - url += `?per_page=10&page=${page}&q=${encodedTerms}&limite_matching_etablissements=3${ + url += `?per_page=10&page=${pageResultatsRecherche}&q=${encodedTerms}&limite_matching_etablissements=3${ searchFilterParams?.toApiURI() || '' }`; url += `&include_admin=slug`; @@ -85,6 +87,11 @@ const clientSearchRechercheEntreprise = async ({ if (inclureEtablissements) { url += `,etablissements`; } + + if (inclureImmatriculation) { + url += `,immatriculation`; + } + if (inclureEtablissements && pageEtablissements) { url += `&page_etablissements=${pageEtablissements}`; } @@ -95,6 +102,7 @@ const clientSearchRechercheEntreprise = async ({ ? constants.timeout.XL : constants.timeout.L; + console.log(url); const results = await httpGet<ISearchResponse>(url, { timeout, headers: { referer: 'annuaire-entreprises-site' }, @@ -147,6 +155,17 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { est_siae = false, type_siae = '', }, + immatriculation: { + date_debut_activite = '', + date_immatriculation = '', + date_radiation = '', + duree_personne_morale, + nature_entreprise = [], + date_cloture_exercice = '', + capital_social, + capital_variable = false, + devise_capital = '', + }, matching_etablissements, categorie_entreprise, annee_categorie_entreprise = null, @@ -250,6 +269,18 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { estEntrepriseInclusive: est_siae, typeEntrepriseInclusive: type_siae, }, + immatriculation: { + dateDebutActivite: date_debut_activite, + dateImmatriculation: date_immatriculation, + dateRadiation: date_radiation, + duree: duree_personne_morale, + natureEntreprise: nature_entreprise || [], + dateCloture: date_cloture_exercice, + isPersonneMorale: !!capital_social, + capital: capital_social, + estCapitalVariable: capital_variable, + devisCapital: devise_capital, + }, association: { idAssociation: identifiant_association, data: null, diff --git a/clients/recherche-entreprise/interface.ts b/clients/recherche-entreprise/interface.ts index 2dbc40f17..849a41cca 100644 --- a/clients/recherche-entreprise/interface.ts +++ b/clients/recherche-entreprise/interface.ts @@ -31,6 +31,7 @@ export type IResult = { matching_etablissements: IMatchingEtablissement[]; etablissements?: IMatchingEtablissement[]; complements: IComplements; + immatriculation: IImmatriculation; caractere_employeur: string; slug: string; }; @@ -121,6 +122,18 @@ export type IComplements = { liste_idcc: string[]; }; +export type IImmatriculation = { + date_debut_activite: string | null; + date_immatriculation: string | null; + date_radiation: string | null; + duree_personne_morale: number | null; + nature_entreprise: string[]; + date_cloture_exercice: string | null; + capital_social: number | null; + capital_variable: boolean; + devise_capital: string | null; +}; + export type ICollectiviteTerritoriale = { code: string; code_insee: string; diff --git a/clients/recherche-entreprise/siren.ts b/clients/recherche-entreprise/siren.ts index dcec04145..b03b6119a 100644 --- a/clients/recherche-entreprise/siren.ts +++ b/clients/recherche-entreprise/siren.ts @@ -11,8 +11,9 @@ export const clientUniteLegaleRechercheEntreprise = async ( ): Promise<IUniteLegale> => { const { results } = await clientSearchRechercheEntreprise({ searchTerms: siren, - page: 1, + pageResultatsRecherche: 1, inclureEtablissements: true, + inclureImmatriculation: true, pageEtablissements, useCache, fallbackOnStaging, diff --git a/clients/recherche-entreprise/siret.ts b/clients/recherche-entreprise/siret.ts index 721ff39e3..21c3d063c 100644 --- a/clients/recherche-entreprise/siret.ts +++ b/clients/recherche-entreprise/siret.ts @@ -9,8 +9,10 @@ export const clientEtablissementRechercheEntreprise = async ( ): Promise<IEtablissement> => { const { results } = await clientSearchRechercheEntreprise({ searchTerms: siret, - page: 1, + pageResultatsRecherche: 1, fallbackOnStaging: useFallback, + inclureEtablissements: false, + inclureImmatriculation: false, useCache, }); diff --git a/clients/sirene-insee/siren.ts b/clients/sirene-insee/siren.ts index a23cec095..6a7f0a07a 100644 --- a/clients/sirene-insee/siren.ts +++ b/clients/sirene-insee/siren.ts @@ -279,6 +279,7 @@ const mapToDomainObject = ( estEntrepreneurIndividuel, estEss: economieSocialeSolidaireUniteLegale === 'O', }, + immatriculation: null, association: { idAssociation: identifiantAssociationUniteLegale || null, }, diff --git a/components-ui/badge/frequent.tsx b/components-ui/badge/frequent.tsx index 7fa6a9681..bf55304c4 100644 --- a/components-ui/badge/frequent.tsx +++ b/components-ui/badge/frequent.tsx @@ -1,5 +1,5 @@ -import { PropsWithChildren } from 'react'; import constants from '#models/constants'; +import { PropsWithChildren } from 'react'; import { Badge, IPartialBadgeProps } from '.'; export const LabelAndCertificateBadge = ({ diff --git a/components/espace-agent-components/summary-section.tsx b/components/espace-agent-components/summary-section.tsx index 2fb3b0cfd..aa9c62cc4 100644 --- a/components/espace-agent-components/summary-section.tsx +++ b/components/espace-agent-components/summary-section.tsx @@ -34,8 +34,12 @@ export const EspaceAgentSummarySection: NextPageWithLayout<IProps> = ({ commerciale, artisanale, agricole ou indépendante est enregistrée au RNE. </FAQLink>, - <a href={`/justificatif/${uniteLegale.siren}`}> - → Consulter la page justificatif d’immatriculation + <a + href={`/justificatif-immatriculation-pdf/${uniteLegale.siren}`} + > + <Icon slug="download"> + Télécharger l’extrait d’immatriculation au RNE + </Icon> </a>, ], [ @@ -46,16 +50,6 @@ export const EspaceAgentSummarySection: NextPageWithLayout<IProps> = ({ effectifs </a>, ], - [ - '', - <a - href={`/justificatif-immatriculation-pdf/${uniteLegale.siren}`} - > - <Icon slug="download"> - Télécharger l’extrait d’immatriculation au RNE - </Icon> - </a>, - ], ['', <br />], [ 'Documents juridiques', diff --git a/components/title-section/tabs/index.tsx b/components/title-section/tabs/index.tsx index 68f40a43d..cf2ba435e 100644 --- a/components/title-section/tabs/index.tsx +++ b/components/title-section/tabs/index.tsx @@ -1,4 +1,3 @@ -import Link from 'next/link'; import { PrintNever } from '#components-ui/print-visibility'; import { checkHasLabelsAndCertificates, @@ -11,6 +10,7 @@ import { } from '#models/core/types'; import { EScope, hasRights } from '#models/user/rights'; import { ISession } from '#models/user/session'; +import Link from 'next/link'; import styles from './styles.module.css'; import TabLink from './tab-link'; @@ -26,7 +26,6 @@ export enum FICHE { DIVERS = 'conventions collectives', ELUS = 'élus', ETABLISSEMENTS_SCOLAIRES = 'établissements scolaires', - JUSTIFICATIFS = 'justificatifs', ETABLISSEMENT = 'fiche établissement', } @@ -50,13 +49,6 @@ export const Tabs: React.FC<{ shouldDisplay: true, width: '80px', }, - { - ficheType: FICHE.JUSTIFICATIFS, - label: 'Justificatif d’immatriculation', - pathPrefix: '/justificatif/', - noFollow: false, - shouldDisplay: true, - }, { ficheType: FICHE.ELUS, label: 'Élus', @@ -89,10 +81,13 @@ export const Tabs: React.FC<{ }, { ficheType: FICHE.ANNONCES, - label: 'Annonces', + label: `Annonces${ + uniteLegale.dateMiseAJourInpi ? ' et observations' : '' + }`, pathPrefix: '/annonces/', noFollow: false, shouldDisplay: true, + width: '130px', }, { ficheType: FICHE.CERTIFICATS, diff --git a/components/unite-legale-immatriculation-section/index.tsx b/components/unite-legale-immatriculation-section/index.tsx new file mode 100644 index 000000000..c29ae969d --- /dev/null +++ b/components/unite-legale-immatriculation-section/index.tsx @@ -0,0 +1,75 @@ +import { INPI } from '#components/administrations'; +import { DataSection } from '#components/section/data-section'; +import { TwoColumnTable } from '#components/table/simple'; +import { EAdministration } from '#models/administrations/EAdministration'; +import { IUniteLegale } from '#models/core/types'; +import { formatDate } from '#utils/helpers'; + +export const UniteLegaleImmatriculationSection = ({ + uniteLegale, +}: { + uniteLegale: IUniteLegale; +}) => { + const immatriculation = uniteLegale.immatriculation; + return ( + <DataSection + title="Immatricuation au RNE" + id="immatriculation-rne" + sources={[EAdministration.INPI]} + data={immatriculation} + notFoundInfo={null} + > + {(immatriculation) => ( + <> + <p> + Cette structure est une entreprise immatriculée au{' '} + <strong>Registre National des Entreprises (RNE)</strong>. Ce + registre liste les entreprises de France. Il est tenu par l’ + <INPI />. + </p> + <TwoColumnTable + body={[ + ...(immatriculation + ? [ + [ + 'Date d’immatriculation', + formatDate(immatriculation?.dateImmatriculation), + ], + [ + 'Date de début d’activité', + formatDate(immatriculation?.dateDebutActivite), + ], + [ + 'Nature de l’entreprise', + immatriculation?.natureEntreprise, + ], + ...(immatriculation?.isPersonneMorale + ? [ + ['Capital social', immatriculation?.capital], + [ + 'Clôture de l’exercice comptable', + immatriculation?.dateCloture, + ], + [ + 'Durée de la personne morale', + immatriculation?.duree, + ], + ] + : []), + ...(immatriculation?.dateRadiation + ? [ + [ + 'Date de radiation', + formatDate(immatriculation?.dateRadiation), + ], + ] + : []), + ] + : []), + ]} + /> + </> + )} + </DataSection> + ); +}; diff --git a/components/unite-legale-section/index.tsx b/components/unite-legale-section/index.tsx index d63d78b75..c90e7aefa 100644 --- a/components/unite-legale-section/index.tsx +++ b/components/unite-legale-section/index.tsx @@ -1,6 +1,6 @@ -import React from 'react'; +import { OpenClosedTag } from '#components-ui/badge/frequent'; import FAQLink from '#components-ui/faq-link'; -import { HorizontalSeparator } from '#components-ui/horizontal-separator'; +import InformationTooltip from '#components-ui/information-tooltip'; import { ConventionCollectivesBadgesSection } from '#components/badges-section/convention-collectives'; import { ProtectedCertificatesBadgesSection } from '#components/badges-section/labels-and-certificates/protected-certificats'; import EORICell from '#components/eori-cell'; @@ -21,6 +21,7 @@ import { ISession } from '#models/user/session'; import { formatDate, formatIntFr, formatSiret } from '#utils/helpers'; import { libelleCategorieEntreprise } from '#utils/helpers/formatting/categories-entreprise'; import { libelleTrancheEffectif } from '#utils/helpers/formatting/codes-effectifs'; +import React from 'react'; import { LabelsAndCertificatesBadgesSection, checkHasLabelsAndCertificates, @@ -85,22 +86,56 @@ const UniteLegaleSection: React.FC<{ libelleCategorieEntreprise(uniteLegale), ], ['Date de création', formatDate(uniteLegale.dateCreation)], - [ - 'Dernière modification à l’Insee', - formatDate(uniteLegale.dateMiseAJourInsee), - ], - ...(uniteLegale.dateMiseAJourInpi - ? [ - [ - 'Dernière modification à l’Inpi', - formatDate(uniteLegale.dateMiseAJourInpi), - ], - ] - : []), ...(!estActif(uniteLegale) ? [['Date de fermeture', formatDate(uniteLegale.dateFermeture)]] : []), ['', <br />], + [ + 'Inscription aux registres', + <> + {uniteLegale.dateMiseAJourInsee && ( + <InformationTooltip + tabIndex={undefined} + label={`Cette structure est inscrite dans la base Sirene. + Elle a été mise à jour le ${formatDate( + uniteLegale.dateMiseAJourInsee + )}`} + > + <OpenClosedTag + isVerified={!uniteLegale.dateFermeture} + label={ + uniteLegale.dateFermeture ? 'Fermée' : 'Inscrite' + ' à l’Insee' + } + /> + </InformationTooltip> + )} + {uniteLegale.dateMiseAJourInpi && ( + <> + <br />{' '} + <InformationTooltip + tabIndex={undefined} + label={`Cette structure est immatriculée au Registre National des Entreprises (RNE), depuis le ${formatDate( + uniteLegale.immatriculation?.dateImmatriculation + )}. Elle a été mise à jour le ${formatDate( + uniteLegale.dateMiseAJourInpi + )}`} + > + <a href="#immatriculation-rne"> + <OpenClosedTag + isVerified={!uniteLegale.immatriculation?.dateRadiation} + label={ + uniteLegale.immatriculation?.dateRadiation + ? 'Radiée' + : 'Immatriculée ' + 'auprès de l’Inpi' + } + /> + </a> + </InformationTooltip> + </> + )} + </>, + ], + ['', <br />], [ 'Convention(s) collective(s)', <ConventionCollectivesBadgesSection @@ -142,7 +177,7 @@ const UniteLegaleSection: React.FC<{ <li> Annonce de création au JOAFE :{' '} <a - href={`/justificatif/${uniteLegale.siren}`} + href={`/documents/${uniteLegale.siren}`} rel="noreferrer noopener" target="_blank" > @@ -168,6 +203,27 @@ const UniteLegaleSection: React.FC<{ )} </ul>, ], + ['', <br />], + [ + 'Dirigeant(s)', + <a key="dirigeant" href={`/dirigeants/${uniteLegale.siren}`}> + → voir les dirigeants + </a>, + ], + [ + 'Siège social', + <a key="siege" href={`/etablissement/${uniteLegale.siege.siret}`}> + → voir le détail du siège social + </a>, + ], + [ + 'Liste des établissements', + <a href={`#etablissements`}> + → voir les {uniteLegale.etablissements.nombreEtablissements}{' '} + établissement + {uniteLegale.etablissements.nombreEtablissements > 0 ? 's' : ''} + </a>, + ], ]; return ( @@ -190,7 +246,6 @@ const UniteLegaleSection: React.FC<{ > <TwoColumnTable body={data} /> </Section> - <HorizontalSeparator /> </div> ); }; diff --git a/components/useful-shortcuts/index.tsx b/components/useful-shortcuts/index.tsx deleted file mode 100644 index bf2687450..000000000 --- a/components/useful-shortcuts/index.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import React from 'react'; -import { - IUniteLegale, - isAssociation, - isServicePublic, -} from '#models/core/types'; -import { HorizontalSeparator } from 'components-ui/horizontal-separator'; -import { PrintNever } from 'components-ui/print-visibility'; -import styles from './styles.module.css'; - -const ShortcutsSection: React.FC<{ - shortcuts: { - label: string; - url: string; - external?: boolean; - hide?: boolean; - }[]; - title: string; - shortcutCount: number; -}> = ({ shortcuts, title, shortcutCount }) => ( - <div - className={styles.container} - style={{ width: `calc(${Math.round(100 / shortcutCount)}% - 15px)` }} - > - {title && ( - <div> - <strong className="title">{title}</strong> - </div> - )} - {shortcuts - .filter((s) => !s.hide) - .map((shortcut) => ( - <div key={shortcut.label}> - →{' '} - {shortcut.external ? ( - <a href={shortcut.url} target="_blank" rel="noreferrer noopener"> - {shortcut.label} - </a> - ) : ( - <a href={shortcut.url}>{shortcut.label}</a> - )} - </div> - ))} - </div> -); - -const UsefulShortcuts: React.FC<{ uniteLegale: IUniteLegale }> = ({ - uniteLegale, -}) => { - const data = [ - { - title: 'Général', - shortcuts: [ - { - url: `/entreprise/${uniteLegale.chemin}#etablissement`, - label: 'Infos sur le siège social', - }, - ...(uniteLegale.etablissements.nombreEtablissements > 1 - ? [ - { - url: `/entreprise/${uniteLegale.chemin}#etablissements`, - label: `Voir des ${uniteLegale.etablissements.nombreEtablissements} établissements`, - }, - ] - : []), - { - url: `/carte/${uniteLegale.siege.siret}`, - label: `Voir le siège sur la carte`, - }, - ], - }, - { - title: 'Justificatifs d’existence', - shortcuts: [ - { - url: `/justificatif/${uniteLegale.siren}`, - label: 'Extrait d’immatriculation', - hide: isServicePublic(uniteLegale) || isAssociation(uniteLegale), - }, - { - url: `/justificatif/${uniteLegale.siren}`, - label: 'Annonce de création', - hide: isServicePublic(uniteLegale) || !isAssociation(uniteLegale), - }, - { - url: `/justificatif/${uniteLegale.siren}#insee`, - label: 'Avis de situation Insee', - }, - ], - }, - { - title: 'Entreprise Commerciale', - shortcuts: [ - { - url: `/dirigeants/${uniteLegale.siren}#beneficiaires`, - label: 'Bénéficiaires Effectifs', - }, - { - url: `/justificatif/${uniteLegale.siren}#rne`, - label: 'Capital social', - }, - { - url: `/annonces/${uniteLegale.siren}`, - label: 'Procédure(s) collective(s)', - }, - ], - hide: - uniteLegale.complements.estEntrepreneurIndividuel || - isAssociation(uniteLegale) || - isServicePublic(uniteLegale), - }, - { - title: 'Liens utiles', - shortcuts: [ - { - url: `https://mon-entreprise.urssaf.fr/assistants/pour-mon-entreprise/${uniteLegale.siren}`, - label: 'Simulez impôts, salaires & dividendes', - external: true, - }, - { - url: `https://place-des-entreprises.beta.gouv.fr/?pk_campaign=orientation-partenaire&pk_kwd=annuaire-entreprises`, - label: 'Besoin d’aide ? Échangez avec un conseiller', - external: true, - }, - ], - hide: isServicePublic(uniteLegale), - }, - ]; - - return ( - <PrintNever> - <div> - <div className={styles.wrapper}> - {data - .filter((d) => !d.hide) - .map((sectionData) => ( - <ShortcutsSection - key={sectionData.title} - title={sectionData.title} - shortcuts={sectionData.shortcuts} - shortcutCount={data.length} - /> - ))} - </div> - <HorizontalSeparator /> - </div> - </PrintNever> - ); -}; - -export default UsefulShortcuts; diff --git a/components/useful-shortcuts/styles.module.css b/components/useful-shortcuts/styles.module.css deleted file mode 100644 index 2ca22ab1e..000000000 --- a/components/useful-shortcuts/styles.module.css +++ /dev/null @@ -1,26 +0,0 @@ -.wrapper { - display: flex; - justify-content: space-between; - gap: 15px; - - @media only screen and (min-width: 1px) and (max-width: 1100px) { - flex-wrap: wrap; - } -} - -.container { - border: 2px solid var(--annuaire-colors-pastelBlue); - padding: 15px; - flex-grow: 0; - flex-shrink: 0; - - @media only screen and (min-width: 1px) and (max-width: 1100px) { - max-width: 100%; - min-width: 250px; - flex-grow: 1; - } -} - -.container > div { - margin-bottom: 10px; -} diff --git a/models/core/types.ts b/models/core/types.ts index b19e12d9e..39bc0e7c3 100644 --- a/models/core/types.ts +++ b/models/core/types.ts @@ -109,6 +109,7 @@ export interface IUniteLegale extends IEtablissementsList { categorieEntreprise: string | null; anneeCategorieEntreprise: string | null; complements: IUniteLegaleComplements; + immatriculation: IUniteLegaleImmatriculation | null; association: { idAssociation: IdRna | string | null; }; @@ -154,9 +155,23 @@ export const createDefaultUniteLegale = (siren: Siren): IUniteLegale => { codeColter: null, }, listeIdcc: [], + immatriculation: null, }; }; +export interface IUniteLegaleImmatriculation { + dateDebutActivite: string; + dateImmatriculation: string; + dateRadiation: string; + duree: number; + natureEntreprise: string[]; + dateCloture: string; + isPersonneMorale: boolean; + capital: number; + estCapitalVariable: boolean; + devisCapital: string; +} + export interface IUniteLegaleComplements { estBio: boolean; estEntrepreneurIndividuel: boolean; diff --git a/models/core/unite-legale.ts b/models/core/unite-legale.ts index 89358cd99..eacba7acc 100644 --- a/models/core/unite-legale.ts +++ b/models/core/unite-legale.ts @@ -208,6 +208,7 @@ class UniteLegaleBuilder { ...uniteLegaleInsee?.colter, ...uniteLegaleRechercheEntreprise.colter, }, + immatriculation: uniteLegaleRechercheEntreprise.immatriculation, chemin: uniteLegaleRechercheEntreprise.chemin, listeIdcc: uniteLegaleRechercheEntreprise.listeIdcc, dateDerniereMiseAJour: diff --git a/models/immatriculation/joafe.ts b/models/immatriculation/joafe.ts deleted file mode 100644 index 22163a1c5..000000000 --- a/models/immatriculation/joafe.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { HttpNotFound } from '#clients/exceptions'; -import { clientJOAFE } from '#clients/open-data-soft/clients/journal-officiel-associations'; -import { EAdministration } from '#models/administrations/EAdministration'; -import { - APINotRespondingFactory, - IAPINotRespondingError, -} from '#models/api-not-responding'; -import { FetchRessourceException } from '#models/exceptions'; -import { IdRna, Siren, verifyIdRna } from '#utils/helpers'; -import logErrorInSentry from '#utils/sentry'; -import { IImmatriculation } from '.'; -import { - IUniteLegale, - NotAValidIdRnaError, - isAssociation, -} from '../core/types'; - -export interface IImmatriculationJOAFE extends IImmatriculation { - siren: Siren; - idRna: IdRna; - datePublication: string; -} - -export const getImmatriculationJOAFE = async (uniteLegale: IUniteLegale) => { - if (isAssociation(uniteLegale)) { - return await getImmatriculationJOAFEFromIds( - uniteLegale.siren, - uniteLegale?.association?.idAssociation - ); - } else { - return APINotRespondingFactory(EAdministration.DILA, 404); - } -}; - -/** - * Request Immatriculation from JOAFE - * @param siren - */ -const getImmatriculationJOAFEFromIds = async ( - siren: Siren, - idRnaAsString: IdRna | string | null -): Promise<IAPINotRespondingError | IImmatriculationJOAFE> => { - try { - const idRna = verifyIdRna(idRnaAsString || ''); - const annoncesJO = await clientJOAFE(idRna); - const annonceCreation = annoncesJO.annonces.find( - (annonce) => annonce.typeAvisLibelle === 'Création' - ); - if (!annonceCreation) { - throw new HttpNotFound('No annonces found for creation'); - } - return { - siren, - idRna, - datePublication: annonceCreation.datePublication, - downloadLink: annonceCreation.path + '?format=pdf', - siteLink: annonceCreation.path, - } as IImmatriculationJOAFE; - } catch (e: any) { - if (e instanceof HttpNotFound || e instanceof NotAValidIdRnaError) { - return APINotRespondingFactory(EAdministration.DILA, 404); - } - - logErrorInSentry( - new FetchRessourceException({ - cause: e, - ressource: 'ImmatriculationJOAFE', - context: { - siren, - idRna: idRnaAsString, - }, - administration: EAdministration.DILA, - }) - ); - return APINotRespondingFactory(EAdministration.DILA, 500); - } -}; diff --git a/models/search.ts b/models/search.ts index 5a4a88aaf..a62fd72ad 100644 --- a/models/search.ts +++ b/models/search.ts @@ -46,7 +46,7 @@ const search = async ( const escapedSearchTerm = removeSpecialChars(searchTerm); return await clientSearchRechercheEntreprise({ searchTerms: escapedSearchTerm, - page, + pageResultatsRecherche: page, searchFilterParams, }); } catch (e: any) { @@ -78,7 +78,7 @@ const search = async ( const escapedSearchTerm = removeSpecialChars(searchTerm); return await clientSearchRechercheEntreprise({ searchTerms: escapedSearchTerm, - page, + pageResultatsRecherche: page, searchFilterParams, fallbackOnStaging: true, }); From 46f3ee8fe7e6e4ff8881c1ec72c492b3b1563994 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Mon, 19 Aug 2024 19:48:13 +0200 Subject: [PATCH 02/16] feat: etat des inscriptions - merge with justificatifs links --- .../annonces/[slug]/_components/bodacc.tsx | 3 +- .../annonces/[slug]/_components/joafe.tsx | 3 +- .../[slug]/_components/observations-rne.tsx | 6 +- app/(header-default)/annonces/[slug]/page.tsx | 21 ++- .../[slug]/_components/justificatifs/rne.tsx | 87 ++--------- .../_components/immatriculation-section.tsx | 61 +++++++- .../[slug]/_components/inscriptions.tsx | 145 ++++++++++++++++++ .../[slug]/_components/style.module.css | 14 ++ .../[slug]/_components/summary-section.tsx | 137 ++++------------- .../entreprise/[slug]/page.tsx | 14 +- .../[slug]/page.tsx | 6 +- clients/recherche-entreprise/index.ts | 2 +- components-ui/badge/frequent.tsx | 3 +- components/association-section/index.tsx | 1 + .../justificatifs/data-inpi-link/index.tsx | 73 +++++++++ .../justificatifs/extrait-rne-link/index.tsx | 7 +- components/section/style.module.css | 1 + components/title-section/index.tsx | 2 +- models/core/types.ts | 2 +- redirects.json | 5 + 20 files changed, 381 insertions(+), 212 deletions(-) rename components/unite-legale-immatriculation-section/index.tsx => app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx (51%) create mode 100644 app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx create mode 100644 app/(header-default)/entreprise/[slug]/_components/style.module.css rename components/unite-legale-section/index.tsx => app/(header-default)/entreprise/[slug]/_components/summary-section.tsx (60%) create mode 100644 components/justificatifs/data-inpi-link/index.tsx diff --git a/app/(header-default)/annonces/[slug]/_components/bodacc.tsx b/app/(header-default)/annonces/[slug]/_components/bodacc.tsx index ccbaf890b..24d121032 100644 --- a/app/(header-default)/annonces/[slug]/_components/bodacc.tsx +++ b/app/(header-default)/annonces/[slug]/_components/bodacc.tsx @@ -1,6 +1,5 @@ 'use client'; -import React from 'react'; import routes from '#clients/routes'; import { Info } from '#components-ui/alerts'; import ButtonLink from '#components-ui/button'; @@ -12,6 +11,7 @@ import { EAdministration } from '#models/administrations/EAdministration'; import { IUniteLegale } from '#models/core/types'; import { formatDate } from '#utils/helpers'; import { useFetchBODACC } from 'hooks'; +import React from 'react'; const AnnoncesBodacc: React.FC<{ uniteLegale: IUniteLegale; @@ -20,6 +20,7 @@ const AnnoncesBodacc: React.FC<{ return ( <AsyncDataSectionClient + id="annonces-bodacc" title="Annonces BODACC" sources={[EAdministration.DILA]} data={bodacc} diff --git a/app/(header-default)/annonces/[slug]/_components/joafe.tsx b/app/(header-default)/annonces/[slug]/_components/joafe.tsx index 3cb250c7f..016ec70d6 100644 --- a/app/(header-default)/annonces/[slug]/_components/joafe.tsx +++ b/app/(header-default)/annonces/[slug]/_components/joafe.tsx @@ -1,6 +1,5 @@ 'use client'; -import React from 'react'; import routes from '#clients/routes'; import AssociationCreationNotFoundAlert from '#components-ui/alerts-with-explanations/association-creation-not-found-alert'; import ButtonLink from '#components-ui/button'; @@ -12,6 +11,7 @@ import { EAdministration } from '#models/administrations/EAdministration'; import { IAssociation } from '#models/core/types'; import { formatDate } from '#utils/helpers'; import { useFetchJOAFE } from 'hooks'; +import React from 'react'; const AnnoncesJOAFESection: React.FC<{ uniteLegale: IAssociation; @@ -19,6 +19,7 @@ const AnnoncesJOAFESection: React.FC<{ const annoncesAssociation = useFetchJOAFE(uniteLegale); return ( <AsyncDataSectionClient + id="annonces-joafe" title="Annonces Journal Officiel des Associations" sources={[EAdministration.DILA]} data={annoncesAssociation} diff --git a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx index 88129c7fc..a4cbf4a8c 100644 --- a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx +++ b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx @@ -16,14 +16,14 @@ export const ObservationsRNE: React.FC<{ return ( <AsyncDataSectionClient - id="rne" + id="observations-rne" title="Observations au RNE" sources={[EAdministration.INPI]} data={immatriculationRNE} notFoundInfo={ <> Cette structure ne possède pas de fiche d’immatriculation au{' '} - <strong>Registre National des Entreprises (RNE)</strong> + <strong>Registre National des Entreprises (RNE)</strong>. </> } > @@ -50,7 +50,7 @@ export const ObservationsRNE: React.FC<{ ) : ( <> Cette structure ne possède pas d’observations au{' '} - <strong>Registre National des Entreprises (RNE)</strong> + <strong>Registre National des Entreprises (RNE)</strong>. </> ) } diff --git a/app/(header-default)/annonces/[slug]/page.tsx b/app/(header-default)/annonces/[slug]/page.tsx index be39795d2..a21526544 100644 --- a/app/(header-default)/annonces/[slug]/page.tsx +++ b/app/(header-default)/annonces/[slug]/page.tsx @@ -52,17 +52,32 @@ const AnnoncesPage = async (props: AppRouterProps) => { {estDiffusible(uniteLegale) || hasRights(session, EScope.nonDiffusible) ? ( <> + <ul> + <li> + <a href="#annonces-bodacc">Annonces au BODACC</a> + </li> + {uniteLegale.dateMiseAJourInpi && ( + <li> + <a href="#observations-rne">Observations au RNE</a> + </li> + )} + {isAssociation(uniteLegale) && ( + <li> + <a href="#annonces-joafe">Annonces au JOAFE</a> + </li> + )} + </ul> <AnnoncesBodacc uniteLegale={uniteLegale} /> {uniteLegale.dateMiseAJourInpi && ( <ObservationsRNE uniteLegale={uniteLegale} session={session} /> )} + {isAssociation(uniteLegale) && ( + <AnnoncesJOAFESection uniteLegale={uniteLegale} /> + )} </> ) : ( <DonneesPriveesSection /> )} - {isAssociation(uniteLegale) && ( - <AnnoncesJOAFESection uniteLegale={uniteLegale} /> - )} </div> </> ); diff --git a/app/(header-default)/documents/[slug]/_components/justificatifs/rne.tsx b/app/(header-default)/documents/[slug]/_components/justificatifs/rne.tsx index 9fef93856..e2dbad3c1 100644 --- a/app/(header-default)/documents/[slug]/_components/justificatifs/rne.tsx +++ b/app/(header-default)/documents/[slug]/_components/justificatifs/rne.tsx @@ -1,13 +1,7 @@ -import routes from '#clients/routes'; -import ButtonLink from '#components-ui/button'; -import { Icon } from '#components-ui/icon/wrapper'; -import { PrintNever } from '#components-ui/print-visibility'; -import { INPI } from '#components/administrations'; +import { DataInpiLinkWithExplanations } from '#components/justificatifs/data-inpi-link'; import { Section } from '#components/section'; import { EAdministration } from '#models/administrations/EAdministration'; -import { estDiffusible } from '#models/core/diffusion'; import { IUniteLegale } from '#models/core/types'; -import { EScope, hasRights } from '#models/user/rights'; import { ISession } from '#models/user/session'; export const JustificatifImmatriculationRNE = ({ @@ -16,73 +10,12 @@ export const JustificatifImmatriculationRNE = ({ }: { uniteLegale: IUniteLegale; session: ISession | null; -}) => { - const siteLink = `${routes.rne.portail.entreprise}${uniteLegale.siren}`; - - if ( - !estDiffusible(uniteLegale) && - !hasRights(session, EScope.nonDiffusible) - ) { - return ( - <Section - title="Justificatif d’immatriculation au RNE" - id="justificatif-immatriculation-rne" - sources={[EAdministration.INPI]} - > - Le(s) dirigeant(s) se sont opposés à la diffusion de leurs données - personnelles. Pour télécharger l’extrait d’immatriculation de cette - entreprise, rendez-vous sur le site{' '} - <a href="https://data.inpi.fr">data.inpi.fr</a>. - </Section> - ); - } - return ( - <Section - title="Justificatif d’immatriculation au RNE" - id="justificatif-immatriculation-rne" - sources={[EAdministration.INPI]} - > - <PrintNever> - <p> - Pour accéder aux données contenues dans un extrait d’immatriculation - (équivalent de{' '} - <strong> - <a href="/faq/extrait-kbis">l’extrait KBIS ou D1</a> - </strong> - ), vous pouvez soit télécharger le{' '} - <strong> - justificatif d’immatriculation au Registre National des Entreprises - (RNE) - </strong> - , soit consulter la fiche complète sur le site de l’ - <INPI /> -  : - </p> - <ul className="fr-btns-group fr-btns-group--inline-md fr-btns-group--center"> - <li> - <ButtonLink - nofollow={true} - to={`/justificatif-immatriculation-pdf/${uniteLegale.siren}`} - > - <Icon slug="download"> - Télécharger le justificatif d’immatriculation - </Icon> - </ButtonLink> - </li> - <li> - <ButtonLink - target="_blank" - to={ - siteLink || - `${routes.rne.portail.entreprise}${uniteLegale.siren}` - } - alt - > - ⇢ Voir la fiche sur le site de l’INPI - </ButtonLink> - </li> - </ul> - </PrintNever> - </Section> - ); -}; +}) => ( + <Section + title="Justificatif d’immatriculation au RNE" + id="justificatif-immatriculation-rne" + sources={[EAdministration.INPI]} + > + <DataInpiLinkWithExplanations uniteLegale={uniteLegale} session={session} /> + </Section> +); diff --git a/components/unite-legale-immatriculation-section/index.tsx b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx similarity index 51% rename from components/unite-legale-immatriculation-section/index.tsx rename to app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx index c29ae969d..4a4efff40 100644 --- a/components/unite-legale-immatriculation-section/index.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx @@ -1,14 +1,46 @@ +import FAQLink from '#components-ui/faq-link'; import { INPI } from '#components/administrations'; +import { DataInpiLinkWithExplanations } from '#components/justificatifs/data-inpi-link'; import { DataSection } from '#components/section/data-section'; import { TwoColumnTable } from '#components/table/simple'; import { EAdministration } from '#models/administrations/EAdministration'; import { IUniteLegale } from '#models/core/types'; +import { ISession } from '#models/user/session'; import { formatDate } from '#utils/helpers'; +const formatCapitalSocial = ( + immatriculation: IUniteLegale['immatriculation'] +) => { + if (immatriculation?.capital) { + try { + return `${new Intl.NumberFormat('fr-FR', { + style: 'currency', + currency: immatriculation?.deviseCapital ?? 'EUR', + }).format(immatriculation?.capital)} ${ + immatriculation.estCapitalVariable ? 'variable' : 'fixe' + }`; + } catch { + return `${immatriculation?.capital} ${immatriculation?.deviseCapital} ${ + immatriculation.estCapitalVariable ? 'variable' : 'fixe' + }`; + } + } + return ''; +}; + +const formatDateCloture = (DDMM: string) => { + if (DDMM && DDMM.length === 4) { + return `${DDMM.slice(0, 2)}/${DDMM.slice(2)}`; + } + return DDMM; +}; + export const UniteLegaleImmatriculationSection = ({ uniteLegale, + session, }: { uniteLegale: IUniteLegale; + session: ISession | null; }) => { const immatriculation = uniteLegale.immatriculation; return ( @@ -41,18 +73,35 @@ export const UniteLegaleImmatriculationSection = ({ ], [ 'Nature de l’entreprise', - immatriculation?.natureEntreprise, + (immatriculation?.natureEntreprise || []).join(', '), ], ...(immatriculation?.isPersonneMorale ? [ - ['Capital social', immatriculation?.capital], + [ + <FAQLink tooltipLabel="Capital social"> + Le capital social d’une société est constitué des + apports (en argent ou en nature) de ses + actionnaires. + <br /> + Il peut être fixe ou variable. La modification + d’un capital fixe nécessite une modification des + statuts tandis que le capital variable peut varier + dans certaines limites sans modification des + statuts. + </FAQLink>, + formatCapitalSocial(immatriculation), + ], [ 'Clôture de l’exercice comptable', - immatriculation?.dateCloture, + formatDateCloture(immatriculation?.dateCloture), ], + ] + : []), + ...(immatriculation?.duree + ? [ [ 'Durée de la personne morale', - immatriculation?.duree, + `${immatriculation?.duree} ans`, ], ] : []), @@ -68,6 +117,10 @@ export const UniteLegaleImmatriculationSection = ({ : []), ]} /> + <DataInpiLinkWithExplanations + uniteLegale={uniteLegale} + session={session} + /> </> )} </DataSection> diff --git a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx new file mode 100644 index 000000000..43c5ed031 --- /dev/null +++ b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx @@ -0,0 +1,145 @@ +import { OpenClosedTag } from '#components-ui/badge/frequent'; +import { Icon } from '#components-ui/icon/wrapper'; +import InformationTooltip from '#components-ui/information-tooltip'; +import AvisSituationLink from '#components/justificatifs/avis-situation-link'; +import ExtraitRNELink from '#components/justificatifs/extrait-rne-link'; +import { estActif } from '#models/core/etat-administratif'; +import { IUniteLegale } from '#models/core/types'; +import { ISession } from '#models/user/session'; +import { formatDate } from '#utils/helpers'; +import React, { PropsWithChildren } from 'react'; +import styles from './style.module.css'; + +const Wrapper: React.FC<PropsWithChildren<{ link: JSX.Element }>> = ({ + children, + link, +}) => ( + <div className={styles['inscriptions-wrapper']}> + <div>{children}</div> + <div className="layout-right">{link}</div> + </div> +); + +export const UniteLegaleInscriptionSirene = ({ + uniteLegale, + session, +}: { + uniteLegale: IUniteLegale; + session: ISession | null; +}) => ( + <Wrapper + link={ + <Icon slug="download"> + <AvisSituationLink + session={session} + etablissement={uniteLegale.siege} + label="Avis de situation Sirene" + /> + </Icon> + } + > + <InformationTooltip + tabIndex={undefined} + label={`Cette structure est inscrite dans la base Sirene tenue par l’Insee${ + uniteLegale.dateCreation + ? `, depuis le ${formatDate(uniteLegale.dateCreation)}` + : '' + }. Elle a été mise à jour le ${formatDate( + uniteLegale.dateMiseAJourInsee + )}.`} + > + {estActif(uniteLegale) ? ( + <OpenClosedTag isVerified={true} label="Inscrite (Insee)"> + {uniteLegale.dateCreation && ( + <>le {formatDate(uniteLegale.dateCreation)}</> + )} + </OpenClosedTag> + ) : ( + <OpenClosedTag isVerified={false} label="Cessée (Insee)"> + {uniteLegale.dateCreation && ( + <>le {formatDate(uniteLegale.dateFermeture)}</> + )} + </OpenClosedTag> + )} + </InformationTooltip> + </Wrapper> +); + +export const UniteLegaleInscriptionRNE = ({ + uniteLegale, + session, +}: { + uniteLegale: IUniteLegale; + session: ISession | null; +}) => ( + <Wrapper + link={ + <Icon slug="download"> + <ExtraitRNELink + uniteLegale={uniteLegale} + session={session} + label="Extrait RNE" + />{' '} + (<a href="/faq/extrait-kbis">équivalent KBIS/D1</a>) + </Icon> + } + > + <InformationTooltip + tabIndex={undefined} + label={`Cette structure est immatriculée au Registre National des Entreprises (RNE)${ + uniteLegale.immatriculation?.dateImmatriculation + ? `, depuis le ${formatDate( + uniteLegale.immatriculation?.dateImmatriculation + )}` + : '' + }. Elle a été mise à jour le ${formatDate( + uniteLegale.dateMiseAJourInpi + )}.`} + > + <a href="#immatriculation-rne"> + {uniteLegale.immatriculation?.dateRadiation ? ( + <OpenClosedTag isVerified={true} label="Radiée au RNE(INPI)"> + le {formatDate(uniteLegale.immatriculation?.dateRadiation)} + </OpenClosedTag> + ) : ( + <OpenClosedTag isVerified={true} label="Immatriculée au RNE (INPI)"> + {uniteLegale.immatriculation?.dateImmatriculation && ( + <> + le{' '} + {formatDate(uniteLegale.immatriculation?.dateImmatriculation)} + </> + )} + </OpenClosedTag> + )} + </a> + </InformationTooltip> + </Wrapper> +); + +export const UniteLegaleInscriptionRNA = ({ + uniteLegale, +}: { + uniteLegale: IUniteLegale; +}) => ( + <Wrapper + link={ + <Icon slug="download"> + <a>Annonce de création au JOAFE</a> + </Icon> + } + > + <InformationTooltip + tabIndex={undefined} + label="Cette structure est inscrite au Registre National des Association (RNA)." + > + <a href="#association-section"> + <OpenClosedTag + isVerified={true} + label={'Inscrite au RNA (Ministère de l’Intérieur)'} + > + le {formatDate(uniteLegale.immatriculation?.dateImmatriculation)} + </OpenClosedTag> + </a> + </InformationTooltip> + </Wrapper> +); diff --git a/app/(header-default)/entreprise/[slug]/_components/style.module.css b/app/(header-default)/entreprise/[slug]/_components/style.module.css new file mode 100644 index 000000000..35fa86304 --- /dev/null +++ b/app/(header-default)/entreprise/[slug]/_components/style.module.css @@ -0,0 +1,14 @@ +.inscriptions-wrapper { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + column-gap: 20px; +} +.inscriptions-wrapper > div { + flex-grow: 1; +} + +.inscriptions-wrapper > div:last-of-type { + margin: 5px 0; +} diff --git a/components/unite-legale-section/index.tsx b/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx similarity index 60% rename from components/unite-legale-section/index.tsx rename to app/(header-default)/entreprise/[slug]/_components/summary-section.tsx index c90e7aefa..7ba7b38e5 100644 --- a/components/unite-legale-section/index.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx @@ -1,11 +1,7 @@ -import { OpenClosedTag } from '#components-ui/badge/frequent'; import FAQLink from '#components-ui/faq-link'; -import InformationTooltip from '#components-ui/information-tooltip'; import { ConventionCollectivesBadgesSection } from '#components/badges-section/convention-collectives'; import { ProtectedCertificatesBadgesSection } from '#components/badges-section/labels-and-certificates/protected-certificats'; import EORICell from '#components/eori-cell'; -import AvisSituationLink from '#components/justificatifs/avis-situation-link'; -import ExtraitRNELink from '#components/justificatifs/extrait-rne-link'; import { Section } from '#components/section'; import { TwoColumnTable } from '#components/table/simple'; import TVACell from '#components/tva-cell'; @@ -27,9 +23,14 @@ import { checkHasLabelsAndCertificates, checkHasQuality, labelsAndCertificatesSources, -} from '../badges-section/labels-and-certificates'; +} from '../../../../../components/badges-section/labels-and-certificates'; +import { + UniteLegaleInscriptionRNA, + UniteLegaleInscriptionRNE, + UniteLegaleInscriptionSirene, +} from './inscriptions'; -const UniteLegaleSection: React.FC<{ +const UniteLegaleSummarySection: React.FC<{ uniteLegale: IUniteLegale; session: ISession | null; }> = ({ uniteLegale, session }) => { @@ -37,6 +38,27 @@ const UniteLegaleSection: React.FC<{ const conventionsCollectives = uniteLegale.listeIdcc; const data = [ + [ + 'État des inscriptions', + <> + {uniteLegale.dateMiseAJourInsee && ( + <UniteLegaleInscriptionSirene + uniteLegale={uniteLegale} + session={session} + /> + )} + {uniteLegale.dateMiseAJourInpi && ( + <UniteLegaleInscriptionRNE + uniteLegale={uniteLegale} + session={session} + /> + )} + {uniteLegale.association.idAssociation && ( + <UniteLegaleInscriptionRNA uniteLegale={uniteLegale} /> + )} + </>, + ], + ['', <br />], ['Dénomination', uniteLegale.nomComplet], ['SIREN', formatIntFr(uniteLegale.siren)], [ @@ -90,52 +112,6 @@ const UniteLegaleSection: React.FC<{ ? [['Date de fermeture', formatDate(uniteLegale.dateFermeture)]] : []), ['', <br />], - [ - 'Inscription aux registres', - <> - {uniteLegale.dateMiseAJourInsee && ( - <InformationTooltip - tabIndex={undefined} - label={`Cette structure est inscrite dans la base Sirene. - Elle a été mise à jour le ${formatDate( - uniteLegale.dateMiseAJourInsee - )}`} - > - <OpenClosedTag - isVerified={!uniteLegale.dateFermeture} - label={ - uniteLegale.dateFermeture ? 'Fermée' : 'Inscrite' + ' à l’Insee' - } - /> - </InformationTooltip> - )} - {uniteLegale.dateMiseAJourInpi && ( - <> - <br />{' '} - <InformationTooltip - tabIndex={undefined} - label={`Cette structure est immatriculée au Registre National des Entreprises (RNE), depuis le ${formatDate( - uniteLegale.immatriculation?.dateImmatriculation - )}. Elle a été mise à jour le ${formatDate( - uniteLegale.dateMiseAJourInpi - )}`} - > - <a href="#immatriculation-rne"> - <OpenClosedTag - isVerified={!uniteLegale.immatriculation?.dateRadiation} - label={ - uniteLegale.immatriculation?.dateRadiation - ? 'Radiée' - : 'Immatriculée ' + 'auprès de l’Inpi' - } - /> - </a> - </InformationTooltip> - </> - )} - </>, - ], - ['', <br />], [ 'Convention(s) collective(s)', <ConventionCollectivesBadgesSection @@ -169,61 +145,6 @@ const UniteLegaleSection: React.FC<{ ] : // open data and no certif : we can hide the whole line []), - ['', <br />], - [ - 'Justificatif(s) d’existence', - <ul> - {isAssociation(uniteLegale) && ( - <li> - Annonce de création au JOAFE :{' '} - <a - href={`/documents/${uniteLegale.siren}`} - rel="noreferrer noopener" - target="_blank" - > - télécharger - </a> - </li> - )} - {uniteLegale.dateMiseAJourInpi && ( - <li> - Extrait RNE (<a href="/faq/extrait-kbis">équivalent KBIS/D1</a>) :{' '} - <ExtraitRNELink uniteLegale={uniteLegale} session={session} /> - </li> - )} - {uniteLegale.dateMiseAJourInsee && ( - <li> - Avis de situation Insee :{' '} - <AvisSituationLink - session={session} - etablissement={uniteLegale.siege} - label="télécharger" - /> - </li> - )} - </ul>, - ], - ['', <br />], - [ - 'Dirigeant(s)', - <a key="dirigeant" href={`/dirigeants/${uniteLegale.siren}`}> - → voir les dirigeants - </a>, - ], - [ - 'Siège social', - <a key="siege" href={`/etablissement/${uniteLegale.siege.siret}`}> - → voir le détail du siège social - </a>, - ], - [ - 'Liste des établissements', - <a href={`#etablissements`}> - → voir les {uniteLegale.etablissements.nombreEtablissements}{' '} - établissement - {uniteLegale.etablissements.nombreEtablissements > 0 ? 's' : ''} - </a>, - ], ]; return ( @@ -250,4 +171,4 @@ const UniteLegaleSection: React.FC<{ ); }; -export default UniteLegaleSection; +export default UniteLegaleSummarySection; diff --git a/app/(header-default)/entreprise/[slug]/page.tsx b/app/(header-default)/entreprise/[slug]/page.tsx index c6d861938..de23ecd9c 100644 --- a/app/(header-default)/entreprise/[slug]/page.tsx +++ b/app/(header-default)/entreprise/[slug]/page.tsx @@ -10,8 +10,6 @@ import ServicePublicSection from '#components/service-public-section'; import StructuredDataBreadcrumb from '#components/structured-data/breadcrumb'; import Title from '#components/title-section'; import { FICHE } from '#components/title-section/tabs'; -import { UniteLegaleImmatriculationSection } from '#components/unite-legale-immatriculation-section'; -import UniteLegaleSection from '#components/unite-legale-section'; import { estNonDiffusibleStrict } from '#models/core/diffusion'; import { isAssociation, @@ -29,6 +27,8 @@ import extractParamsAppRouter, { AppRouterProps, } from '#utils/server-side-helper/app/extract-params'; import getSession from '#utils/server-side-helper/app/get-session'; +import { UniteLegaleImmatriculationSection } from 'app/(header-default)/entreprise/[slug]/_components/immatriculation-section'; +import UniteLegaleSummarySection from 'app/(header-default)/entreprise/[slug]/_components/summary-section'; import { Metadata } from 'next'; export const generateMetadata = async ( @@ -69,7 +69,10 @@ export default async function UniteLegalePage(props: AppRouterProps) { <NonDiffusibleSection /> ) : ( <> - <UniteLegaleSection uniteLegale={uniteLegale} session={session} /> + <UniteLegaleSummarySection + uniteLegale={uniteLegale} + session={session} + /> {hasRights(session, EScope.isAgent) && ( <EspaceAgentSummarySection uniteLegale={uniteLegale} @@ -77,7 +80,10 @@ export default async function UniteLegalePage(props: AppRouterProps) { /> )} {uniteLegale.immatriculation && ( - <UniteLegaleImmatriculationSection uniteLegale={uniteLegale} /> + <UniteLegaleImmatriculationSection + uniteLegale={uniteLegale} + session={session} + /> )} {isCollectiviteTerritoriale(uniteLegale) && ( <CollectiviteTerritorialeSection uniteLegale={uniteLegale} /> diff --git a/app/(header-default)/justificatif-immatriculation-pdf/[slug]/page.tsx b/app/(header-default)/justificatif-immatriculation-pdf/[slug]/page.tsx index 9af6ffb86..1559d419e 100644 --- a/app/(header-default)/justificatif-immatriculation-pdf/[slug]/page.tsx +++ b/app/(header-default)/justificatif-immatriculation-pdf/[slug]/page.tsx @@ -1,4 +1,3 @@ -import { Metadata } from 'next'; import { Info } from '#components-ui/alerts'; import { INPI } from '#components/administrations'; import { Section } from '#components/section'; @@ -8,6 +7,7 @@ import { formatIntFr } from '#utils/helpers'; import extractParamsAppRouter, { AppRouterProps, } from '#utils/server-side-helper/app/extract-params'; +import { Metadata } from 'next'; import { InpiPDFDownloader } from './_components/inpi-pdf-downloader'; export const generateMetadata = async ( @@ -30,9 +30,7 @@ const InpiPDF = (props: AppRouterProps) => { return ( <> <br /> - <a href={`/justificatif/${slug}`}> - ← Retour à la page justificatif d’immatriculation - </a> + <a href={`/entreprise/${slug}`}>← Retour à la fiche resumée</a> <div className="content-container"> <h1>Téléchargement du justificatif d’immatriculation</h1> diff --git a/clients/recherche-entreprise/index.ts b/clients/recherche-entreprise/index.ts index ff8af58d5..b7b101254 100644 --- a/clients/recherche-entreprise/index.ts +++ b/clients/recherche-entreprise/index.ts @@ -279,7 +279,7 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { isPersonneMorale: !!capital_social, capital: capital_social, estCapitalVariable: capital_variable, - devisCapital: devise_capital, + deviseCapital: devise_capital, }, association: { idAssociation: identifiant_association, diff --git a/components-ui/badge/frequent.tsx b/components-ui/badge/frequent.tsx index bf55304c4..4c74e8d3c 100644 --- a/components-ui/badge/frequent.tsx +++ b/components-ui/badge/frequent.tsx @@ -100,7 +100,7 @@ export const DefaultStructureBadge = ({ export const OpenClosedTag: React.FC< PropsWithChildren<{ isVerified?: boolean; label: string }> -> = ({ label = '', isVerified = true }) => ( +> = ({ label = '', isVerified = true, children }) => ( <div className="layout-left"> <Badge icon={isVerified ? 'open' : 'closed'} @@ -108,5 +108,6 @@ export const OpenClosedTag: React.FC< backgroundColor="#ddd" fontColor="var(--text-default-grey)" /> + {children} </div> ); diff --git a/components/association-section/index.tsx b/components/association-section/index.tsx index e1536444e..0a5bcc173 100644 --- a/components/association-section/index.tsx +++ b/components/association-section/index.tsx @@ -155,6 +155,7 @@ const AssociationSection = ({ <AsyncDataSectionClient title="Répertoire National des Associations" sources={[EAdministration.MI]} + id="association-section" data={association} notFoundInfo={<AssociationNotFound uniteLegale={uniteLegale} />} > diff --git a/components/justificatifs/data-inpi-link/index.tsx b/components/justificatifs/data-inpi-link/index.tsx new file mode 100644 index 000000000..68f46677a --- /dev/null +++ b/components/justificatifs/data-inpi-link/index.tsx @@ -0,0 +1,73 @@ +import routes from '#clients/routes'; +import ButtonLink from '#components-ui/button'; +import { Icon } from '#components-ui/icon/wrapper'; +import { PrintNever } from '#components-ui/print-visibility'; +import { INPI } from '#components/administrations'; +import { estDiffusible } from '#models/core/diffusion'; +import { IUniteLegale } from '#models/core/types'; +import { EScope, hasRights } from '#models/user/rights'; +import { ISession } from '#models/user/session'; + +type IProps = { uniteLegale: IUniteLegale; session: ISession | null }; + +export const DataInpiLinkWithExplanations = ({ + uniteLegale, + session, +}: IProps) => { + const siteLink = `${routes.rne.portail.entreprise}${uniteLegale.siren}`; + + if ( + !estDiffusible(uniteLegale) && + !hasRights(session, EScope.nonDiffusible) + ) { + return ( + <> + Le(s) dirigeant(s) se sont opposés à la diffusion de leurs données + personnelles. Pour télécharger l’extrait d’immatriculation de cette + entreprise, rendez-vous sur le site{' '} + <a href="https://data.inpi.fr">data.inpi.fr</a>. + </> + ); + } + return ( + <PrintNever> + <p> + Pour accéder aux données contenues dans un extrait d’immatriculation + (équivalent de{' '} + <strong> + <a href="/faq/extrait-kbis">l’extrait KBIS ou D1</a> + </strong> + ), vous pouvez soit télécharger l’{' '} + <strong> + extrait des inscriptions au Registre National des Entreprises (RNE) + </strong> + , soit consulter la fiche complète sur le site de l’ + <INPI /> +  : + </p> + <ul className="fr-btns-group fr-btns-group--inline-md fr-btns-group--center"> + <li> + <ButtonLink + nofollow={true} + to={`/justificatif-immatriculation-pdf/${uniteLegale.siren}`} + > + <Icon slug="download"> + Télécharger le justificatif d’immatriculation + </Icon> + </ButtonLink> + </li> + <li> + <ButtonLink + target="_blank" + to={ + siteLink || `${routes.rne.portail.entreprise}${uniteLegale.siren}` + } + alt + > + ⇢ Voir la fiche sur le site de l’INPI + </ButtonLink> + </li> + </ul> + </PrintNever> + ); +}; diff --git a/components/justificatifs/extrait-rne-link/index.tsx b/components/justificatifs/extrait-rne-link/index.tsx index d7a366822..0708f1bc2 100644 --- a/components/justificatifs/extrait-rne-link/index.tsx +++ b/components/justificatifs/extrait-rne-link/index.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { estDiffusible, nonDiffusibleDataFormatter, @@ -6,11 +5,13 @@ import { import { IUniteLegale } from '#models/core/types'; import { EScope, hasRights } from '#models/user/rights'; import { ISession } from '#models/user/session'; +import React from 'react'; const ExtraitRNELink: React.FC<{ uniteLegale: IUniteLegale; + label: string; session: ISession | null; -}> = ({ uniteLegale, session }) => { +}> = ({ uniteLegale, label, session }) => { return estDiffusible(uniteLegale) || hasRights(session, EScope.nonDiffusible) ? ( <a @@ -18,7 +19,7 @@ const ExtraitRNELink: React.FC<{ rel="noopener" href={`/justificatif-immatriculation-pdf/${uniteLegale.siren}`} > - télécharger + {label || 'télécharger'} </a> ) : ( <a href="/faq/justificatif-immatriculation-non-diffusible"> diff --git a/components/section/style.module.css b/components/section/style.module.css index 449f5702a..4f260ec4d 100644 --- a/components/section/style.module.css +++ b/components/section/style.module.css @@ -10,6 +10,7 @@ .section-header { display: flex; justify-content: space-between; + align-items: flex-start; flex-wrap: wrap; margin-bottom: 25px; } diff --git a/components/title-section/index.tsx b/components/title-section/index.tsx index fe5e379cc..93a351e69 100644 --- a/components/title-section/index.tsx +++ b/components/title-section/index.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import IsActiveTag from '#components-ui/is-active-tag'; import SocialMedia from '#components-ui/social-media'; import { Tag } from '#components-ui/tag'; @@ -10,6 +9,7 @@ import { estDiffusible, estNonDiffusibleStrict } from '#models/core/diffusion'; import { IUniteLegale } from '#models/core/types'; import { ISession } from '#models/user/session'; import { formatIntFr } from '#utils/helpers'; +import React from 'react'; import TitleAlerts from './alerts'; import styles from './styles.module.css'; import { FICHE, Tabs } from './tabs'; diff --git a/models/core/types.ts b/models/core/types.ts index 39bc0e7c3..89193d516 100644 --- a/models/core/types.ts +++ b/models/core/types.ts @@ -169,7 +169,7 @@ export interface IUniteLegaleImmatriculation { isPersonneMorale: boolean; capital: number; estCapitalVariable: boolean; - devisCapital: string; + deviseCapital: string; } export interface IUniteLegaleComplements { diff --git a/redirects.json b/redirects.json index ce11a1c58..d5caf96cf 100644 --- a/redirects.json +++ b/redirects.json @@ -1,4 +1,9 @@ [ + { + "source": "/justificatif/:slug", + "destination": "/documents/:slug", + "permanent": true + }, { "source": "/api/qr/:slug", "destination": "/api/share/qr/:slug", From 47e6884b3c4ea82d74b138bb762848d8113b272c Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Mon, 19 Aug 2024 20:14:25 +0200 Subject: [PATCH 03/16] fix: immatriculation can be undefined --- clients/recherche-entreprise/index.ts | 84 ++++++++++++++------------- models/immatriculation/index.ts | 13 ++--- models/immatriculation/rne.ts | 3 - 3 files changed, 48 insertions(+), 52 deletions(-) diff --git a/clients/recherche-entreprise/index.ts b/clients/recherche-entreprise/index.ts index b7b101254..399273598 100644 --- a/clients/recherche-entreprise/index.ts +++ b/clients/recherche-entreprise/index.ts @@ -134,38 +134,8 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { nature_juridique, siege, dirigeants, - complements: { - collectivite_territoriale = null, - est_bio = false, - egapro_renseignee = false, - est_entrepreneur_individuel = false, - est_organisme_formation = false, - est_qualiopi = false, - est_entrepreneur_spectacle = false, - est_ess = false, - est_finess = false, - est_rge = false, - est_service_public = false, - est_uai = false, - est_societe_mission = false, - identifiant_association = null, - statut_entrepreneur_spectacle = '', - est_association = false, - liste_idcc = [], - est_siae = false, - type_siae = '', - }, - immatriculation: { - date_debut_activite = '', - date_immatriculation = '', - date_radiation = '', - duree_personne_morale, - nature_entreprise = [], - date_cloture_exercice = '', - capital_social, - capital_variable = false, - devise_capital = '', - }, + complements, + immatriculation, matching_etablissements, categorie_entreprise, annee_categorie_entreprise = null, @@ -183,6 +153,40 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { nombre_etablissements_ouverts, } = result; + const { + collectivite_territoriale = null, + est_bio = false, + egapro_renseignee = false, + est_entrepreneur_individuel = false, + est_organisme_formation = false, + est_qualiopi = false, + est_entrepreneur_spectacle = false, + est_ess = false, + est_finess = false, + est_rge = false, + est_service_public = false, + est_uai = false, + est_societe_mission = false, + identifiant_association = null, + statut_entrepreneur_spectacle = '', + est_association = false, + liste_idcc = [], + est_siae = false, + type_siae = '', + } = complements || {}; + + const { + date_debut_activite = '', + date_immatriculation = '', + date_radiation = '', + duree_personne_morale, + nature_entreprise = [], + date_cloture_exercice = '', + capital_social, + capital_variable = false, + devise_capital = '', + } = immatriculation || {}; + const nomComplet = (result.nom_complet || 'Nom inconnu').toUpperCase(); const siren = verifySiren(result.siren); @@ -270,16 +274,16 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { typeEntrepriseInclusive: type_siae, }, immatriculation: { - dateDebutActivite: date_debut_activite, - dateImmatriculation: date_immatriculation, - dateRadiation: date_radiation, - duree: duree_personne_morale, + dateDebutActivite: date_debut_activite ?? '', + dateImmatriculation: date_immatriculation ?? '', + dateRadiation: date_radiation ?? '', + duree: duree_personne_morale ?? 0, natureEntreprise: nature_entreprise || [], - dateCloture: date_cloture_exercice, + dateCloture: date_cloture_exercice ?? '', isPersonneMorale: !!capital_social, - capital: capital_social, - estCapitalVariable: capital_variable, - deviseCapital: devise_capital, + capital: capital_social ?? 0, + estCapitalVariable: capital_variable ?? false, + deviseCapital: devise_capital ?? '', }, association: { idAssociation: identifiant_association, diff --git a/models/immatriculation/index.ts b/models/immatriculation/index.ts index 69f415f21..8d2c45025 100644 --- a/models/immatriculation/index.ts +++ b/models/immatriculation/index.ts @@ -19,11 +19,6 @@ export interface IActesRNE { hasBilanConsolide: boolean; } -export interface IImmatriculation { - downloadLink: string; - siteLink: string; -} - export interface IEtatCivil { sexe: 'M' | 'F' | null; nom: string; @@ -65,17 +60,17 @@ export interface IPersonneMorale { export type IDirigeant = IEtatCivil | IPersonneMorale; -export interface IImmatriculationRNE extends IImmatriculation { +export interface IImmatriculationRNE { siren: Siren; identite: IIdentite; dirigeants: IDirigeant[]; beneficiaires: IBeneficiaire[]; - metadata: { - isFallback: boolean; - }; observations: { numObservation: string; dateAjout: string; description: string; }[]; + metadata: { + isFallback: boolean; + }; } diff --git a/models/immatriculation/rne.ts b/models/immatriculation/rne.ts index 96a9a7ea7..6f17619a0 100644 --- a/models/immatriculation/rne.ts +++ b/models/immatriculation/rne.ts @@ -1,7 +1,6 @@ import { fetchRNEImmatriculation } from '#clients/api-proxy/rne'; import { clientDocuments } from '#clients/api-proxy/rne/documents'; import { HttpNotFound } from '#clients/exceptions'; -import routes from '#clients/routes'; import { EAdministration } from '#models/administrations/EAdministration'; import { APINotRespondingFactory, @@ -31,8 +30,6 @@ export const getImmatriculationRNE = async ( return { siren, - downloadLink: `${routes.rne.portail.pdf}?format=pdf&ids=[%22${siren}%22]`, - siteLink: `${routes.rne.portail.entreprise}${siren}`, identite, dirigeants, beneficiaires, From db91cac0d7e62b030a5bb1f898c12174c65543e3 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Tue, 20 Aug 2024 12:44:24 +0200 Subject: [PATCH 04/16] refactor: dirigeants --- .../sections/entreprise/beneficiaires.tsx | 119 +++--------------- .../_component/sections/entreprise/index.tsx | 80 ++++++++---- .../entreprise/protected-dirigeants.tsx | 115 ----------------- .../entreprise/rcs-rne-comparison.tsx | 43 +++++++ .../sections/entreprise/rne-dirigeants.tsx | 63 ++++++---- .../sections/entreprise/summary.tsx | 33 ++--- app/api/data-fetching/routes-handlers.ts | 2 + app/api/data-fetching/routes-scopes.ts | 1 + clients/ping-api-clients.ts | 2 +- clients/recherche-entreprise/index.ts | 4 +- models/espace-agent/mandataires-rcs.ts | 6 +- models/immatriculation/dirigeants.tsx | 31 +++++ models/immatriculation/index.ts | 14 ++- models/immatriculation/rne.ts | 3 +- models/search.ts | 4 +- 15 files changed, 222 insertions(+), 298 deletions(-) delete mode 100644 app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/protected-dirigeants.tsx create mode 100644 app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rcs-rne-comparison.tsx create mode 100644 models/immatriculation/dirigeants.tsx diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/beneficiaires.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/beneficiaires.tsx index 1067d0bc0..9c87d62f5 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/beneficiaires.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/beneficiaires.tsx @@ -1,133 +1,46 @@ -'use client'; - -import React from 'react'; -import routes from '#clients/routes'; import { Warning } from '#components-ui/alerts'; -import InpiPartiallyDownWarning from '#components-ui/alerts-with-explanations/inpi-partially-down'; import { HorizontalSeparator } from '#components-ui/horizontal-separator'; import { INPI } from '#components/administrations'; -import { AsyncDataSectionClient } from '#components/section/data-section/client'; -import { FullTable } from '#components/table/full'; -import { UniteLegalePageLink } from '#components/unite-legale-page-link'; +import { DataSection } from '#components/section/data-section'; import { EAdministration } from '#models/administrations/EAdministration'; -import { IAPINotRespondingError } from '#models/api-not-responding'; import { IUniteLegale } from '#models/core/types'; -import { IDataFetchingState } from '#models/data-fetching'; -import { IBeneficiaire, IImmatriculationRNE } from '#models/immatriculation'; -import { formatDatePartial } from '#utils/helpers'; +import React from 'react'; type IProps = { - immatriculationRNE: - | IImmatriculationRNE - | IAPINotRespondingError - | IDataFetchingState; uniteLegale: IUniteLegale; }; -function hasSeveralBeneficiaires(immatriculationRNE: IImmatriculationRNE) { - return immatriculationRNE.beneficiaires.length > 1; -} - /** * Dirigeants section * @param param0 * @returns */ -const BeneficiairesSection: React.FC<IProps> = ({ - immatriculationRNE, - uniteLegale, -}) => { +const BeneficiairesSection: React.FC<IProps> = ({ uniteLegale }) => { return ( <> <HorizontalSeparator /> - <AsyncDataSectionClient + <DataSection id="beneficiaires" title="Bénéficiaire(s) effectif(s)" sources={[EAdministration.INPI]} - notFoundInfo={ - <> - Cette structure n’est pas enregistrée au{' '} - <strong>Registre National des Entreprises (RNE)</strong> - </> - } - data={immatriculationRNE} + data={uniteLegale} > - {(immatriculationRNE) => ( - <BénéficiairesContent - immatriculationRNE={immatriculationRNE} - uniteLegale={uniteLegale} - /> - )} - </AsyncDataSectionClient> + {(uniteLegale) => + uniteLegale.dateMiseAJourInpi ? ( + <WarningRBE /> + ) : ( + <> + Cette structure n’est pas enregistrée au{' '} + <strong>Registre National des Entreprises (RNE)</strong> + </> + ) + } + </DataSection> </> ); }; export default BeneficiairesSection; -type IBeneficiairesContentProps = { - immatriculationRNE: IImmatriculationRNE; - uniteLegale: IUniteLegale; -}; -function BénéficiairesContent({ - immatriculationRNE, - uniteLegale, -}: IBeneficiairesContentProps) { - const { beneficiaires } = immatriculationRNE; - - const formtInfos = (beneficiaire: IBeneficiaire) => [ - beneficiaire.nationalite, - <> - {beneficiaire.prenoms} - {beneficiaire.prenoms && ' '} - {(beneficiaire.nom || '').toUpperCase()}, né(e) en{' '} - {formatDatePartial(beneficiaire.dateNaissancePartial)} - </>, - ]; - - const plural = hasSeveralBeneficiaires(immatriculationRNE) ? 's' : ''; - - return ( - <> - <WarningRBE /> - {immatriculationRNE.beneficiaires.length === 0 ? null : ( - <> - {immatriculationRNE.metadata.isFallback && ( - <InpiPartiallyDownWarning /> - )} - <p> - Cette entreprise possède {beneficiaires.length}{' '} - <a - rel="noreferrer noopener" - target="_blank" - href="https://www.inpi.fr/fr/faq/qu-est-ce-qu-un-beneficiaire-effectif" - > - bénéficiaire{plural} effectif{plural} - </a>{' '} - enregistré{plural} au{' '} - <strong>Registre National des Entreprises (RNE)</strong> tenu par l’ - <INPI />. Retrouvez le détail des modalités de contrôle sur{' '} - <UniteLegalePageLink - uniteLegale={uniteLegale} - href={`${routes.rne.portail.entreprise}${uniteLegale.siren}`} - siteName="le site de l’INPI" - /> -  : - </p> - <FullTable - head={['Nationalité', 'Détails']} - body={beneficiaires.map((beneficiaire) => formtInfos(beneficiaire))} - /> - </> - )} - <style global jsx>{` - table > tbody > tr > td:first-of-type { - width: 30%; - } - `}</style> - </> - ); -} - const WarningRBE = () => ( <Warning> À compter du 31 juillet 2024, le registre des bénéficiaires effectifs{' '} diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx index f18398d66..6731b90d3 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx @@ -1,15 +1,44 @@ 'use client'; import BreakPageForPrint from '#components-ui/print-break-page'; +import { IAPINotRespondingError } from '#models/api-not-responding'; import { IUniteLegale } from '#models/core/types'; -import { isDataSuccess } from '#models/data-fetching'; +import { + IDataFetchingState, + isDataLoading, + isDataSuccess, + isUnauthorized, +} from '#models/data-fetching'; +import { IDirigeants } from '#models/immatriculation'; import { ISession } from '#models/user/session'; import { useAPIRouteData } from 'hooks/fetch/use-API-route-data'; import BeneficiairesSection from './beneficiaires'; -import DirigeantsProtectedSection from './protected-dirigeants'; +import RCSRNEComparison from './rcs-rne-comparison'; import DirigeantsSection from './rne-dirigeants'; import DirigeantSummary from './summary'; +export type IDirigeantsFetching = + | IDirigeants + | IAPINotRespondingError + | IDataFetchingState; + +function mergeDirigeants( + dirigeantsRNE: IDirigeantsFetching, + dirigeantsRCS: IDirigeantsFetching +) { + if (isUnauthorized(dirigeantsRCS)) { + return { dirigeants: dirigeantsRNE, isProtected: false }; + } else { + if (isDataLoading(dirigeantsRCS) || isDataLoading(dirigeantsRNE)) { + return { dirigeants: IDataFetchingState.LOADING, isProtected: false }; + } + if (isDataSuccess(dirigeantsRCS)) { + return { dirigeants: dirigeantsRCS, isProtected: true }; + } + } + return { dirigeants: dirigeantsRNE, isProtected: false }; +} + export function DirigeantInformation({ uniteLegale, session, @@ -17,7 +46,11 @@ export function DirigeantInformation({ uniteLegale: IUniteLegale; session: ISession | null; }) { - const immatriculationRNE = useAPIRouteData('rne', uniteLegale.siren, session); + const dirigeantsRNE = useAPIRouteData( + 'rne-dirigeants', + uniteLegale.siren, + session + ); const mandatairesRCS = useAPIRouteData( 'espace-agent/rcs-mandataires', @@ -25,32 +58,33 @@ export function DirigeantInformation({ session ); - const hasMandataireRCS = isDataSuccess(mandatairesRCS); + const { dirigeants, isProtected } = mergeDirigeants( + dirigeantsRNE, + mandatairesRCS + ); return ( <> - <DirigeantSummary + <DirigeantSummary uniteLegale={uniteLegale} dirigeants={dirigeants} /> + <DirigeantsSection uniteLegale={uniteLegale} - immatriculationRNE={immatriculationRNE} + dirigeants={dirigeants} + isProtected={isProtected} + warning={ + <> + {/* {metadata.isFallback && dirigeants.length > 0 && ( + <InpiPartiallyDownWarning /> + )} */} + <RCSRNEComparison + dirigeantsRCS={mandatairesRCS} + dirigeantsRNE={dirigeantsRNE} + uniteLegale={uniteLegale} + /> + </> + } /> - {hasMandataireRCS ? ( - <DirigeantsProtectedSection - uniteLegale={uniteLegale} - immatriculationRNE={immatriculationRNE} - mandatairesRCS={mandatairesRCS} - /> - ) : ( - <DirigeantsSection - uniteLegale={uniteLegale} - immatriculationRNE={immatriculationRNE} - /> - )} - <BreakPageForPrint /> - <BeneficiairesSection - immatriculationRNE={immatriculationRNE} - uniteLegale={uniteLegale} - /> + <BeneficiairesSection uniteLegale={uniteLegale} /> </> ); } diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/protected-dirigeants.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/protected-dirigeants.tsx deleted file mode 100644 index 381ed1b71..000000000 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/protected-dirigeants.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import routes from '#clients/routes'; -import { Info, Warning } from '#components-ui/alerts'; -import { INPI } from '#components/administrations'; -import { DataSectionClient } from '#components/section/data-section'; -import { EAdministration } from '#models/administrations/EAdministration'; -import { IAPINotRespondingError } from '#models/api-not-responding'; -import { IUniteLegale } from '#models/core/types'; -import { IDataFetchingState, isDataSuccess } from '#models/data-fetching'; -import { IDirigeant, IImmatriculationRNE } from '#models/immatriculation'; -import { DirigeantContent } from './dirigeant-content'; - -type IProps = { - immatriculationRNE: - | IImmatriculationRNE - | IAPINotRespondingError - | IDataFetchingState; - uniteLegale: IUniteLegale; - mandatairesRCS: - | Array<IDirigeant> - | IAPINotRespondingError - | IDataFetchingState; -}; - -function RCSDiffersFromRNE({ - mandatairesRCS, - immatriculationRNE, - uniteLegale, -}: { - mandatairesRCS: Array<IDirigeant>; - immatriculationRNE: - | IImmatriculationRNE - | IAPINotRespondingError - | IDataFetchingState; - uniteLegale: IUniteLegale; -}) { - if (!isDataSuccess(immatriculationRNE)) { - return null; - } - - if (immatriculationRNE.dirigeants.length === mandatairesRCS.length) { - return null; - } - - return ( - <Warning> - Les données d’Infogreffe sont issues du RNE mais il y a une différence - entre le nombre de dirigeant(s) retourné(s) par l’ - <INPI />({immatriculationRNE.dirigeants.length}) et par Infogreffe ( - {mandatairesRCS.length}). Pour comparer, vous pouvez consulter la page de - cette entreprise sur{' '} - <a - rel="noopener" - target="_blank" - href={`${routes.rne.portail.entreprise}${uniteLegale.siren}`} - aria-label="Consulter la liste des dirigeants sur le site de l’INPI, nouvelle fenêtre" - > - data.inpi.fr - </a> - . - </Warning> - ); -} - -/** - * Dirigeants for agents : either from Infogreffe or from RNE - */ -function DirigeantsProtectedSection({ - uniteLegale, - immatriculationRNE, - mandatairesRCS, -}: IProps) { - return ( - <DataSectionClient - id="rne-dirigeants" - title="Dirigeant(s)" - isProtected - // @ts-ignore - notFoundInfo={null} - sources={[EAdministration.INPI, EAdministration.INFOGREFFE]} - data={mandatairesRCS} - > - {(mandatairesRCS) => ( - <> - <Info> - Ces informations proviennent d’ - <a - rel="noopener" - target="_blank" - href={`${routes.infogreffe.portail.home}`} - aria-label="Visiter le site d’Infogreffe, nouvelle fenêtre" - > - Infogreffe - </a>{' '} - et incluent la date de naissance des dirigeant(e)s. - </Info> - <RCSDiffersFromRNE - mandatairesRCS={mandatairesRCS} - immatriculationRNE={immatriculationRNE} - uniteLegale={uniteLegale} - /> - <p> - Cette entreprise possède {mandatairesRCS.length} dirigeant(s) - enregistré(s) au RNE : - </p> - <DirigeantContent - dirigeants={mandatairesRCS} - uniteLegale={uniteLegale} - /> - </> - )} - </DataSectionClient> - ); -} - -export default DirigeantsProtectedSection; diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rcs-rne-comparison.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rcs-rne-comparison.tsx new file mode 100644 index 000000000..ee305cc79 --- /dev/null +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rcs-rne-comparison.tsx @@ -0,0 +1,43 @@ +import routes from '#clients/routes'; +import { Warning } from '#components-ui/alerts'; +import { INPI } from '#components/administrations'; +import { IUniteLegale } from '#models/core/types'; +import { isDataSuccess } from '#models/data-fetching'; +import { IDirigeantsFetching } from '.'; + +function RCSRNEComparison({ + dirigeantsRNE, + dirigeantsRCS, + uniteLegale, +}: { + dirigeantsRNE: IDirigeantsFetching; + dirigeantsRCS: IDirigeantsFetching; + uniteLegale: IUniteLegale; +}) { + if (!isDataSuccess(dirigeantsRNE) || !isDataSuccess(dirigeantsRCS)) { + return null; + } else if (dirigeantsRNE.data.length === dirigeantsRCS.data.length) { + return null; + } + + return ( + <Warning> + Les données d’Infogreffe sont issues du RNE mais il y a une différence + entre le nombre de dirigeant(s) retourné(s) par l’ + <INPI />({dirigeantsRNE.data.length}) et par Infogreffe ( + {dirigeantsRCS.data.length} + ). Pour comparer, vous pouvez consulter la page de cette entreprise sur{' '} + <a + rel="noopener" + target="_blank" + href={`${routes.rne.portail.entreprise}${uniteLegale.siren}`} + aria-label="Consulter la liste des dirigeants sur le site de l’INPI, nouvelle fenêtre" + > + data.inpi.fr + </a> + . + </Warning> + ); +} + +export default RCSRNEComparison; diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rne-dirigeants.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rne-dirigeants.tsx index 8f62e3102..b635f45fe 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rne-dirigeants.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rne-dirigeants.tsx @@ -1,33 +1,42 @@ import routes from '#clients/routes'; -import InpiPartiallyDownWarning from '#components-ui/alerts-with-explanations/inpi-partially-down'; +import { Info } from '#components-ui/alerts'; import { INPI } from '#components/administrations'; import { AsyncDataSectionClient } from '#components/section/data-section/client'; import { UniteLegalePageLink } from '#components/unite-legale-page-link'; import { EAdministration } from '#models/administrations/EAdministration'; -import { IAPINotRespondingError } from '#models/api-not-responding'; import { IUniteLegale } from '#models/core/types'; -import { IDataFetchingState } from '#models/data-fetching'; -import { IImmatriculationRNE } from '#models/immatriculation'; +import { IDirigeantsFetching } from '.'; import { DirigeantContent } from './dirigeant-content'; type IProps = { - immatriculationRNE: - | IImmatriculationRNE - | IAPINotRespondingError - | IDataFetchingState; + dirigeants: IDirigeantsFetching; uniteLegale: IUniteLegale; + isProtected: boolean; + warning: JSX.Element; }; /** * Dirigeants section */ -function DirigeantsSection({ uniteLegale, immatriculationRNE }: IProps) { +function DirigeantsSection({ + uniteLegale, + dirigeants, + isProtected, + warning, +}: IProps) { + const sources = [EAdministration.INPI]; + + if (isProtected) { + sources.push(EAdministration.INFOGREFFE); + } + return ( <AsyncDataSectionClient id="rne-dirigeants" title="Dirigeant(s)" - sources={[EAdministration.INPI]} - data={immatriculationRNE} + sources={sources} + data={dirigeants} + isProtected={isProtected} notFoundInfo={ <> Cette structure n’est pas enregistrée au{' '} @@ -35,15 +44,26 @@ function DirigeantsSection({ uniteLegale, immatriculationRNE }: IProps) { </> } > - {(immatriculationRNE) => { - const plural = immatriculationRNE.dirigeants.length > 1 ? 's' : ''; + {(dirigeants) => { + const plural = dirigeants.data.length > 1 ? 's' : ''; return ( <> - {immatriculationRNE.metadata.isFallback && - immatriculationRNE.dirigeants.length > 0 && ( - <InpiPartiallyDownWarning /> - )} - {immatriculationRNE.dirigeants.length === 0 ? ( + {warning ? warning : null} + {isProtected ? ( + <Info> + Ces informations proviennent d’ + <a + rel="noopener" + target="_blank" + href={`${routes.infogreffe.portail.home}`} + aria-label="Visiter le site d’Infogreffe, nouvelle fenêtre" + > + Infogreffe + </a>{' '} + et incluent la date de naissance des dirigeant(e)s. + </Info> + ) : null} + {dirigeants.data.length === 0 ? ( <p> Cette entreprise est enregistrée au{' '} <strong>Registre National des Entreprises (RNE)</strong>, mais @@ -52,9 +72,8 @@ function DirigeantsSection({ uniteLegale, immatriculationRNE }: IProps) { ) : ( <> <p> - Cette entreprise possède{' '} - {immatriculationRNE.dirigeants.length} dirigeant{plural}{' '} - enregistré{plural} au{' '} + Cette entreprise possède {dirigeants.data.length} dirigeant + {plural} enregistré{plural} au{' '} <strong>Registre National des Entreprises (RNE)</strong> tenu par l’ <INPI />. Pour en savoir plus, vous pouvez consulter{' '} @@ -67,7 +86,7 @@ function DirigeantsSection({ uniteLegale, immatriculationRNE }: IProps) { </p> <DirigeantContent - dirigeants={immatriculationRNE.dirigeants} + dirigeants={dirigeants.data} uniteLegale={uniteLegale} /> </> diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/summary.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/summary.tsx index 15a096a70..c7e6fa24c 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/summary.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/summary.tsx @@ -2,18 +2,11 @@ import { HttpNotFound } from '#clients/exceptions'; import { Icon } from '#components-ui/icon/wrapper'; import { Loader } from '#components-ui/loader'; import { INPI, INSEE, MI } from '#components/administrations'; -import { - IAPINotRespondingError, - isAPINotResponding, -} from '#models/api-not-responding'; +import { isAPINotResponding } from '#models/api-not-responding'; import { IUniteLegale } from '#models/core/types'; -import { - IDataFetchingState, - hasAnyError, - isDataLoading, -} from '#models/data-fetching'; -import { IImmatriculationRNE } from '#models/immatriculation'; +import { hasAnyError, isDataLoading } from '#models/data-fetching'; import { useTimeout } from 'hooks'; +import { IDirigeantsFetching } from '.'; const NoDirigeantAssociation = ({ idAssociation = '' }) => ( <> @@ -47,20 +40,17 @@ const NoDirigeantDefault = () => ( ); type IDirigeantSummaryProps = { - immatriculationRNE: - | IImmatriculationRNE - | IAPINotRespondingError - | IDataFetchingState; + dirigeants: IDirigeantsFetching; uniteLegale: IUniteLegale; }; const DirigeantSummary: React.FC<IDirigeantSummaryProps> = ({ uniteLegale, - immatriculationRNE, + dirigeants, }) => { const summaries = []; const after100ms = useTimeout(100); - if (isDataLoading(immatriculationRNE)) { + if (isDataLoading(dirigeants)) { if (!after100ms) { return null; } @@ -70,8 +60,8 @@ const DirigeantSummary: React.FC<IDirigeantSummaryProps> = ({ </span> ); } else { - if (!hasAnyError(immatriculationRNE)) { - const dirigeantsCount = (immatriculationRNE?.dirigeants || []).length; + if (!hasAnyError(dirigeants)) { + const dirigeantsCount = (dirigeants.data || []).length; summaries.push( <a href="#rne-dirigeants"> {dirigeantsCount} dirigeants inscrits au Registre National des @@ -79,8 +69,7 @@ const DirigeantSummary: React.FC<IDirigeantSummaryProps> = ({ </a> ); - const beneficiairesCount = (immatriculationRNE?.beneficiaires || []) - .length; + const beneficiairesCount = 0; summaries.push( <a href="#beneficiaires"> <Icon slug="alertFill" color="#ff9c00"> @@ -101,8 +90,8 @@ const DirigeantSummary: React.FC<IDirigeantSummaryProps> = ({ /> ); } else if ( - isAPINotResponding(immatriculationRNE) && - !(immatriculationRNE instanceof HttpNotFound) + isAPINotResponding(dirigeants) && + !(dirigeants instanceof HttpNotFound) ) { return null; } diff --git a/app/api/data-fetching/routes-handlers.ts b/app/api/data-fetching/routes-handlers.ts index 63eb07e28..4652b778c 100644 --- a/app/api/data-fetching/routes-handlers.ts +++ b/app/api/data-fetching/routes-handlers.ts @@ -7,6 +7,7 @@ import { getQualibat } from '#models/espace-agent/certificats/qualibat'; import { getQualifelec } from '#models/espace-agent/certificats/qualifelec'; import { getConformiteEntreprise } from '#models/espace-agent/conformite'; import { getMandatairesRCS } from '#models/espace-agent/mandataires-rcs'; +import { getDirigeantsRNE } from '#models/immatriculation/dirigeants'; import { getDocumentsRNEProtected, getImmatriculationRNE, @@ -23,6 +24,7 @@ export const APIRoutesHandlers = { 'espace-agent/rcs-mandataires': getMandatairesRCS, 'espace-agent/rne/documents': getDocumentsRNEProtected, 'espace-agent/association-protected': getAssociationProtected, + 'rne-dirigeants': getDirigeantsRNE, rne: getImmatriculationRNE, association: getAssociationFromSlug, 'verify-tva': buildAndVerifyTVA, diff --git a/app/api/data-fetching/routes-scopes.ts b/app/api/data-fetching/routes-scopes.ts index 4b8f31698..97c44fd55 100644 --- a/app/api/data-fetching/routes-scopes.ts +++ b/app/api/data-fetching/routes-scopes.ts @@ -11,6 +11,7 @@ export const APIRoutesScopes: Record<APIPath, EScope> = { 'espace-agent/rcs-mandataires': EScope.mandatairesRCS, 'espace-agent/rne/documents': EScope.documentsRne, 'espace-agent/association-protected': EScope.associationProtected, + 'rne-dirigeants': EScope.none, rne: EScope.none, association: EScope.none, 'verify-tva': EScope.none, diff --git a/clients/ping-api-clients.ts b/clients/ping-api-clients.ts index cbcafdbc6..e7f6ac1bf 100644 --- a/clients/ping-api-clients.ts +++ b/clients/ping-api-clients.ts @@ -51,7 +51,7 @@ const ping = async (slug: string | string[]) => { case 'api-recherche': return await clientSearchRechercheEntreprise({ searchTerms: 'test', - page: 1, + pageResultatsRecherche: 1, searchFilterParams: undefined, fallbackOnStaging: false, useCache, diff --git a/clients/recherche-entreprise/index.ts b/clients/recherche-entreprise/index.ts index 399273598..5284ea94b 100644 --- a/clients/recherche-entreprise/index.ts +++ b/clients/recherche-entreprise/index.ts @@ -61,7 +61,7 @@ const clientSearchRechercheEntreprise = async ({ useCache = false, inclureEtablissements = false, inclureImmatriculation = false, - pageResultatsRecherche, + pageResultatsRecherche = 1, pageEtablissements = 1, }: ClientSearchRechercheEntreprise): Promise<ISearchResults> => { const encodedTerms = encodeURIComponent(searchTerms); @@ -82,6 +82,7 @@ const clientSearchRechercheEntreprise = async ({ url += `?per_page=10&page=${pageResultatsRecherche}&q=${encodedTerms}&limite_matching_etablissements=3${ searchFilterParams?.toApiURI() || '' }`; + url += `&include_admin=slug`; if (inclureEtablissements) { @@ -102,7 +103,6 @@ const clientSearchRechercheEntreprise = async ({ ? constants.timeout.XL : constants.timeout.L; - console.log(url); const results = await httpGet<ISearchResponse>(url, { timeout, headers: { referer: 'annuaire-entreprises-site' }, diff --git a/models/espace-agent/mandataires-rcs.ts b/models/espace-agent/mandataires-rcs.ts index 5a6fe16d3..474c1cba9 100644 --- a/models/espace-agent/mandataires-rcs.ts +++ b/models/espace-agent/mandataires-rcs.ts @@ -4,20 +4,20 @@ import { APINotRespondingFactory, IAPINotRespondingError, } from '#models/api-not-responding'; -import { IDirigeant } from '#models/immatriculation'; +import { IDirigeants } from '#models/immatriculation'; import { verifySiren } from '#utils/helpers'; import { handleApiEntrepriseError } from './utils'; export const getMandatairesRCS = async ( maybeSiren: string -): Promise<Array<IDirigeant> | IAPINotRespondingError> => { +): Promise<IDirigeants | IAPINotRespondingError> => { const siren = verifySiren(maybeSiren); try { const mandatairesRCS = await clientApiEntrepriseMandatairesRCS(siren); if (mandatairesRCS.length === 0) { return APINotRespondingFactory(EAdministration.INFOGREFFE, 404); } - return mandatairesRCS; + return { data: mandatairesRCS }; } catch (error) { return handleApiEntrepriseError(error, { siren, diff --git a/models/immatriculation/dirigeants.tsx b/models/immatriculation/dirigeants.tsx new file mode 100644 index 000000000..75701d10f --- /dev/null +++ b/models/immatriculation/dirigeants.tsx @@ -0,0 +1,31 @@ +import { fetchRNEImmatriculation } from '#clients/api-proxy/rne'; +import { HttpNotFound } from '#clients/exceptions'; +import { EAdministration } from '#models/administrations/EAdministration'; +import { + APINotRespondingFactory, + IAPINotRespondingError, +} from '#models/api-not-responding'; +import { verifySiren } from '#utils/helpers'; +import { IDirigeantsRNE } from '.'; + +/* + * Request Immatriculation from INPI's RNE + * @param siren + */ +export const getDirigeantsRNE = async ( + maybeSiren: string +): Promise<IAPINotRespondingError | IDirigeantsRNE> => { + const siren = verifySiren(maybeSiren); + + try { + const { dirigeants } = await fetchRNEImmatriculation(siren); + + return { data: dirigeants, metadata: { isFallback: false } }; + } catch (e: any) { + if (e instanceof HttpNotFound) { + return APINotRespondingFactory(EAdministration.INPI, 404); + } + + return APINotRespondingFactory(EAdministration.INPI, 500); + } +}; diff --git a/models/immatriculation/index.ts b/models/immatriculation/index.ts index 8d2c45025..3060df98f 100644 --- a/models/immatriculation/index.ts +++ b/models/immatriculation/index.ts @@ -58,13 +58,11 @@ export interface IPersonneMorale { role: string; } -export type IDirigeant = IEtatCivil | IPersonneMorale; - export interface IImmatriculationRNE { siren: Siren; identite: IIdentite; - dirigeants: IDirigeant[]; beneficiaires: IBeneficiaire[]; + dirigeants: (IEtatCivil | IPersonneMorale)[]; observations: { numObservation: string; dateAjout: string; @@ -74,3 +72,13 @@ export interface IImmatriculationRNE { isFallback: boolean; }; } + +export interface IDirigeants { + data: (IEtatCivil | IPersonneMorale)[]; +} + +export interface IDirigeantsRNE extends IDirigeants { + metadata: { + isFallback: boolean; + }; +} diff --git a/models/immatriculation/rne.ts b/models/immatriculation/rne.ts index 6f17619a0..7362343bf 100644 --- a/models/immatriculation/rne.ts +++ b/models/immatriculation/rne.ts @@ -23,7 +23,6 @@ export const getImmatriculationRNE = async ( const { identite, metadata, - dirigeants, beneficiaires, observations = [], } = await fetchRNEImmatriculation(siren); @@ -31,7 +30,7 @@ export const getImmatriculationRNE = async ( return { siren, identite, - dirigeants, + dirigeants: [], beneficiaires, observations, metadata, diff --git a/models/search.ts b/models/search.ts index a62fd72ad..18c79d2f2 100644 --- a/models/search.ts +++ b/models/search.ts @@ -1,6 +1,5 @@ import { HttpBadRequestError, HttpNotFound } from '#clients/exceptions'; import clientSearchRechercheEntreprise from '#clients/recherche-entreprise'; -import { IDirigeant } from '#models/immatriculation'; import SearchFilterParams from '#models/search-filter-params'; import { removeSpecialChars } from '#utils/helpers'; import { isProtectedSiren } from '#utils/helpers/is-protected-siren-or-siret'; @@ -12,13 +11,14 @@ import { IsLikelyASirenOrSiretException, NotEnoughParamsException, } from './core/types'; +import { IDirigeants } from './immatriculation'; export interface ISearchResult extends IUniteLegale { nombreEtablissements: number; nombreEtablissementsOuverts: number; chemin: string; matchingEtablissements: IEtablissement[]; - dirigeants: IDirigeant[]; + dirigeants: IDirigeants['data']; } export interface ISearchResults { From bde8f74ac8cda76e63b3508a942b745e5e5969ed Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Wed, 21 Aug 2024 15:53:21 +0200 Subject: [PATCH 05/16] feat: fallback warning --- .../[slug]/_components/observations-rne.tsx | 10 ++++++---- .../_component/sections/entreprise/index.tsx | 15 +++++---------- .../sections/entreprise/rne-dirigeants.tsx | 2 ++ models/immatriculation/dirigeants.tsx | 4 ++-- models/immatriculation/index.ts | 5 +---- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx index a4cbf4a8c..9be23bfa9 100644 --- a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx +++ b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx @@ -1,5 +1,6 @@ 'use client'; +import InpiPartiallyDownWarning from '#components-ui/alerts-with-explanations/inpi-partially-down'; import { Tag } from '#components-ui/tag'; import { AsyncDataSectionClient } from '#components/section/data-section/client'; import { FullTable } from '#components/table/full'; @@ -31,11 +32,12 @@ export const ObservationsRNE: React.FC<{ immatriculationRNE.observations && immatriculationRNE.observations.length > 0 ? ( <> - <br /> + {immatriculationRNE.metadata.isFallback && ( + <InpiPartiallyDownWarning /> + )} <p> - Cette structure possède également{' '} - {immatriculationRNE.observations.length} observation(s) au{' '} - <strong>RNE</strong> + Cette structure possède {immatriculationRNE.observations.length}{' '} + observation(s) au <strong>RNE</strong>  : </p> <FullTable diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx index 6731b90d3..d90e69f58 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx @@ -71,16 +71,11 @@ export function DirigeantInformation({ dirigeants={dirigeants} isProtected={isProtected} warning={ - <> - {/* {metadata.isFallback && dirigeants.length > 0 && ( - <InpiPartiallyDownWarning /> - )} */} - <RCSRNEComparison - dirigeantsRCS={mandatairesRCS} - dirigeantsRNE={dirigeantsRNE} - uniteLegale={uniteLegale} - /> - </> + <RCSRNEComparison + dirigeantsRCS={mandatairesRCS} + dirigeantsRNE={dirigeantsRNE} + uniteLegale={uniteLegale} + /> } /> <BreakPageForPrint /> diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rne-dirigeants.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rne-dirigeants.tsx index b635f45fe..bc9ad7227 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rne-dirigeants.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/rne-dirigeants.tsx @@ -1,5 +1,6 @@ import routes from '#clients/routes'; import { Info } from '#components-ui/alerts'; +import InpiPartiallyDownWarning from '#components-ui/alerts-with-explanations/inpi-partially-down'; import { INPI } from '#components/administrations'; import { AsyncDataSectionClient } from '#components/section/data-section/client'; import { UniteLegalePageLink } from '#components/unite-legale-page-link'; @@ -48,6 +49,7 @@ function DirigeantsSection({ const plural = dirigeants.data.length > 1 ? 's' : ''; return ( <> + {dirigeants.metadata?.isFallback && <InpiPartiallyDownWarning />} {warning ? warning : null} {isProtected ? ( <Info> diff --git a/models/immatriculation/dirigeants.tsx b/models/immatriculation/dirigeants.tsx index 75701d10f..79cc590c5 100644 --- a/models/immatriculation/dirigeants.tsx +++ b/models/immatriculation/dirigeants.tsx @@ -6,7 +6,7 @@ import { IAPINotRespondingError, } from '#models/api-not-responding'; import { verifySiren } from '#utils/helpers'; -import { IDirigeantsRNE } from '.'; +import { IDirigeants } from '.'; /* * Request Immatriculation from INPI's RNE @@ -14,7 +14,7 @@ import { IDirigeantsRNE } from '.'; */ export const getDirigeantsRNE = async ( maybeSiren: string -): Promise<IAPINotRespondingError | IDirigeantsRNE> => { +): Promise<IAPINotRespondingError | IDirigeants> => { const siren = verifySiren(maybeSiren); try { diff --git a/models/immatriculation/index.ts b/models/immatriculation/index.ts index 3060df98f..ae848a8f0 100644 --- a/models/immatriculation/index.ts +++ b/models/immatriculation/index.ts @@ -75,10 +75,7 @@ export interface IImmatriculationRNE { export interface IDirigeants { data: (IEtatCivil | IPersonneMorale)[]; -} - -export interface IDirigeantsRNE extends IDirigeants { - metadata: { + metadata?: { isFallback: boolean; }; } From 0f484793e6f7cd787230b7f297c649a3690f04d4 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Tue, 27 Aug 2024 14:59:36 +0200 Subject: [PATCH 06/16] feat: fallback dirigeant on recherche entreprise --- .../[slug]/_components/observations-rne.tsx | 23 +- .../sections/entreprise/dirigeant-content.tsx | 6 +- .../_component/sections/entreprise/index.tsx | 2 +- .../_component/sections/is-personne-morale.ts | 2 +- .../[slug]/_components/actes/rne.tsx | 2 +- .../elus/_component/section/elus-section.tsx | 4 +- .../_components/immatriculation-section.tsx | 22 +- app/api/data-fetching/routes-handlers.ts | 4 +- .../api-entreprise/mandataires-rcs/index.ts | 6 +- clients/api-proxy/rne/documents.ts | 2 +- clients/api-proxy/rne/fallback.ts | 25 --- clients/api-proxy/rne/index.ts | 67 +++++- clients/recherche-entreprise/dirigeants.ts | 23 ++ clients/recherche-entreprise/index.ts | 195 +---------------- clients/recherche-entreprise/interface.ts | 6 +- .../recherche-entreprise/mapToDomain/index.ts | 203 ++++++++++++++++++ components/search-results/results-list.tsx | 4 +- models/core/types.ts | 11 +- models/core/unite-legale.ts | 11 + models/espace-agent/mandataires-rcs.ts | 2 +- .../espace-agent/rne-protected/documents.ts | 23 ++ models/immatriculation/rne.ts | 71 ------ .../{immatriculation => rne}/dirigeants.tsx | 15 +- models/rne/immatriculation.ts | 43 ++++ models/rne/observations.ts | 39 ++++ .../index.ts => rne/types.ts} | 31 +-- models/search-filter-params.ts | 2 +- models/search.ts | 2 +- pages/personne/index.tsx | 4 +- 29 files changed, 467 insertions(+), 383 deletions(-) delete mode 100644 clients/api-proxy/rne/fallback.ts create mode 100644 clients/recherche-entreprise/dirigeants.ts create mode 100644 clients/recherche-entreprise/mapToDomain/index.ts create mode 100644 models/espace-agent/rne-protected/documents.ts delete mode 100644 models/immatriculation/rne.ts rename models/{immatriculation => rne}/dirigeants.tsx (65%) create mode 100644 models/rne/immatriculation.ts create mode 100644 models/rne/observations.ts rename models/{immatriculation/index.ts => rne/types.ts} (56%) diff --git a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx index 9be23bfa9..d32955e9d 100644 --- a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx +++ b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx @@ -13,14 +13,18 @@ export const ObservationsRNE: React.FC<{ uniteLegale: IUniteLegale; session: ISession | null; }> = ({ uniteLegale, session }) => { - const immatriculationRNE = useAPIRouteData('rne', uniteLegale.siren, session); + const observations = useAPIRouteData( + 'observations', + uniteLegale.siren, + session + ); return ( <AsyncDataSectionClient id="observations-rne" title="Observations au RNE" sources={[EAdministration.INPI]} - data={immatriculationRNE} + data={observations} notFoundInfo={ <> Cette structure ne possède pas de fiche d’immatriculation au{' '} @@ -28,21 +32,18 @@ export const ObservationsRNE: React.FC<{ </> } > - {(immatriculationRNE) => - immatriculationRNE.observations && - immatriculationRNE.observations.length > 0 ? ( + {(observations) => + observations && observations.length > 0 ? ( <> - {immatriculationRNE.metadata.isFallback && ( - <InpiPartiallyDownWarning /> - )} + {metadata.isFallback && <InpiPartiallyDownWarning />} <p> - Cette structure possède {immatriculationRNE.observations.length}{' '} - observation(s) au <strong>RNE</strong> + Cette structure possède {observations.length} observation(s) au{' '} + <strong>RNE</strong>  : </p> <FullTable head={['Date d’ajout', 'Numéro d’observation', 'Description']} - body={immatriculationRNE.observations.map((o) => [ + body={observations.map((o) => [ o.dateAjout, o.numObservation ? <Tag>{o.numObservation}</Tag> : '', o.description, diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/dirigeant-content.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/dirigeant-content.tsx index 06879482b..a4faed651 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/dirigeant-content.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/dirigeant-content.tsx @@ -1,10 +1,6 @@ import { FullTable } from '#components/table/full'; import { IUniteLegale } from '#models/core/types'; -import { - IDirigeants, - IEtatCivil, - IPersonneMorale, -} from '#models/immatriculation'; +import { IDirigeants, IEtatCivil, IPersonneMorale } from '#models/rne/types'; import { formatDateLong, formatDatePartial, formatIntFr } from '#utils/helpers'; import { isPersonneMorale } from '../is-personne-morale'; diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx index d90e69f58..9552876f8 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/index.tsx @@ -9,7 +9,7 @@ import { isDataSuccess, isUnauthorized, } from '#models/data-fetching'; -import { IDirigeants } from '#models/immatriculation'; +import { IDirigeants } from '#models/rne/types'; import { ISession } from '#models/user/session'; import { useAPIRouteData } from 'hooks/fetch/use-API-route-data'; import BeneficiairesSection from './beneficiaires'; diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/is-personne-morale.ts b/app/(header-default)/dirigeants/[slug]/_component/sections/is-personne-morale.ts index d24158a7c..d3b9868fa 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/is-personne-morale.ts +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/is-personne-morale.ts @@ -1,4 +1,4 @@ -import { IEtatCivil, IPersonneMorale } from '#models/immatriculation'; +import { IEtatCivil, IPersonneMorale } from '#models/rne/types'; /** * Weird bug happennig here. Webpack build fail when this function is in model/dirigeants.ts diff --git a/app/(header-default)/documents/[slug]/_components/actes/rne.tsx b/app/(header-default)/documents/[slug]/_components/actes/rne.tsx index 09c430394..8b5eeec22 100644 --- a/app/(header-default)/documents/[slug]/_components/actes/rne.tsx +++ b/app/(header-default)/documents/[slug]/_components/actes/rne.tsx @@ -8,7 +8,7 @@ import { DataSectionClient } from '#components/section/data-section'; import { FullTable } from '#components/table/full'; import { EAdministration } from '#models/administrations/EAdministration'; import { IUniteLegale, isServicePublic } from '#models/core/types'; -import { IActesRNE } from '#models/immatriculation'; +import { IActesRNE } from '#models/rne/types'; import { ISession } from '#models/user/session'; import { formatDateLong } from '#utils/helpers'; import { useAPIRouteData } from 'hooks/fetch/use-API-route-data'; diff --git a/app/(header-default)/elus/_component/section/elus-section.tsx b/app/(header-default)/elus/_component/section/elus-section.tsx index 0c3267e6b..a00adc028 100644 --- a/app/(header-default)/elus/_component/section/elus-section.tsx +++ b/app/(header-default)/elus/_component/section/elus-section.tsx @@ -1,11 +1,11 @@ -import React from 'react'; import NonRenseigne from '#components/non-renseigne'; import { Section } from '#components/section'; import { FullTable } from '#components/table/full'; import { EAdministration } from '#models/administrations/EAdministration'; import { isCollectiviteTerritoriale, IUniteLegale } from '#models/core/types'; -import { IEtatCivil } from '#models/immatriculation'; +import { IEtatCivil } from '#models/rne/types'; import { capitalize, formatDatePartial } from '#utils/helpers'; +import React from 'react'; /** * Elus section diff --git a/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx index 4a4efff40..7acee1063 100644 --- a/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx @@ -8,26 +8,6 @@ import { IUniteLegale } from '#models/core/types'; import { ISession } from '#models/user/session'; import { formatDate } from '#utils/helpers'; -const formatCapitalSocial = ( - immatriculation: IUniteLegale['immatriculation'] -) => { - if (immatriculation?.capital) { - try { - return `${new Intl.NumberFormat('fr-FR', { - style: 'currency', - currency: immatriculation?.deviseCapital ?? 'EUR', - }).format(immatriculation?.capital)} ${ - immatriculation.estCapitalVariable ? 'variable' : 'fixe' - }`; - } catch { - return `${immatriculation?.capital} ${immatriculation?.deviseCapital} ${ - immatriculation.estCapitalVariable ? 'variable' : 'fixe' - }`; - } - } - return ''; -}; - const formatDateCloture = (DDMM: string) => { if (DDMM && DDMM.length === 4) { return `${DDMM.slice(0, 2)}/${DDMM.slice(2)}`; @@ -89,7 +69,7 @@ export const UniteLegaleImmatriculationSection = ({ dans certaines limites sans modification des statuts. </FAQLink>, - formatCapitalSocial(immatriculation), + immatriculation?.capital, ], [ 'Clôture de l’exercice comptable', diff --git a/app/api/data-fetching/routes-handlers.ts b/app/api/data-fetching/routes-handlers.ts index 4652b778c..267264467 100644 --- a/app/api/data-fetching/routes-handlers.ts +++ b/app/api/data-fetching/routes-handlers.ts @@ -7,11 +7,11 @@ import { getQualibat } from '#models/espace-agent/certificats/qualibat'; import { getQualifelec } from '#models/espace-agent/certificats/qualifelec'; import { getConformiteEntreprise } from '#models/espace-agent/conformite'; import { getMandatairesRCS } from '#models/espace-agent/mandataires-rcs'; -import { getDirigeantsRNE } from '#models/immatriculation/dirigeants'; +import { getDirigeantsRNE } from '#models/rne/dirigeants'; import { getDocumentsRNEProtected, getImmatriculationRNE, -} from '#models/immatriculation/rne'; +} from '#models/rne/immatriculation'; import { buildAndVerifyTVA } from '#models/tva/verify'; import { UnwrapPromise } from 'types'; diff --git a/clients/api-entreprise/mandataires-rcs/index.ts b/clients/api-entreprise/mandataires-rcs/index.ts index 7f06eab6c..708e6f355 100644 --- a/clients/api-entreprise/mandataires-rcs/index.ts +++ b/clients/api-entreprise/mandataires-rcs/index.ts @@ -1,9 +1,5 @@ import routes from '#clients/routes'; -import { - IDirigeants, - IEtatCivil, - IPersonneMorale, -} from '#models/immatriculation'; +import { IDirigeants, IEtatCivil, IPersonneMorale } from '#models/rne/types'; import { Siren } from '#utils/helpers'; import clientAPIEntreprise, { IAPIEntrepriseResponse } from '../client'; export type IAPIEntrepriseMandatairesRCS = IAPIEntrepriseResponse< diff --git a/clients/api-proxy/rne/documents.ts b/clients/api-proxy/rne/documents.ts index 0b75474bd..22d5b9c51 100644 --- a/clients/api-proxy/rne/documents.ts +++ b/clients/api-proxy/rne/documents.ts @@ -1,7 +1,7 @@ import routes from '#clients/routes'; import stubClientWithSnapshots from '#clients/stub-client-with-snaphots'; import constants from '#models/constants'; -import { IActesRNE } from '#models/immatriculation'; +import { IActesRNE } from '#models/rne/types'; import { Siren } from '#utils/helpers'; import { sensitiveRequestCallerInfos } from '#utils/network/utils/sensitive-request-caller-infos'; import { sensitiveRequestLogger } from '#utils/network/utils/sensitive-request-logger'; diff --git a/clients/api-proxy/rne/fallback.ts b/clients/api-proxy/rne/fallback.ts deleted file mode 100644 index bfdc5c7dc..000000000 --- a/clients/api-proxy/rne/fallback.ts +++ /dev/null @@ -1,25 +0,0 @@ -import routes from '#clients/routes'; -import stubClientWithSnapshots from '#clients/stub-client-with-snaphots'; -import constants from '#models/constants'; -import { IImmatriculationRNE } from '#models/immatriculation'; -import { Siren } from '#utils/helpers'; -import { clientAPIProxy } from '../client'; - -/** - * RNE through the API proxy - scrapping site as fallback - * @param siren - */ -const fetchRNEImmatriculationFallback = async (siren: Siren, useCache = true) => - clientAPIProxy<IImmatriculationRNE>( - routes.proxy.rne.immatriculation.fallback + siren, - { - timeout: constants.timeout.XXXL, - useCache, - } - ); - -const stubbedClient = stubClientWithSnapshots({ - fetchRNEImmatriculationFallback, -}); - -export { stubbedClient as fetchRNEImmatriculationFallback }; diff --git a/clients/api-proxy/rne/index.ts b/clients/api-proxy/rne/index.ts index c52b31431..e0a842662 100644 --- a/clients/api-proxy/rne/index.ts +++ b/clients/api-proxy/rne/index.ts @@ -1,25 +1,84 @@ import routes from '#clients/routes'; import stubClientWithSnapshots from '#clients/stub-client-with-snaphots'; import constants from '#models/constants'; -import { IImmatriculationRNE } from '#models/immatriculation'; +import { IObservations } from '#models/rne/types'; import { Siren } from '#utils/helpers'; import { clientAPIProxy } from '../client'; +type IRNEProxyResponse = { + identite: { + denomination: string; + natureEntreprise: string; + dateImmatriculation: string; + dateDebutActiv: string; + dateRadiation: string; + dateCessationActivite: string; + isPersonneMorale: boolean; + dateClotureExercice: string; + dureePersonneMorale: string; + capital: string; + libelleNatureJuridique: string; + }; + observations: IObservations[]; +}; + /** * RNE through the API proxy - API RNE * @param siren */ -const fetchRNEImmatriculation = async (siren: Siren, useCache = true) => - clientAPIProxy<IImmatriculationRNE>( +const fetchRNEImmatriculation = async (siren: Siren, useCache = true) => { + const response = await clientAPIProxy<IRNEProxyResponse>( routes.proxy.rne.immatriculation.default + siren, { timeout: constants.timeout.XXXL, useCache, } ); + return mapToDomainObject(response); +}; + +/** + * RNE through the API proxy - scrapping site as fallback + * @param siren + */ +const fetchRNEImmatriculationFallback = async ( + siren: Siren, + useCache = true +) => { + const response = await clientAPIProxy<IRNEProxyResponse>( + routes.proxy.rne.immatriculation.fallback + siren, + { + timeout: constants.timeout.XXXL, + useCache, + } + ); + return mapToDomainObject(response); +}; + +const mapToDomainObject = ({ observations, identite }: IRNEProxyResponse) => { + return { + observations, + immatriculation: { + natureEntreprise: (identite.natureEntreprise || '').split(', '), + dateImmatriculation: identite.dateImmatriculation, + dateDebutActivite: identite.dateDebutActiv, + dateRadiation: identite.dateRadiation, + isPersonneMorale: identite.isPersonneMorale, + dateCloture: identite.dateClotureExercice, + duree: identite.dureePersonneMorale, + capital: identite.capital, + }, + }; +}; const stubbedClient = stubClientWithSnapshots({ fetchRNEImmatriculation, }); +const stubbedClientFallback = stubClientWithSnapshots({ + fetchRNEImmatriculationFallback, +}); -export { stubbedClient as fetchRNEImmatriculation }; +export { + stubbedClient as fetchRNEImmatriculation, + stubbedClientFallback as fetchRNEImmatriculationFallback, +}; diff --git a/clients/recherche-entreprise/dirigeants.ts b/clients/recherche-entreprise/dirigeants.ts new file mode 100644 index 000000000..d16adc0c6 --- /dev/null +++ b/clients/recherche-entreprise/dirigeants.ts @@ -0,0 +1,23 @@ +import { IDirigeants } from '#models/rne/types'; +import { Siren } from '#utils/helpers'; +import clientSearchRechercheEntreprise from '.'; + +export const clientDirigeantsRechercheEntreprise = async ( + siren: Siren +): Promise<IDirigeants['data']> => { + const { results } = await clientSearchRechercheEntreprise({ + searchTerms: siren, + pageResultatsRecherche: 1, + inclureEtablissements: false, + inclureImmatriculation: false, + pageEtablissements: 1, + useCache: true, + fallbackOnStaging: false, + }); + + if (!results.length || !results[0]) { + return []; + } + + return results[0].dirigeants || []; +}; diff --git a/clients/recherche-entreprise/index.ts b/clients/recherche-entreprise/index.ts index 5284ea94b..cc8b3c022 100644 --- a/clients/recherche-entreprise/index.ts +++ b/clients/recherche-entreprise/index.ts @@ -5,23 +5,12 @@ import constants from '#models/constants'; import { createEtablissementsList } from '#models/core/etablissements-list'; import { IETATADMINSTRATIF, estActif } from '#models/core/etat-administratif'; import { - IEtablissement, NotEnoughParamsException, - createDefaultEtablissement, createDefaultUniteLegale, } from '#models/core/types'; -import { IEtatCivil, IPersonneMorale } from '#models/immatriculation'; import { ISearchResults } from '#models/search'; import SearchFilterParams from '#models/search-filter-params'; -import { - Siret, - extractNicFromSiret, - extractSirenFromSiret, - formatFirstNames, - parseIntWithDefaultValue, - verifySiren, - verifySiret, -} from '#utils/helpers'; +import { parseIntWithDefaultValue, verifySiren } from '#utils/helpers'; import { libelleFromCategoriesJuridiques, libelleFromCodeNAFWithoutNomenclature, @@ -32,13 +21,14 @@ import { statuDiffusionFromStatutDiffusionInsee, } from '#utils/helpers/insee-variables'; import { httpGet } from '#utils/network'; +import { IResult, ISearchResponse } from './interface'; import { - IDirigeant, - IMatchingEtablissement, - IResult, - ISearchResponse, - ISiege, -} from './interface'; + mapToDirigeantModel, + mapToElusModel, + mapToEtablissement, + mapToImmatriculation, + mapToSiege, +} from './mapToDomain'; type ClientSearchRechercheEntreprise = { searchTerms: string; @@ -175,18 +165,6 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { type_siae = '', } = complements || {}; - const { - date_debut_activite = '', - date_immatriculation = '', - date_radiation = '', - duree_personne_morale, - nature_entreprise = [], - date_cloture_exercice = '', - capital_social, - capital_variable = false, - devise_capital = '', - } = immatriculation || {}; - const nomComplet = (result.nom_complet || 'Nom inconnu').toUpperCase(); const siren = verifySiren(result.siren); @@ -273,18 +251,7 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { estEntrepriseInclusive: est_siae, typeEntrepriseInclusive: type_siae, }, - immatriculation: { - dateDebutActivite: date_debut_activite ?? '', - dateImmatriculation: date_immatriculation ?? '', - dateRadiation: date_radiation ?? '', - duree: duree_personne_morale ?? 0, - natureEntreprise: nature_entreprise || [], - dateCloture: date_cloture_exercice ?? '', - isPersonneMorale: !!capital_social, - capital: capital_social ?? 0, - estCapitalVariable: capital_variable ?? false, - deviseCapital: devise_capital ?? '', - }, + immatriculation: mapToImmatriculation(immatriculation), association: { idAssociation: identifiant_association, data: null, @@ -299,150 +266,6 @@ const mapToUniteLegale = (result: IResult, pageEtablissements: number) => { }; }; -const mapToSiege = ( - siege: IResult['siege'], - est_entrepreneur_individuel: boolean -) => { - if (!siege || Object.keys(siege).length === 0 || !siege.siret) { - return { - ...createDefaultEtablissement(), - siret: '' as Siret, - }; - } - return mapToEtablissement(siege, est_entrepreneur_individuel); -}; - -const mapToDirigeantModel = ( - dirigeant: IDirigeant -): IEtatCivil | IPersonneMorale => { - const { - siren = '', - sigle = '', - denomination = '', - prenoms = '', - nom = '', - qualite = '', - } = dirigeant; - - if (!!siren) { - return { - siren, - denomination: `${denomination}${sigle ? ` (${sigle})` : ''}`, - role: qualite, - } as IPersonneMorale; - } - - return { - sexe: null, - nom: (nom || '').toUpperCase(), - prenom: formatFirstNames((prenoms || '').split(' '), 1), - role: qualite, - dateNaissancePartial: '', - lieuNaissance: '', - }; -}; - -const mapToElusModel = (eluRaw: any): IEtatCivil => { - const { nom, prenoms, annee_de_naissance, fonction, sexe } = eluRaw; - - return { - sexe, - nom: (nom || '').toUpperCase(), - prenom: formatFirstNames((prenoms || '').split(' '), 1), - role: fonction, - dateNaissancePartial: annee_de_naissance, - lieuNaissance: '', - }; -}; - -const mapToEtablissement = ( - etablissement: ISiege | IMatchingEtablissement, - estEntrepreneurIndividuel: boolean -): IEtablissement => { - const { - siret, - latitude = '0', - longitude = '0', - code_postal = '', - libelle_commune = '', - adresse, - liste_enseignes, - etat_administratif, - est_siege = false, - ancien_siege = false, - nom_commercial = '', - activite_principale = '', - date_creation = '', - date_debut_activite = '', - date_fermeture = '', - tranche_effectif_salarie = '', - caractere_employeur = '', - annee_tranche_effectif_salarie = '', - liste_finess = [], - liste_id_bio = [], - liste_idcc = [], - liste_id_organisme_formation = [], - liste_rge = [], - liste_uai = [], - statut_diffusion_etablissement, - } = etablissement; - - const enseigne = (liste_enseignes || []).join(' '); - - const adressePostale = adresse - ? `${ - enseigne ? `${enseigne}, ` : nom_commercial ? `${nom_commercial}, ` : '' - }${adresse}` - : ''; - - const etatAdministratif = etatFromEtatAdministratifInsee( - etat_administratif, - siret - ); - - return { - ...createDefaultEtablissement(), - siren: extractSirenFromSiret(siret), - enseigne, - nic: extractNicFromSiret(siret), - siret: verifySiret(siret), - adresse, - codePostal: code_postal, - commune: libelle_commune, - adressePostale, - trancheEffectif: - caractere_employeur === 'N' - ? caractere_employeur - : tranche_effectif_salarie, - anneeTrancheEffectif: annee_tranche_effectif_salarie, - latitude, - longitude, - estSiege: est_siege, - ancienSiege: ancien_siege, - etatAdministratif, - statutDiffusion: statuDiffusionFromStatutDiffusionInsee( - statut_diffusion_etablissement || 'O', - siret - ), - denomination: nom_commercial, - libelleActivitePrincipale: - libelleFromCodeNAFWithoutNomenclature(activite_principale), - activitePrincipale: activite_principale, - dateCreation: parseDateCreationInsee(date_creation), - dateDebutActivite: date_debut_activite ?? '', - dateFermeture: date_fermeture ?? '', - complements: { - estEntrepreneurIndividuel, - idFiness: liste_finess || [], - idBio: liste_id_bio || [], - idcc: liste_idcc || [], - idOrganismeFormation: liste_id_organisme_formation || [], - idRge: liste_rge || [], - idUai: liste_uai || [], - }, - }; -}; - export default stubClientWithSnapshots({ clientSearchRechercheEntreprise, }); diff --git a/clients/recherche-entreprise/interface.ts b/clients/recherche-entreprise/interface.ts index 849a41cca..3ec9d0f40 100644 --- a/clients/recherche-entreprise/interface.ts +++ b/clients/recherche-entreprise/interface.ts @@ -31,7 +31,7 @@ export type IResult = { matching_etablissements: IMatchingEtablissement[]; etablissements?: IMatchingEtablissement[]; complements: IComplements; - immatriculation: IImmatriculation; + immatriculation: IImmatriculationResponse; caractere_employeur: string; slug: string; }; @@ -40,6 +40,8 @@ export type IDirigeant = { nom: string; prenoms: string; annee_de_naissance: string; + date_de_naissance: string; + nationalite: string; qualite: string; type_dirigeant: string; siren: string; @@ -122,7 +124,7 @@ export type IComplements = { liste_idcc: string[]; }; -export type IImmatriculation = { +export type IImmatriculationResponse = { date_debut_activite: string | null; date_immatriculation: string | null; date_radiation: string | null; diff --git a/clients/recherche-entreprise/mapToDomain/index.ts b/clients/recherche-entreprise/mapToDomain/index.ts new file mode 100644 index 000000000..6479b3b3d --- /dev/null +++ b/clients/recherche-entreprise/mapToDomain/index.ts @@ -0,0 +1,203 @@ +import { IEtablissement, createDefaultEtablissement } from '#models/core/types'; +import { IEtatCivil, IPersonneMorale } from '#models/rne/types'; +import { + Siret, + extractNicFromSiret, + extractSirenFromSiret, + formatFirstNames, + verifySiret, +} from '#utils/helpers'; +import { libelleFromCodeNAFWithoutNomenclature } from '#utils/helpers/formatting/labels'; +import { + etatFromEtatAdministratifInsee, + parseDateCreationInsee, + statuDiffusionFromStatutDiffusionInsee, +} from '#utils/helpers/insee-variables'; +import { + IDirigeant, + IMatchingEtablissement, + IResult, + ISiege, +} from '../interface'; + +const formatCapital = ( + capital: number, + devise: string, + estVariable: boolean +) => { + if (capital) { + try { + return `${new Intl.NumberFormat('fr-FR', { + style: 'currency', + currency: devise ?? 'EUR', + }).format(capital)} ${estVariable ? 'variable' : 'fixe'}`; + } catch { + return `${capital} ${devise} ${estVariable ? 'variable' : 'fixe'}`; + } + } + return ''; +}; + +export const mapToImmatriculation = (i: IResult['immatriculation']) => { + return { + dateDebutActivite: i.date_debut_activite ?? '', + dateImmatriculation: i.date_immatriculation ?? '', + dateRadiation: i.date_radiation ?? '', + duree: i.duree_personne_morale ?? 0, + natureEntreprise: i.nature_entreprise || [], + dateCloture: i.date_cloture_exercice ?? '', + isPersonneMorale: !!i.capital_social, + capital: formatCapital( + i.capital_social ?? 0, + i.devise_capital ?? '', + i.capital_variable ?? false + ), + }; +}; + +export const mapToSiege = ( + siege: IResult['siege'], + est_entrepreneur_individuel: boolean +) => { + if (!siege || Object.keys(siege).length === 0 || !siege.siret) { + return { + ...createDefaultEtablissement(), + siret: '' as Siret, + }; + } + return mapToEtablissement(siege, est_entrepreneur_individuel); +}; + +export const mapToDirigeantModel = ( + dirigeant: IDirigeant +): IEtatCivil | IPersonneMorale => { + const { + siren = '', + sigle = '', + denomination = '', + prenoms = '', + nom = '', + qualite = '', + date_de_naissance = '', + nationalite = '', + } = dirigeant; + + if (!!siren) { + return { + siren, + denomination: `${denomination}${sigle ? ` (${sigle})` : ''}`, + role: qualite, + } as IPersonneMorale; + } + + return { + sexe: null, + nom: (nom || '').toUpperCase(), + prenom: formatFirstNames((prenoms || '').split(' '), 1), + role: qualite, + nationalite, + dateNaissancePartial: date_de_naissance, + lieuNaissance: '', + }; +}; + +export const mapToElusModel = (eluRaw: any): IEtatCivil => { + const { nom, prenoms, annee_de_naissance, fonction, sexe } = eluRaw; + + return { + sexe, + nom: (nom || '').toUpperCase(), + prenom: formatFirstNames((prenoms || '').split(' '), 1), + role: fonction, + dateNaissancePartial: annee_de_naissance, + lieuNaissance: '', + }; +}; + +export const mapToEtablissement = ( + etablissement: ISiege | IMatchingEtablissement, + estEntrepreneurIndividuel: boolean +): IEtablissement => { + const { + siret, + latitude = '0', + longitude = '0', + code_postal = '', + libelle_commune = '', + adresse, + liste_enseignes, + etat_administratif, + est_siege = false, + ancien_siege = false, + nom_commercial = '', + activite_principale = '', + date_creation = '', + date_debut_activite = '', + date_fermeture = '', + tranche_effectif_salarie = '', + caractere_employeur = '', + annee_tranche_effectif_salarie = '', + liste_finess = [], + liste_id_bio = [], + liste_idcc = [], + liste_id_organisme_formation = [], + liste_rge = [], + liste_uai = [], + statut_diffusion_etablissement, + } = etablissement; + + const enseigne = (liste_enseignes || []).join(' '); + + const adressePostale = adresse + ? `${ + enseigne ? `${enseigne}, ` : nom_commercial ? `${nom_commercial}, ` : '' + }${adresse}` + : ''; + + const etatAdministratif = etatFromEtatAdministratifInsee( + etat_administratif, + siret + ); + + return { + ...createDefaultEtablissement(), + siren: extractSirenFromSiret(siret), + enseigne, + nic: extractNicFromSiret(siret), + siret: verifySiret(siret), + adresse, + codePostal: code_postal, + commune: libelle_commune, + adressePostale, + trancheEffectif: + caractere_employeur === 'N' + ? caractere_employeur + : tranche_effectif_salarie, + anneeTrancheEffectif: annee_tranche_effectif_salarie, + latitude, + longitude, + estSiege: est_siege, + ancienSiege: ancien_siege, + etatAdministratif, + statutDiffusion: statuDiffusionFromStatutDiffusionInsee( + statut_diffusion_etablissement || 'O', + siret + ), + denomination: nom_commercial, + libelleActivitePrincipale: + libelleFromCodeNAFWithoutNomenclature(activite_principale), + activitePrincipale: activite_principale, + dateCreation: parseDateCreationInsee(date_creation), + dateDebutActivite: date_debut_activite ?? '', + dateFermeture: date_fermeture ?? '', + complements: { + estEntrepreneurIndividuel, + idFiness: liste_finess || [], + idBio: liste_id_bio || [], + idcc: liste_idcc || [], + idOrganismeFormation: liste_id_organisme_formation || [], + idRge: liste_rge || [], + idUai: liste_uai || [], + }, + }; +}; diff --git a/components/search-results/results-list.tsx b/components/search-results/results-list.tsx index b25536799..6f9c02f0f 100644 --- a/components/search-results/results-list.tsx +++ b/components/search-results/results-list.tsx @@ -1,12 +1,12 @@ -import React from 'react'; import { Icon } from '#components-ui/icon/wrapper'; import IsActiveTag from '#components-ui/is-active-tag'; import UniteLegaleBadge from '#components/unite-legale-badge'; import { estActif } from '#models/core/etat-administratif'; import { isCollectiviteTerritoriale } from '#models/core/types'; -import { IDirigeants } from '#models/immatriculation'; +import { IDirigeants } from '#models/rne/types'; import { ISearchResult } from '#models/search'; import { isPersonneMorale } from 'app/(header-default)/dirigeants/[slug]/_component/sections/is-personne-morale'; +import React from 'react'; import styles from './style.module.css'; type IProps = { diff --git a/models/core/types.ts b/models/core/types.ts index 89193d516..a73ec331d 100644 --- a/models/core/types.ts +++ b/models/core/types.ts @@ -1,10 +1,11 @@ /** COMMON TYPES */ +import { IAPINotRespondingError } from '#models/api-not-responding'; import { createEtablissementsList, IEtablissementsList, } from '#models/core/etablissements-list'; import { IETATADMINSTRATIF } from '#models/core/etat-administratif'; -import { IEtatCivil } from '#models/immatriculation'; +import { IEtatCivil } from '#models/rne/types'; import { IdRna, Siren, Siret } from '#utils/helpers'; import { EAdministration } from '../administrations/EAdministration'; import { @@ -109,7 +110,7 @@ export interface IUniteLegale extends IEtablissementsList { categorieEntreprise: string | null; anneeCategorieEntreprise: string | null; complements: IUniteLegaleComplements; - immatriculation: IUniteLegaleImmatriculation | null; + immatriculation: IUniteLegaleImmatriculation | IAPINotRespondingError | null; association: { idAssociation: IdRna | string | null; }; @@ -163,13 +164,11 @@ export interface IUniteLegaleImmatriculation { dateDebutActivite: string; dateImmatriculation: string; dateRadiation: string; - duree: number; + duree: number | string; natureEntreprise: string[]; dateCloture: string; isPersonneMorale: boolean; - capital: number; - estCapitalVariable: boolean; - deviseCapital: string; + capital: string; } export interface IUniteLegaleComplements { diff --git a/models/core/unite-legale.ts b/models/core/unite-legale.ts index eacba7acc..9e85705f0 100644 --- a/models/core/unite-legale.ts +++ b/models/core/unite-legale.ts @@ -8,6 +8,7 @@ import { InseeClientOptions } from '#clients/sirene-insee'; import { clientUniteLegaleInsee } from '#clients/sirene-insee/siren'; import { createEtablissementsList } from '#models/core/etablissements-list'; import { IETATADMINSTRATIF, estActif } from '#models/core/etat-administratif'; +import { getImmatriculation } from '#models/rne/immatriculation'; import { Siren, verifySiren } from '#utils/helpers'; import { isProtectedSiren } from '#utils/helpers/is-protected-siren-or-siret'; import { logFatalErrorInSentry, logWarningInSentry } from '#utils/sentry'; @@ -31,6 +32,8 @@ import { IUniteLegale, SirenNotFoundError, createDefaultUniteLegale, + isAssociation, + isServicePublic, } from './types'; /** @@ -96,6 +99,14 @@ class UniteLegaleBuilder { IETATADMINSTRATIF.ACTIF_ZERO_ETABLISSEMENT; } + // for some reason we didnot get immatriculation from Recherche Entreprise + if (isAPI404(uniteLegale.immatriculation)) { + if (!isServicePublic(uniteLegale) && !isAssociation(uniteLegale)) { + const immatriculation = await getImmatriculation(this._siren); + uniteLegale.immatriculation = immatriculation; + } + } + return uniteLegale; }; diff --git a/models/espace-agent/mandataires-rcs.ts b/models/espace-agent/mandataires-rcs.ts index 54331e013..662ab5c5f 100644 --- a/models/espace-agent/mandataires-rcs.ts +++ b/models/espace-agent/mandataires-rcs.ts @@ -4,7 +4,7 @@ import { APINotRespondingFactory, IAPINotRespondingError, } from '#models/api-not-responding'; -import { IDirigeants } from '#models/immatriculation'; +import { IDirigeants } from '#models/rne/types'; import { verifySiren } from '#utils/helpers'; import { handleApiEntrepriseError } from './utils'; diff --git a/models/espace-agent/rne-protected/documents.ts b/models/espace-agent/rne-protected/documents.ts new file mode 100644 index 000000000..82a0fa9b6 --- /dev/null +++ b/models/espace-agent/rne-protected/documents.ts @@ -0,0 +1,23 @@ +import { clientDocuments } from '#clients/api-proxy/rne/documents'; +import { HttpNotFound } from '#clients/exceptions'; +import { EAdministration } from '#models/administrations/EAdministration'; +import { APINotRespondingFactory } from '#models/api-not-responding'; +import { verifySiren } from '#utils/helpers'; + +export async function getDocumentsRNEProtected(maybeSiren: string) { + const siren = verifySiren(maybeSiren); + + try { + const actes = await clientDocuments(siren); + actes.hasBilanConsolide = + actes.bilans.filter((b) => b.typeBilan === 'K').length > 0; + return actes; + } catch (e: any) { + if (e instanceof HttpNotFound) { + return APINotRespondingFactory(EAdministration.INPI, 404); + } + + // no need to log an error as API-Proxy already logged it + return APINotRespondingFactory(EAdministration.INPI, 500); + } +} diff --git a/models/immatriculation/rne.ts b/models/immatriculation/rne.ts deleted file mode 100644 index e3869c941..000000000 --- a/models/immatriculation/rne.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { fetchRNEImmatriculation } from '#clients/api-proxy/rne'; -import { clientDocuments } from '#clients/api-proxy/rne/documents'; -import { fetchRNEImmatriculationFallback } from '#clients/api-proxy/rne/fallback'; -import { HttpNotFound } from '#clients/exceptions'; -import routes from '#clients/routes'; -import { EAdministration } from '#models/administrations/EAdministration'; -import { - APINotRespondingFactory, - IAPINotRespondingError, -} from '#models/api-not-responding'; -import { verifySiren } from '#utils/helpers'; -import { IImmatriculationRNE } from '.'; - -/* - * Request Immatriculation from INPI's RNE - * @param siren - */ -export const getImmatriculationRNE = async ( - maybeSiren: string -): Promise<IAPINotRespondingError | IImmatriculationRNE> => { - const siren = verifySiren(maybeSiren); - - const sirenAndLinks = { - siren, - downloadLink: `${routes.rne.portail.pdf}?format=pdf&ids=[%22${siren}%22]`, - siteLink: `${routes.rne.portail.entreprise}${siren}`, - }; - - try { - return { - ...(await fetchRNEImmatriculation(siren)), - ...sirenAndLinks, - }; - } catch (eDefaultTry: any) { - if (eDefaultTry instanceof HttpNotFound) { - return APINotRespondingFactory(EAdministration.INPI, 404); - } - - try { - return { - ...(await fetchRNEImmatriculationFallback(siren)), - ...sirenAndLinks, - }; - } catch (eFallback: any) { - if (eFallback instanceof HttpNotFound) { - return APINotRespondingFactory(EAdministration.INPI, 404); - } - - // no need to log an error as API-Proxy already logged it - return APINotRespondingFactory(EAdministration.INPI, 500); - } - } -}; - -export async function getDocumentsRNEProtected(maybeSiren: string) { - const siren = verifySiren(maybeSiren); - - try { - const actes = await clientDocuments(siren); - actes.hasBilanConsolide = - actes.bilans.filter((b) => b.typeBilan === 'K').length > 0; - return actes; - } catch (e: any) { - if (e instanceof HttpNotFound) { - return APINotRespondingFactory(EAdministration.INPI, 404); - } - - // no need to log an error as API-Proxy already logged it - return APINotRespondingFactory(EAdministration.INPI, 500); - } -} diff --git a/models/immatriculation/dirigeants.tsx b/models/rne/dirigeants.tsx similarity index 65% rename from models/immatriculation/dirigeants.tsx rename to models/rne/dirigeants.tsx index 79cc590c5..a8ffdd328 100644 --- a/models/immatriculation/dirigeants.tsx +++ b/models/rne/dirigeants.tsx @@ -1,15 +1,16 @@ import { fetchRNEImmatriculation } from '#clients/api-proxy/rne'; import { HttpNotFound } from '#clients/exceptions'; +import { clientDirigeantsRechercheEntreprise } from '#clients/recherche-entreprise/dirigeants'; import { EAdministration } from '#models/administrations/EAdministration'; import { APINotRespondingFactory, IAPINotRespondingError, } from '#models/api-not-responding'; import { verifySiren } from '#utils/helpers'; -import { IDirigeants } from '.'; +import { IDirigeants } from './types'; /* - * Request Immatriculation from INPI's RNE + * Request dirigeants from INPI's RNE * @param siren */ export const getDirigeantsRNE = async ( @@ -19,13 +20,21 @@ export const getDirigeantsRNE = async ( try { const { dirigeants } = await fetchRNEImmatriculation(siren); - return { data: dirigeants, metadata: { isFallback: false } }; } catch (e: any) { if (e instanceof HttpNotFound) { return APINotRespondingFactory(EAdministration.INPI, 404); } + try { + const dirigeants = await clientDirigeantsRechercheEntreprise(siren); + return { data: dirigeants, metadata: { isFallback: true } }; + } catch { + if (e instanceof HttpNotFound) { + return APINotRespondingFactory(EAdministration.INPI, 404); + } + } + return APINotRespondingFactory(EAdministration.INPI, 500); } }; diff --git a/models/rne/immatriculation.ts b/models/rne/immatriculation.ts new file mode 100644 index 000000000..4b2f9485f --- /dev/null +++ b/models/rne/immatriculation.ts @@ -0,0 +1,43 @@ +import { + fetchRNEImmatriculation, + fetchRNEImmatriculationFallback, +} from '#clients/api-proxy/rne'; +import { HttpNotFound } from '#clients/exceptions'; +import { EAdministration } from '#models/administrations/EAdministration'; +import { + APINotRespondingFactory, + IAPINotRespondingError, +} from '#models/api-not-responding'; +import { IUniteLegaleImmatriculation } from '#models/core/types'; +import { verifySiren } from '#utils/helpers'; + +/* + * Request Immatriculation from INPI's RNE + * @param siren + */ +export const getImmatriculation = async ( + maybeSiren: string +): Promise<IAPINotRespondingError | IUniteLegaleImmatriculation> => { + const siren = verifySiren(maybeSiren); + + try { + const { immatriculation } = await fetchRNEImmatriculation(siren); + return immatriculation; + } catch (eDefaultTry: any) { + if (eDefaultTry instanceof HttpNotFound) { + return APINotRespondingFactory(EAdministration.INPI, 404); + } + + try { + const { immatriculation } = await fetchRNEImmatriculationFallback(siren); + return immatriculation; + } catch (eFallback: any) { + if (eFallback instanceof HttpNotFound) { + return APINotRespondingFactory(EAdministration.INPI, 404); + } + + // no need to log an error as API-Proxy already logged it + return APINotRespondingFactory(EAdministration.INPI, 500); + } + } +}; diff --git a/models/rne/observations.ts b/models/rne/observations.ts new file mode 100644 index 000000000..b1de2cbb9 --- /dev/null +++ b/models/rne/observations.ts @@ -0,0 +1,39 @@ +import { fetchRNEImmatriculation } from '#clients/api-proxy/rne'; +import { fetchRNEImmatriculationFallback } from '#clients/api-proxy/rne/fallback'; +import { HttpNotFound } from '#clients/exceptions'; +import { EAdministration } from '#models/administrations/EAdministration'; +import { + APINotRespondingFactory, + IAPINotRespondingError, +} from '#models/api-not-responding'; +import { verifySiren } from '#utils/helpers'; +import { IObservations } from './types'; + +/* + * Request observations from INPI's RNE + * @param siren + */ +export const getObservations = async ( + maybeSiren: string +): Promise<IAPINotRespondingError | IObservations> => { + const siren = verifySiren(maybeSiren); + + try { + return await fetchRNEImmatriculation(siren); + } catch (eDefaultTry: any) { + if (eDefaultTry instanceof HttpNotFound) { + return APINotRespondingFactory(EAdministration.INPI, 404); + } + + try { + return await fetchRNEImmatriculationFallback(siren); + } catch (eFallback: any) { + if (eFallback instanceof HttpNotFound) { + return APINotRespondingFactory(EAdministration.INPI, 404); + } + + // no need to log an error as API-Proxy already logged it + return APINotRespondingFactory(EAdministration.INPI, 500); + } + } +}; diff --git a/models/immatriculation/index.ts b/models/rne/types.ts similarity index 56% rename from models/immatriculation/index.ts rename to models/rne/types.ts index ae848a8f0..95326de26 100644 --- a/models/immatriculation/index.ts +++ b/models/rne/types.ts @@ -1,5 +1,3 @@ -import { Siren } from '#utils/helpers'; - interface IActeRNE { id: string; dateDepot: string; @@ -27,28 +25,7 @@ export interface IEtatCivil { lieuNaissance: string; dateNaissancePartial?: string; dateNaissance?: string; -} - -export interface IBeneficiaire { - type: string; - nom: string; - prenoms: string; - dateNaissancePartial: string; - nationalite: string; - dateGreffe: string; -} -export interface IIdentite { - denomination: string; - dateImmatriculation: string; - dateDebutActiv: string; - dateRadiation: string; - dateCessationActivite: string; - isPersonneMorale: boolean; - dateClotureExercice: string; - dureePersonneMorale: string; - capital: string; - libelleNatureJuridique: string; - natureEntreprise?: string; + nationalite?: string; } export interface IPersonneMorale { @@ -58,11 +35,7 @@ export interface IPersonneMorale { role: string; } -export interface IImmatriculationRNE { - siren: Siren; - identite: IIdentite; - beneficiaires: IBeneficiaire[]; - dirigeants: (IEtatCivil | IPersonneMorale)[]; +export interface IObservations { observations: { numObservation: string; dateAjout: string; diff --git a/models/search-filter-params.ts b/models/search-filter-params.ts index 724a95992..6ca7a34b8 100644 --- a/models/search-filter-params.ts +++ b/models/search-filter-params.ts @@ -1,5 +1,5 @@ import { IIconsSlug } from '#components-ui/icon'; -import { IEtatCivil } from '#models/immatriculation'; +import { IEtatCivil } from '#models/rne/types'; export interface IParams { ageMax?: number | string; diff --git a/models/search.ts b/models/search.ts index 18c79d2f2..55351fafe 100644 --- a/models/search.ts +++ b/models/search.ts @@ -11,7 +11,7 @@ import { IsLikelyASirenOrSiretException, NotEnoughParamsException, } from './core/types'; -import { IDirigeants } from './immatriculation'; +import { IDirigeants } from './rne/types'; export interface ISearchResult extends IUniteLegale { nombreEtablissements: number; diff --git a/pages/personne/index.tsx b/pages/personne/index.tsx index 2857b0389..7e806ec05 100644 --- a/pages/personne/index.tsx +++ b/pages/personne/index.tsx @@ -1,4 +1,3 @@ -import { GetServerSideProps } from 'next'; import { Info } from '#components-ui/alerts'; import { HorizontalSeparator } from '#components-ui/horizontal-separator'; import Meta from '#components/meta/meta-client'; @@ -6,7 +5,7 @@ import ResultsList from '#components/search-results/results-list'; import PageCounter from '#components/search-results/results-pagination'; import StructuredDataSearchAction from '#components/structured-data/search'; import { Exception } from '#models/exceptions'; -import { IEtatCivil } from '#models/immatriculation'; +import { IEtatCivil } from '#models/rne/types'; import { ISearchResults, searchWithoutProtectedSiren } from '#models/search'; import SearchFilterParams, { IParams } from '#models/search-filter-params'; import { @@ -19,6 +18,7 @@ import { IPropsWithMetadata, postServerSideProps, } from '#utils/server-side-helper/page/post-server-side-props'; +import { GetServerSideProps } from 'next'; import { NextPageWithLayout } from 'pages/_app'; interface IProps extends IPropsWithMetadata { From c84f1a89cfe3831060ff0c749ae29f72eea77809 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Thu, 29 Aug 2024 11:33:46 +0200 Subject: [PATCH 07/16] feat: finalize dirigeant fallback and update changelog --- .../sections/entreprise/summary.tsx | 7 +-- .../_components/immatriculation-section.tsx | 6 ++- app/api/data-fetching/routes-handlers.ts | 8 ++-- .../searchFilter.test.ts | 2 +- .../simpleSearch.test.ts | 2 +- .../simplify-params.ts | 4 +- clients/api-proxy/rne/index.ts | 17 +++++-- clients/recherche-entreprise/dirigeants.ts | 2 +- .../recherche-entreprise/mapToDomain/index.ts | 46 +++++++----------- data/changelog.yml | 9 ++++ .../registre-des-beneficiaires-effectifs.yml | 2 +- models/api-not-responding.ts | 6 +-- models/core/types.ts | 1 + models/core/unite-legale.ts | 4 +- models/rne/dirigeants.tsx | 4 +- models/rne/immatriculation.ts | 2 +- utils/helpers/rne-variables/index.ts | 47 +++++++++++++++++++ .../rne-variables/rne-variables.test.ts | 21 +++++++++ 18 files changed, 131 insertions(+), 59 deletions(-) create mode 100644 utils/helpers/rne-variables/index.ts create mode 100644 utils/helpers/rne-variables/rne-variables.test.ts diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/summary.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/summary.tsx index c7e6fa24c..d800c58e8 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/summary.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/summary.tsx @@ -1,5 +1,4 @@ import { HttpNotFound } from '#clients/exceptions'; -import { Icon } from '#components-ui/icon/wrapper'; import { Loader } from '#components-ui/loader'; import { INPI, INSEE, MI } from '#components/administrations'; import { isAPINotResponding } from '#models/api-not-responding'; @@ -69,13 +68,9 @@ const DirigeantSummary: React.FC<IDirigeantSummaryProps> = ({ </a> ); - const beneficiairesCount = 0; summaries.push( <a href="#beneficiaires"> - <Icon slug="alertFill" color="#ff9c00"> - {beneficiairesCount} bénéficiaires inscrits à Référentiel des - Bénéficiaires Effectifs - </Icon> + État inconnu au Registre des Bénéficiaires Effectifs (RBE) </a> ); } diff --git a/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx index 7acee1063..9bb39f817 100644 --- a/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx @@ -81,7 +81,11 @@ export const UniteLegaleImmatriculationSection = ({ ? [ [ 'Durée de la personne morale', - `${immatriculation?.duree} ans`, + `${immatriculation?.duree} ans${ + immatriculation?.dateFin + ? `, jusqu’au ${immatriculation?.dateFin}` + : '' + }`, ], ] : []), diff --git a/app/api/data-fetching/routes-handlers.ts b/app/api/data-fetching/routes-handlers.ts index 267264467..198c26036 100644 --- a/app/api/data-fetching/routes-handlers.ts +++ b/app/api/data-fetching/routes-handlers.ts @@ -7,11 +7,9 @@ import { getQualibat } from '#models/espace-agent/certificats/qualibat'; import { getQualifelec } from '#models/espace-agent/certificats/qualifelec'; import { getConformiteEntreprise } from '#models/espace-agent/conformite'; import { getMandatairesRCS } from '#models/espace-agent/mandataires-rcs'; +import { getDocumentsRNEProtected } from '#models/espace-agent/rne-protected/documents'; import { getDirigeantsRNE } from '#models/rne/dirigeants'; -import { - getDocumentsRNEProtected, - getImmatriculationRNE, -} from '#models/rne/immatriculation'; +import { getRNEImmatriculation } from '#models/rne/immatriculation'; import { buildAndVerifyTVA } from '#models/tva/verify'; import { UnwrapPromise } from 'types'; @@ -25,7 +23,7 @@ export const APIRoutesHandlers = { 'espace-agent/rne/documents': getDocumentsRNEProtected, 'espace-agent/association-protected': getAssociationProtected, 'rne-dirigeants': getDirigeantsRNE, - rne: getImmatriculationRNE, + rne: getRNEImmatriculation, association: getAssociationFromSlug, 'verify-tva': buildAndVerifyTVA, 'eori-validation': getEORIValidation, diff --git a/clients/_test/clientSearchRechercheEntreprise/searchFilter.test.ts b/clients/_test/clientSearchRechercheEntreprise/searchFilter.test.ts index a60574bd5..4710292d2 100644 --- a/clients/_test/clientSearchRechercheEntreprise/searchFilter.test.ts +++ b/clients/_test/clientSearchRechercheEntreprise/searchFilter.test.ts @@ -6,7 +6,7 @@ import simplifyParams from './simplify-params'; const defaultParams = { searchTerms: '', - page: 1, + pageResultatsRecherche: 1, searchFilterParams: new SearchFilterParams({}), }; diff --git a/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts b/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts index f6eb4ad9e..662139c66 100644 --- a/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts +++ b/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts @@ -40,7 +40,7 @@ function itShouldMatchSnapshotForSearch( __dirname, args: [ { - page: 1, + pageResultatsRecherche: 1, searchFilterParams: new SearchFilterParams({}), searchTerms, }, diff --git a/clients/_test/clientSearchRechercheEntreprise/simplify-params.ts b/clients/_test/clientSearchRechercheEntreprise/simplify-params.ts index 71834c38b..4c1a4a7c8 100644 --- a/clients/_test/clientSearchRechercheEntreprise/simplify-params.ts +++ b/clients/_test/clientSearchRechercheEntreprise/simplify-params.ts @@ -1,5 +1,5 @@ type IParams = { - page: number; + pageResultatsRecherche: number; searchTerms: string; searchFilterParams?: { toApiURI: () => string; @@ -8,7 +8,7 @@ type IParams = { export default function simplifyParams(a: IParams) { return { - page: a.page, + pageResultatsRecherche: a.pageResultatsRecherche, searchTerms: a.searchTerms, searchFilterParams: a.searchFilterParams?.toApiURI() ?? '', }; diff --git a/clients/api-proxy/rne/index.ts b/clients/api-proxy/rne/index.ts index e0a842662..bffca39a0 100644 --- a/clients/api-proxy/rne/index.ts +++ b/clients/api-proxy/rne/index.ts @@ -1,8 +1,9 @@ import routes from '#clients/routes'; import stubClientWithSnapshots from '#clients/stub-client-with-snaphots'; import constants from '#models/constants'; -import { IObservations } from '#models/rne/types'; +import { IDirigeants, IObservations } from '#models/rne/types'; import { Siren } from '#utils/helpers'; +import { getDateFin } from '#utils/helpers/rne-variables'; import { clientAPIProxy } from '../client'; type IRNEProxyResponse = { @@ -15,11 +16,12 @@ type IRNEProxyResponse = { dateCessationActivite: string; isPersonneMorale: boolean; dateClotureExercice: string; - dureePersonneMorale: string; + dureePersonneMorale: number; capital: string; libelleNatureJuridique: string; }; observations: IObservations[]; + dirigeants: IDirigeants['data']; }; /** @@ -55,7 +57,11 @@ const fetchRNEImmatriculationFallback = async ( return mapToDomainObject(response); }; -const mapToDomainObject = ({ observations, identite }: IRNEProxyResponse) => { +const mapToDomainObject = ({ + observations, + identite, + dirigeants, +}: IRNEProxyResponse) => { return { observations, immatriculation: { @@ -63,11 +69,16 @@ const mapToDomainObject = ({ observations, identite }: IRNEProxyResponse) => { dateImmatriculation: identite.dateImmatriculation, dateDebutActivite: identite.dateDebutActiv, dateRadiation: identite.dateRadiation, + dateFin: getDateFin( + identite.dureePersonneMorale, + identite.dateImmatriculation + ), isPersonneMorale: identite.isPersonneMorale, dateCloture: identite.dateClotureExercice, duree: identite.dureePersonneMorale, capital: identite.capital, }, + dirigeants, }; }; diff --git a/clients/recherche-entreprise/dirigeants.ts b/clients/recherche-entreprise/dirigeants.ts index d16adc0c6..382ea8ed5 100644 --- a/clients/recherche-entreprise/dirigeants.ts +++ b/clients/recherche-entreprise/dirigeants.ts @@ -11,7 +11,7 @@ export const clientDirigeantsRechercheEntreprise = async ( inclureEtablissements: false, inclureImmatriculation: false, pageEtablissements: 1, - useCache: true, + useCache: false, fallbackOnStaging: false, }); diff --git a/clients/recherche-entreprise/mapToDomain/index.ts b/clients/recherche-entreprise/mapToDomain/index.ts index 6479b3b3d..cea67bf3d 100644 --- a/clients/recherche-entreprise/mapToDomain/index.ts +++ b/clients/recherche-entreprise/mapToDomain/index.ts @@ -13,6 +13,7 @@ import { parseDateCreationInsee, statuDiffusionFromStatutDiffusionInsee, } from '#utils/helpers/insee-variables'; +import { getCapital, getDateFin } from '#utils/helpers/rne-variables'; import { IDirigeant, IMatchingEtablissement, @@ -20,37 +21,22 @@ import { ISiege, } from '../interface'; -const formatCapital = ( - capital: number, - devise: string, - estVariable: boolean -) => { - if (capital) { - try { - return `${new Intl.NumberFormat('fr-FR', { - style: 'currency', - currency: devise ?? 'EUR', - }).format(capital)} ${estVariable ? 'variable' : 'fixe'}`; - } catch { - return `${capital} ${devise} ${estVariable ? 'variable' : 'fixe'}`; - } - } - return ''; -}; - -export const mapToImmatriculation = (i: IResult['immatriculation']) => { +export const mapToImmatriculation = (i: IResult['immatriculation'] | null) => { + const duree = i?.duree_personne_morale ?? 0; + const dateImmatriculation = i?.date_immatriculation ?? ''; return { - dateDebutActivite: i.date_debut_activite ?? '', - dateImmatriculation: i.date_immatriculation ?? '', - dateRadiation: i.date_radiation ?? '', - duree: i.duree_personne_morale ?? 0, - natureEntreprise: i.nature_entreprise || [], - dateCloture: i.date_cloture_exercice ?? '', - isPersonneMorale: !!i.capital_social, - capital: formatCapital( - i.capital_social ?? 0, - i.devise_capital ?? '', - i.capital_variable ?? false + dateDebutActivite: i?.date_debut_activite ?? '', + dateRadiation: i?.date_radiation ?? '', + dateImmatriculation, + duree, + dateFin: getDateFin(duree, dateImmatriculation), + natureEntreprise: i?.nature_entreprise || [], + dateCloture: i?.date_cloture_exercice ?? '', + isPersonneMorale: !!i?.capital_social, + capital: getCapital( + i?.capital_social ?? 0, + i?.devise_capital ?? '', + i?.capital_variable ?? false ), }; }; diff --git a/data/changelog.yml b/data/changelog.yml index 6d6a1e226..7f5ebbe5f 100644 --- a/data/changelog.yml +++ b/data/changelog.yml @@ -11,6 +11,15 @@ # site: true --- +- date: 29/08/2024 + target: + site: true + body: | + L’onglet justificatif disparait ! Les informations qu’il contenait sont toujours présentes mais changent de place : + + - les information d’immatriculation au RNE (date d’immatriculation, capital social, nature d'entreprise) sont déplacées dans l’onglet “Fiche résumé” + - les justificatifs d’existence (annonce JOAFE, avis Sirene ou extrait RNE) sont déplacés dans l’onglet “Documents” + - les observations au RNE (uniquement pour les entreprises) sont déplacées dans l’onglet “Annonces”, renommé “Annonces & observations” - date: 31/07/2024 target: agent: true diff --git a/data/faq/registre-des-beneficiaires-effectifs.yml b/data/faq/registre-des-beneficiaires-effectifs.yml index bc83b1bf3..be773164d 100644 --- a/data/faq/registre-des-beneficiaires-effectifs.yml +++ b/data/faq/registre-des-beneficiaires-effectifs.yml @@ -29,7 +29,7 @@ body: | - nom, prénoms, pseudonyme et nom d'usage - mois et année de naissance - pays de résidence et nationalité - - nature et modalité de controle détenus par le bénénficiaire + - nature et modalité de controle détenus par le bénéficiaire ## Comment peut-on accéder au RBE à partir du 31 juillet 2024 ? diff --git a/models/api-not-responding.ts b/models/api-not-responding.ts index 8d7003559..4e2bfaee5 100644 --- a/models/api-not-responding.ts +++ b/models/api-not-responding.ts @@ -21,7 +21,7 @@ export function isAPINotResponding< >( toBeDetermined: T | IAPINotRespondingError ): toBeDetermined is IAPINotRespondingError { - if ((toBeDetermined as IAPINotRespondingError).errorType) { + if ((toBeDetermined as IAPINotRespondingError)?.errorType) { return true; } return false; @@ -31,8 +31,8 @@ export function isAPI404<T extends Exclude<unknown, IDataFetchingState>>( toBeDetermined: T | IAPINotRespondingError ): toBeDetermined is IAPINotRespondingError { if ( - (toBeDetermined as IAPINotRespondingError).errorType && - (toBeDetermined as IAPINotRespondingError).errorType === 404 + (toBeDetermined as IAPINotRespondingError)?.errorType && + (toBeDetermined as IAPINotRespondingError)?.errorType === 404 ) { return true; } diff --git a/models/core/types.ts b/models/core/types.ts index a73ec331d..79d7ff7e7 100644 --- a/models/core/types.ts +++ b/models/core/types.ts @@ -164,6 +164,7 @@ export interface IUniteLegaleImmatriculation { dateDebutActivite: string; dateImmatriculation: string; dateRadiation: string; + dateFin: string; duree: number | string; natureEntreprise: string[]; dateCloture: string; diff --git a/models/core/unite-legale.ts b/models/core/unite-legale.ts index 9e85705f0..285d298b9 100644 --- a/models/core/unite-legale.ts +++ b/models/core/unite-legale.ts @@ -8,7 +8,7 @@ import { InseeClientOptions } from '#clients/sirene-insee'; import { clientUniteLegaleInsee } from '#clients/sirene-insee/siren'; import { createEtablissementsList } from '#models/core/etablissements-list'; import { IETATADMINSTRATIF, estActif } from '#models/core/etat-administratif'; -import { getImmatriculation } from '#models/rne/immatriculation'; +import { getRNEImmatriculation } from '#models/rne/immatriculation'; import { Siren, verifySiren } from '#utils/helpers'; import { isProtectedSiren } from '#utils/helpers/is-protected-siren-or-siret'; import { logFatalErrorInSentry, logWarningInSentry } from '#utils/sentry'; @@ -102,7 +102,7 @@ class UniteLegaleBuilder { // for some reason we didnot get immatriculation from Recherche Entreprise if (isAPI404(uniteLegale.immatriculation)) { if (!isServicePublic(uniteLegale) && !isAssociation(uniteLegale)) { - const immatriculation = await getImmatriculation(this._siren); + const immatriculation = await getRNEImmatriculation(this._siren); uniteLegale.immatriculation = immatriculation; } } diff --git a/models/rne/dirigeants.tsx b/models/rne/dirigeants.tsx index a8ffdd328..b9c08b2df 100644 --- a/models/rne/dirigeants.tsx +++ b/models/rne/dirigeants.tsx @@ -29,8 +29,8 @@ export const getDirigeantsRNE = async ( try { const dirigeants = await clientDirigeantsRechercheEntreprise(siren); return { data: dirigeants, metadata: { isFallback: true } }; - } catch { - if (e instanceof HttpNotFound) { + } catch (eFallback) { + if (eFallback instanceof HttpNotFound) { return APINotRespondingFactory(EAdministration.INPI, 404); } } diff --git a/models/rne/immatriculation.ts b/models/rne/immatriculation.ts index 4b2f9485f..c91913f82 100644 --- a/models/rne/immatriculation.ts +++ b/models/rne/immatriculation.ts @@ -15,7 +15,7 @@ import { verifySiren } from '#utils/helpers'; * Request Immatriculation from INPI's RNE * @param siren */ -export const getImmatriculation = async ( +export const getRNEImmatriculation = async ( maybeSiren: string ): Promise<IAPINotRespondingError | IUniteLegaleImmatriculation> => { const siren = verifySiren(maybeSiren); diff --git a/utils/helpers/rne-variables/index.ts b/utils/helpers/rne-variables/index.ts new file mode 100644 index 000000000..010fd1c59 --- /dev/null +++ b/utils/helpers/rne-variables/index.ts @@ -0,0 +1,47 @@ +import { formatDate } from '../formatting/formatting'; + +/** + * compute date at which personne morale will end + * @param duree + * @param dateImmatriculation + * @returns + */ +export function getDateFin( + duree: number | null, + dateImmatriculation: string | null +): string { + if (duree && dateImmatriculation) { + try { + const d = new Date(dateImmatriculation); + d.setFullYear(d.getFullYear() + duree); + return formatDate(d) || ''; + } catch {} + } + return ''; +} + +/** + * Compute capital social + * + * @param capital + * @param devise + * @param estVariable + * @returns + */ +export const getCapital = ( + capital: number, + devise: string, + estVariable: boolean +) => { + if (capital) { + try { + return `${new Intl.NumberFormat('fr-FR', { + style: 'currency', + currency: devise ?? 'EUR', + }).format(capital)} ${estVariable ? 'variable' : 'fixe'}`; + } catch { + return `${capital} ${devise} ${estVariable ? 'variable' : 'fixe'}`; + } + } + return ''; +}; diff --git a/utils/helpers/rne-variables/rne-variables.test.ts b/utils/helpers/rne-variables/rne-variables.test.ts new file mode 100644 index 000000000..33bb4a9cb --- /dev/null +++ b/utils/helpers/rne-variables/rne-variables.test.ts @@ -0,0 +1,21 @@ +import { getCapital, getDateFin } from '.'; + +describe('Check RNE variables helpers', () => { + test('Succeeds with valid inputs', () => { + expect(getDateFin(50, '1999-06-21')).toBe('21/06/2049'); + }); + + test('Fails without a date or durée', () => { + expect(getDateFin(0, '1999-06-21')).toBe(''); + expect(getDateFin(40, '')).toBe(''); + expect(getDateFin(40, null)).toBe(''); + }); + + test('Succeeds with valid inputs', () => { + expect(getCapital(10, '£', true)).toBe('10 £ variable'); + expect(getCapital(1000000, '€', false)).toBe('1000000 € fixe'); + expect(getCapital(10, 'POUNDS', true)).toBe('10 POUNDS variable'); + }); +}); + +export {}; From b0a5f0faec6f0e9c2572572ae7e76b26cd26cce3 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Thu, 29 Aug 2024 17:58:06 +0200 Subject: [PATCH 08/16] feat: handle no immatriculation case --- .../[slug]/_components/observations-rne.tsx | 8 +- .../_components/immatriculation-section.tsx | 1 + .../[slug]/_components/inscriptions.tsx | 261 +++++++++++------- .../[slug]/_components/summary-section.tsx | 26 +- .../entreprise/[slug]/page.tsx | 4 +- app/api/data-fetching/routes-handlers.ts | 4 +- app/api/data-fetching/routes-scopes.ts | 3 +- .../_snapshots/protected.json | 0 .../_snapshots/rge.json | 0 .../_snapshots/siret-356000000.json | 0 .../index.test.ts | 18 +- clients/api-proxy/rne/index.ts | 16 +- clients/ping-api-clients.ts | 4 +- .../recherche-entreprise/mapToDomain/index.ts | 4 + clients/sirene-insee/siren.ts | 1 - components-ui/badge/frequent.tsx | 11 +- components-ui/icon/index.tsx | 14 + models/core/types.ts | 5 +- models/core/unite-legale.ts | 11 - models/rne/dirigeants.tsx | 4 +- models/rne/immatriculation.ts | 43 --- models/rne/observations.ts | 14 +- models/rne/types.ts | 2 +- utils/helpers/rne-variables/index.ts | 12 +- .../rne-variables/rne-variables.test.ts | 6 +- 25 files changed, 243 insertions(+), 229 deletions(-) rename clients/_test/{fetchRNEImmatriculation => clientRNEImmatriculation}/_snapshots/protected.json (100%) rename clients/_test/{fetchRNEImmatriculation => clientRNEImmatriculation}/_snapshots/rge.json (100%) rename clients/_test/{fetchRNEImmatriculation => clientRNEImmatriculation}/_snapshots/siret-356000000.json (100%) rename clients/_test/{fetchRNEImmatriculation => clientRNEImmatriculation}/index.test.ts (75%) delete mode 100644 models/rne/immatriculation.ts diff --git a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx index d32955e9d..5dcd92678 100644 --- a/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx +++ b/app/(header-default)/annonces/[slug]/_components/observations-rne.tsx @@ -32,18 +32,18 @@ export const ObservationsRNE: React.FC<{ </> } > - {(observations) => - observations && observations.length > 0 ? ( + {({ data, metadata }) => + data.length > 0 ? ( <> {metadata.isFallback && <InpiPartiallyDownWarning />} <p> - Cette structure possède {observations.length} observation(s) au{' '} + Cette structure possède {data.length} observation(s) au{' '} <strong>RNE</strong>  : </p> <FullTable head={['Date d’ajout', 'Numéro d’observation', 'Description']} - body={observations.map((o) => [ + body={data.map((o) => [ o.dateAjout, o.numObservation ? <Tag>{o.numObservation}</Tag> : '', o.description, diff --git a/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx index 9bb39f817..8099395a7 100644 --- a/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx @@ -23,6 +23,7 @@ export const UniteLegaleImmatriculationSection = ({ session: ISession | null; }) => { const immatriculation = uniteLegale.immatriculation; + return ( <DataSection title="Immatricuation au RNE" diff --git a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx index 2ea6e2b10..00e4a84e5 100644 --- a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx @@ -1,13 +1,17 @@ -import React, { PropsWithChildren } from 'react'; import { OpenClosedTag } from '#components-ui/badge/frequent'; import { Icon } from '#components-ui/icon/wrapper'; import InformationTooltip from '#components-ui/information-tooltip'; import AvisSituationLink from '#components/justificatifs/avis-situation-link'; import ExtraitRNELink from '#components/justificatifs/extrait-rne-link'; import { estActif } from '#models/core/etat-administratif'; -import { IUniteLegale } from '#models/core/types'; +import { + IUniteLegale, + isAssociation, + isServicePublic, +} from '#models/core/types'; import { ISession } from '#models/user/session'; import { formatDate } from '#utils/helpers'; +import React, { PropsWithChildren } from 'react'; import styles from './style.module.css'; const Wrapper: React.FC<PropsWithChildren<{ link: JSX.Element }>> = ({ @@ -26,44 +30,50 @@ export const UniteLegaleInscriptionSirene = ({ }: { uniteLegale: IUniteLegale; session: ISession | null; -}) => ( - <Wrapper - link={ - <Icon slug="download"> - <AvisSituationLink - session={session} - etablissement={uniteLegale.siege} - label="Avis de situation Sirene" - /> - </Icon> - } - > - <InformationTooltip - tabIndex={undefined} - label={`Cette structure est inscrite dans la base Sirene tenue par l’Insee${ - uniteLegale.dateCreation - ? `, depuis le ${formatDate(uniteLegale.dateCreation)}` - : '' - }. Elle a été mise à jour le ${formatDate( - uniteLegale.dateMiseAJourInsee - )}.`} +}) => { + if (!uniteLegale.dateMiseAJourInsee) { + return null; + } + + return ( + <Wrapper + link={ + <Icon slug="download"> + <AvisSituationLink + session={session} + etablissement={uniteLegale.siege} + label="Avis de situation Sirene" + /> + </Icon> + } > - {estActif(uniteLegale) ? ( - <OpenClosedTag isVerified={true} label="Inscrite (Insee)"> - {uniteLegale.dateCreation && ( - <>le {formatDate(uniteLegale.dateCreation)}</> - )} - </OpenClosedTag> - ) : ( - <OpenClosedTag isVerified={false} label="Cessée (Insee)"> - {uniteLegale.dateCreation && ( - <>le {formatDate(uniteLegale.dateFermeture)}</> - )} - </OpenClosedTag> - )} - </InformationTooltip> - </Wrapper> -); + <InformationTooltip + tabIndex={undefined} + label={`Cette structure est inscrite dans la base Sirene tenue par l’Insee${ + uniteLegale.dateCreation + ? `, depuis le ${formatDate(uniteLegale.dateCreation)}` + : '' + }. Elle a été mise à jour le ${formatDate( + uniteLegale.dateMiseAJourInsee + )}.`} + > + {estActif(uniteLegale) ? ( + <OpenClosedTag icon="open" label="Inscrite (Insee)"> + {uniteLegale.dateCreation && ( + <>le {formatDate(uniteLegale.dateCreation)}</> + )} + </OpenClosedTag> + ) : ( + <OpenClosedTag icon="closed" label="Cessée (Insee)"> + {uniteLegale.dateCreation && ( + <>le {formatDate(uniteLegale.dateFermeture)}</> + )} + </OpenClosedTag> + )} + </InformationTooltip> + </Wrapper> + ); +}; export const UniteLegaleInscriptionRNE = ({ uniteLegale, @@ -71,75 +81,120 @@ export const UniteLegaleInscriptionRNE = ({ }: { uniteLegale: IUniteLegale; session: ISession | null; -}) => ( - <Wrapper - link={ - <Icon slug="download"> - <ExtraitRNELink - uniteLegale={uniteLegale} - session={session} - label="Extrait RNE" - />{' '} - (<a href="/faq/extrait-kbis">équivalent KBIS/D1</a>) - </Icon> +}) => { + if (!uniteLegale.dateMiseAJourInpi) { + if (isServicePublic(uniteLegale) || isAssociation(uniteLegale)) { + return null; + } else { + return ( + <Wrapper + link={ + <Icon slug="searchLine"> + <a + rel="noreferre noopener" + target="_blank" + href="https://data.inpi.fr" + > + Rechercher sur data.inpi.fr + </a> + </Icon> + } + > + <InformationTooltip + tabIndex={undefined} + label={ + 'Cette structure est n’a pas été retrouvée sur le téléservice du Registre National des Entreprises (RNE) tenu par l’INPI. Pourtant, vu sa forme juridique, elle devrait y être inscrite. Vous pouvez essayer de la retrouver sur le site data.inpi.fr' + } + > + <OpenClosedTag + icon="questionFill" + label="Non trouvée dans le RNE (INPI)" + /> + </InformationTooltip> + </Wrapper> + ); } - > - <InformationTooltip - tabIndex={undefined} - label={`Cette structure est immatriculée au Registre National des Entreprises (RNE)${ - uniteLegale.immatriculation?.dateImmatriculation - ? `, depuis le ${formatDate( - uniteLegale.immatriculation?.dateImmatriculation - )}` - : '' - }. Elle a été mise à jour le ${formatDate( - uniteLegale.dateMiseAJourInpi - )}.`} + } + + return ( + <Wrapper + link={ + <Icon slug="download"> + <ExtraitRNELink + uniteLegale={uniteLegale} + session={session} + label="Extrait RNE" + />{' '} + (<a href="/faq/extrait-kbis">équivalent KBIS/D1</a>) + </Icon> + } > - <a href="#immatriculation-rne"> - {uniteLegale.immatriculation?.dateRadiation ? ( - <OpenClosedTag isVerified={true} label="Radiée au RNE(INPI)"> - le {formatDate(uniteLegale.immatriculation?.dateRadiation)} - </OpenClosedTag> - ) : ( - <OpenClosedTag isVerified={true} label="Immatriculée au RNE (INPI)"> - {uniteLegale.immatriculation?.dateImmatriculation && ( - <> - le{' '} - {formatDate(uniteLegale.immatriculation?.dateImmatriculation)} - </> - )} - </OpenClosedTag> - )} - </a> - </InformationTooltip> - </Wrapper> -); + <InformationTooltip + tabIndex={undefined} + label={`Cette structure est immatriculée au Registre National des Entreprises (RNE)${ + uniteLegale.immatriculation?.dateImmatriculation + ? `, depuis le ${formatDate( + uniteLegale.immatriculation?.dateImmatriculation + )}` + : '' + }.${ + uniteLegale.dateMiseAJourInpi + ? ` Elle a été mise à jour le ${formatDate( + uniteLegale.dateMiseAJourInpi + )}.` + : '' + }`} + > + <a href="#immatriculation-rne"> + {uniteLegale.immatriculation?.dateRadiation ? ( + <OpenClosedTag icon="closed" label="Radiée au RNE (INPI)"> + le {formatDate(uniteLegale.immatriculation?.dateRadiation)} + </OpenClosedTag> + ) : ( + <OpenClosedTag icon="open" label="Immatriculée au RNE (INPI)"> + {uniteLegale.immatriculation?.dateImmatriculation && ( + <> + le{' '} + {formatDate(uniteLegale.immatriculation?.dateImmatriculation)} + </> + )} + </OpenClosedTag> + )} + </a> + </InformationTooltip> + </Wrapper> + ); +}; export const UniteLegaleInscriptionRNA = ({ uniteLegale, }: { uniteLegale: IUniteLegale; -}) => ( - <Wrapper - link={ - <Icon slug="download"> - <a>Annonce de création au JOAFE</a> - </Icon> - } - > - <InformationTooltip - tabIndex={undefined} - label="Cette structure est inscrite au Registre National des Association (RNA)." +}) => { + if (!uniteLegale.association.idAssociation) { + return null; + } + return ( + <Wrapper + link={ + <Icon slug="download"> + <a href={`/documents/${uniteLegale.siren}`}> + Annonce de création au JOAFE + </a> + </Icon> + } > - <a href="#association-section"> - <OpenClosedTag - isVerified={true} - label={'Inscrite au RNA (Ministère de l’Intérieur)'} - > - le {formatDate(uniteLegale.immatriculation?.dateImmatriculation)} - </OpenClosedTag> - </a> - </InformationTooltip> - </Wrapper> -); + <InformationTooltip + tabIndex={undefined} + label="Cette structure est inscrite au Registre National des Association (RNA)." + > + <a href="#association-section"> + <OpenClosedTag + icon="open" + label={'Inscrite au RNA (Ministère de l’Intérieur)'} + /> + </a> + </InformationTooltip> + </Wrapper> + ); +}; diff --git a/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx b/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx index b51031192..8854f0812 100644 --- a/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import FAQLink from '#components-ui/faq-link'; import { ConventionCollectivesBadgesSection } from '#components/badges-section/convention-collectives'; import { ProtectedCertificatesBadgesSection } from '#components/badges-section/labels-and-certificates/protected-certificats'; @@ -18,6 +17,7 @@ import { ISession } from '#models/user/session'; import { formatDate, formatIntFr, formatSiret } from '#utils/helpers'; import { libelleCategorieEntreprise } from '#utils/helpers/formatting/categories-entreprise'; import { libelleTrancheEffectif } from '#utils/helpers/formatting/codes-effectifs'; +import React from 'react'; import { LabelsAndCertificatesBadgesSection, checkHasLabelsAndCertificates, @@ -41,21 +41,15 @@ const UniteLegaleSummarySection: React.FC<{ [ 'État des inscriptions', <> - {uniteLegale.dateMiseAJourInsee && ( - <UniteLegaleInscriptionSirene - uniteLegale={uniteLegale} - session={session} - /> - )} - {uniteLegale.dateMiseAJourInpi && ( - <UniteLegaleInscriptionRNE - uniteLegale={uniteLegale} - session={session} - /> - )} - {uniteLegale.association.idAssociation && ( - <UniteLegaleInscriptionRNA uniteLegale={uniteLegale} /> - )} + <UniteLegaleInscriptionSirene + uniteLegale={uniteLegale} + session={session} + /> + <UniteLegaleInscriptionRNE + uniteLegale={uniteLegale} + session={session} + /> + <UniteLegaleInscriptionRNA uniteLegale={uniteLegale} /> </>, ], ['', <br />], diff --git a/app/(header-default)/entreprise/[slug]/page.tsx b/app/(header-default)/entreprise/[slug]/page.tsx index 65c095d46..0ba71718e 100644 --- a/app/(header-default)/entreprise/[slug]/page.tsx +++ b/app/(header-default)/entreprise/[slug]/page.tsx @@ -1,4 +1,3 @@ -import { Metadata } from 'next'; import { HorizontalSeparator } from '#components-ui/horizontal-separator'; import AssociationSection from '#components/association-section'; import CollectiviteTerritorialeSection from '#components/collectivite-territoriale-section'; @@ -30,6 +29,7 @@ import extractParamsAppRouter, { import getSession from '#utils/server-side-helper/app/get-session'; import { UniteLegaleImmatriculationSection } from 'app/(header-default)/entreprise/[slug]/_components/immatriculation-section'; import UniteLegaleSummarySection from 'app/(header-default)/entreprise/[slug]/_components/summary-section'; +import { Metadata } from 'next'; export const generateMetadata = async ( props: AppRouterProps @@ -79,7 +79,7 @@ export default async function UniteLegalePage(props: AppRouterProps) { session={session} /> )} - {uniteLegale.immatriculation && ( + {uniteLegale.dateMiseAJourInpi && ( <UniteLegaleImmatriculationSection uniteLegale={uniteLegale} session={session} diff --git a/app/api/data-fetching/routes-handlers.ts b/app/api/data-fetching/routes-handlers.ts index 198c26036..35ce72bf0 100644 --- a/app/api/data-fetching/routes-handlers.ts +++ b/app/api/data-fetching/routes-handlers.ts @@ -9,7 +9,7 @@ import { getConformiteEntreprise } from '#models/espace-agent/conformite'; import { getMandatairesRCS } from '#models/espace-agent/mandataires-rcs'; import { getDocumentsRNEProtected } from '#models/espace-agent/rne-protected/documents'; import { getDirigeantsRNE } from '#models/rne/dirigeants'; -import { getRNEImmatriculation } from '#models/rne/immatriculation'; +import { getRNEObservations } from '#models/rne/observations'; import { buildAndVerifyTVA } from '#models/tva/verify'; import { UnwrapPromise } from 'types'; @@ -23,7 +23,7 @@ export const APIRoutesHandlers = { 'espace-agent/rne/documents': getDocumentsRNEProtected, 'espace-agent/association-protected': getAssociationProtected, 'rne-dirigeants': getDirigeantsRNE, - rne: getRNEImmatriculation, + observations: getRNEObservations, association: getAssociationFromSlug, 'verify-tva': buildAndVerifyTVA, 'eori-validation': getEORIValidation, diff --git a/app/api/data-fetching/routes-scopes.ts b/app/api/data-fetching/routes-scopes.ts index 97c44fd55..22f9cbe09 100644 --- a/app/api/data-fetching/routes-scopes.ts +++ b/app/api/data-fetching/routes-scopes.ts @@ -11,8 +11,9 @@ export const APIRoutesScopes: Record<APIPath, EScope> = { 'espace-agent/rcs-mandataires': EScope.mandatairesRCS, 'espace-agent/rne/documents': EScope.documentsRne, 'espace-agent/association-protected': EScope.associationProtected, + // public routes 'rne-dirigeants': EScope.none, - rne: EScope.none, + observations: EScope.none, association: EScope.none, 'verify-tva': EScope.none, 'eori-validation': EScope.none, diff --git a/clients/_test/fetchRNEImmatriculation/_snapshots/protected.json b/clients/_test/clientRNEImmatriculation/_snapshots/protected.json similarity index 100% rename from clients/_test/fetchRNEImmatriculation/_snapshots/protected.json rename to clients/_test/clientRNEImmatriculation/_snapshots/protected.json diff --git a/clients/_test/fetchRNEImmatriculation/_snapshots/rge.json b/clients/_test/clientRNEImmatriculation/_snapshots/rge.json similarity index 100% rename from clients/_test/fetchRNEImmatriculation/_snapshots/rge.json rename to clients/_test/clientRNEImmatriculation/_snapshots/rge.json diff --git a/clients/_test/fetchRNEImmatriculation/_snapshots/siret-356000000.json b/clients/_test/clientRNEImmatriculation/_snapshots/siret-356000000.json similarity index 100% rename from clients/_test/fetchRNEImmatriculation/_snapshots/siret-356000000.json rename to clients/_test/clientRNEImmatriculation/_snapshots/siret-356000000.json diff --git a/clients/_test/fetchRNEImmatriculation/index.test.ts b/clients/_test/clientRNEImmatriculation/index.test.ts similarity index 75% rename from clients/_test/fetchRNEImmatriculation/index.test.ts rename to clients/_test/clientRNEImmatriculation/index.test.ts index 4ec63d1bd..bdea84c57 100644 --- a/clients/_test/fetchRNEImmatriculation/index.test.ts +++ b/clients/_test/clientRNEImmatriculation/index.test.ts @@ -1,16 +1,18 @@ -import { fetchRNEImmatriculation } from '#clients/api-proxy/rne'; -import { fetchRNEImmatriculationFallback } from '#clients/api-proxy/rne/fallback'; +import { + clientRNEImmatriculation, + clientRNEImmatriculationFallback, +} from '#clients/api-proxy/rne'; import { Siren } from '#utils/helpers'; import { expectClientToMatchSnapshot } from '../expect-client-to-match-snapshot'; const TIMEOUT_RNE = 90000; -describe('fetchRNEImmatriculation', () => { +describe('clientRNEImmatriculation', () => { it( 'Should match snapshot for protected uniteLegale with the characteristics (PROTECTED)', async () => { await expectClientToMatchSnapshot({ - client: fetchRNEImmatriculation, + client: clientRNEImmatriculation, args: ['908595879' as Siren], __dirname, snaphotFile: 'protected.json', @@ -23,7 +25,7 @@ describe('fetchRNEImmatriculation', () => { 'Should match snapshot for protected uniteLegale with the characteristics (RGE)', async () => { await expectClientToMatchSnapshot({ - client: fetchRNEImmatriculation, + client: clientRNEImmatriculation, args: ['487444697' as Siren], __dirname, snaphotFile: 'rge.json', @@ -36,7 +38,7 @@ describe('fetchRNEImmatriculation', () => { 'Should match snapshot for 356000000 siret', async () => { await expectClientToMatchSnapshot({ - client: fetchRNEImmatriculation, + client: clientRNEImmatriculation, args: ['356000000' as Siren], __dirname, snaphotFile: 'siret-356000000.json', @@ -46,12 +48,12 @@ describe('fetchRNEImmatriculation', () => { ); }); -describe('fetchRNEImmatriculationFallback', () => { +describe('clientRNEImmatriculationFallback', () => { it( 'Should match snapshot for protected uniteLegale with the characteristics (RGE)', async () => { await expectClientToMatchSnapshot({ - client: fetchRNEImmatriculationFallback, + client: clientRNEImmatriculationFallback, args: ['487444697' as Siren], __dirname, snaphotFile: 'rge.json', diff --git a/clients/api-proxy/rne/index.ts b/clients/api-proxy/rne/index.ts index bffca39a0..35ac5609d 100644 --- a/clients/api-proxy/rne/index.ts +++ b/clients/api-proxy/rne/index.ts @@ -20,7 +20,7 @@ type IRNEProxyResponse = { capital: string; libelleNatureJuridique: string; }; - observations: IObservations[]; + observations: IObservations['data']; dirigeants: IDirigeants['data']; }; @@ -28,11 +28,11 @@ type IRNEProxyResponse = { * RNE through the API proxy - API RNE * @param siren */ -const fetchRNEImmatriculation = async (siren: Siren, useCache = true) => { +const clientRNEImmatriculation = async (siren: Siren, useCache = true) => { const response = await clientAPIProxy<IRNEProxyResponse>( routes.proxy.rne.immatriculation.default + siren, { - timeout: constants.timeout.XXXL, + timeout: constants.timeout.XS, useCache, } ); @@ -43,7 +43,7 @@ const fetchRNEImmatriculation = async (siren: Siren, useCache = true) => { * RNE through the API proxy - scrapping site as fallback * @param siren */ -const fetchRNEImmatriculationFallback = async ( +const clientRNEImmatriculationFallback = async ( siren: Siren, useCache = true ) => { @@ -83,13 +83,13 @@ const mapToDomainObject = ({ }; const stubbedClient = stubClientWithSnapshots({ - fetchRNEImmatriculation, + clientRNEImmatriculation, }); const stubbedClientFallback = stubClientWithSnapshots({ - fetchRNEImmatriculationFallback, + clientRNEImmatriculationFallback, }); export { - stubbedClient as fetchRNEImmatriculation, - stubbedClientFallback as fetchRNEImmatriculationFallback, + stubbedClient as clientRNEImmatriculation, + stubbedClientFallback as clientRNEImmatriculationFallback, }; diff --git a/clients/ping-api-clients.ts b/clients/ping-api-clients.ts index e7f6ac1bf..dda54bdfe 100644 --- a/clients/ping-api-clients.ts +++ b/clients/ping-api-clients.ts @@ -8,7 +8,7 @@ import { } from '#utils/helpers'; import { clientMarcheInclusion } from './api-inclusion'; import { clientEORI } from './api-proxy/eori'; -import { fetchRNEImmatriculation } from './api-proxy/rne'; +import { clientRNEImmatriculation } from './api-proxy/rne'; import { clientTVA } from './api-proxy/tva'; import clientSearchRechercheEntreprise from './recherche-entreprise'; import { clientUniteLegaleRechercheEntreprise } from './recherche-entreprise/siren'; @@ -31,7 +31,7 @@ const ping = async (slug: string | string[]) => { switch (slug) { case 'api-proxy-rne': // fetch IRM and disable cache - return await fetchRNEImmatriculation(sirenDanone, useCache); + return await clientRNEImmatriculation(sirenDanone, useCache); case 'api-sirene-insee': return await clientUniteLegaleInsee(sirenGanymede, 1, { useCache, diff --git a/clients/recherche-entreprise/mapToDomain/index.ts b/clients/recherche-entreprise/mapToDomain/index.ts index cea67bf3d..2ef43a1d6 100644 --- a/clients/recherche-entreprise/mapToDomain/index.ts +++ b/clients/recherche-entreprise/mapToDomain/index.ts @@ -22,6 +22,10 @@ import { } from '../interface'; export const mapToImmatriculation = (i: IResult['immatriculation'] | null) => { + if (!i) { + return null; + } + const duree = i?.duree_personne_morale ?? 0; const dateImmatriculation = i?.date_immatriculation ?? ''; return { diff --git a/clients/sirene-insee/siren.ts b/clients/sirene-insee/siren.ts index 6a7f0a07a..a23cec095 100644 --- a/clients/sirene-insee/siren.ts +++ b/clients/sirene-insee/siren.ts @@ -279,7 +279,6 @@ const mapToDomainObject = ( estEntrepreneurIndividuel, estEss: economieSocialeSolidaireUniteLegale === 'O', }, - immatriculation: null, association: { idAssociation: identifiantAssociationUniteLegale || null, }, diff --git a/components-ui/badge/frequent.tsx b/components-ui/badge/frequent.tsx index 4c74e8d3c..aac7e7161 100644 --- a/components-ui/badge/frequent.tsx +++ b/components-ui/badge/frequent.tsx @@ -99,15 +99,10 @@ export const DefaultStructureBadge = ({ ); export const OpenClosedTag: React.FC< - PropsWithChildren<{ isVerified?: boolean; label: string }> -> = ({ label = '', isVerified = true, children }) => ( + PropsWithChildren<{ icon: 'open' | 'closed' | 'questionFill'; label: string }> +> = ({ label = '', icon, children }) => ( <div className="layout-left"> - <Badge - icon={isVerified ? 'open' : 'closed'} - label={label} - backgroundColor="#ddd" - fontColor="var(--text-default-grey)" - /> + <Badge icon={icon} label={label} backgroundColor="#ddd" fontColor="#666" /> {children} </div> ); diff --git a/components-ui/icon/index.tsx b/components-ui/icon/index.tsx index 05555d491..3fd730bcd 100644 --- a/components-ui/icon/index.tsx +++ b/components-ui/icon/index.tsx @@ -437,9 +437,23 @@ const present = ( </svg> ); +const searchLine = ( + <svg + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 24 24" + width="100%" + height="100%" + stroke="none" + fill="currentColor" + > + <path d="m18.031 16.617 4.283 4.282-1.415 1.415-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9 9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617Zm-2.006-.742A6.977 6.977 0 0 0 18 11c0-3.868-3.133-7-7-7-3.868 0-7 3.132-7 7 0 3.867 3.132 7 7 7a6.977 6.977 0 0 0 4.875-1.975l.15-.15Z" /> + </svg> +); + export type IIconsSlug = keyof typeof icons; export const icons = { + searchLine, accountLine, administrationFill, alertFill, diff --git a/models/core/types.ts b/models/core/types.ts index 79d7ff7e7..df7725da0 100644 --- a/models/core/types.ts +++ b/models/core/types.ts @@ -1,8 +1,7 @@ /** COMMON TYPES */ -import { IAPINotRespondingError } from '#models/api-not-responding'; import { - createEtablissementsList, IEtablissementsList, + createEtablissementsList, } from '#models/core/etablissements-list'; import { IETATADMINSTRATIF } from '#models/core/etat-administratif'; import { IEtatCivil } from '#models/rne/types'; @@ -110,7 +109,7 @@ export interface IUniteLegale extends IEtablissementsList { categorieEntreprise: string | null; anneeCategorieEntreprise: string | null; complements: IUniteLegaleComplements; - immatriculation: IUniteLegaleImmatriculation | IAPINotRespondingError | null; + immatriculation: IUniteLegaleImmatriculation | null; association: { idAssociation: IdRna | string | null; }; diff --git a/models/core/unite-legale.ts b/models/core/unite-legale.ts index 285d298b9..eacba7acc 100644 --- a/models/core/unite-legale.ts +++ b/models/core/unite-legale.ts @@ -8,7 +8,6 @@ import { InseeClientOptions } from '#clients/sirene-insee'; import { clientUniteLegaleInsee } from '#clients/sirene-insee/siren'; import { createEtablissementsList } from '#models/core/etablissements-list'; import { IETATADMINSTRATIF, estActif } from '#models/core/etat-administratif'; -import { getRNEImmatriculation } from '#models/rne/immatriculation'; import { Siren, verifySiren } from '#utils/helpers'; import { isProtectedSiren } from '#utils/helpers/is-protected-siren-or-siret'; import { logFatalErrorInSentry, logWarningInSentry } from '#utils/sentry'; @@ -32,8 +31,6 @@ import { IUniteLegale, SirenNotFoundError, createDefaultUniteLegale, - isAssociation, - isServicePublic, } from './types'; /** @@ -99,14 +96,6 @@ class UniteLegaleBuilder { IETATADMINSTRATIF.ACTIF_ZERO_ETABLISSEMENT; } - // for some reason we didnot get immatriculation from Recherche Entreprise - if (isAPI404(uniteLegale.immatriculation)) { - if (!isServicePublic(uniteLegale) && !isAssociation(uniteLegale)) { - const immatriculation = await getRNEImmatriculation(this._siren); - uniteLegale.immatriculation = immatriculation; - } - } - return uniteLegale; }; diff --git a/models/rne/dirigeants.tsx b/models/rne/dirigeants.tsx index b9c08b2df..814838b6f 100644 --- a/models/rne/dirigeants.tsx +++ b/models/rne/dirigeants.tsx @@ -1,4 +1,4 @@ -import { fetchRNEImmatriculation } from '#clients/api-proxy/rne'; +import { clientRNEImmatriculation } from '#clients/api-proxy/rne'; import { HttpNotFound } from '#clients/exceptions'; import { clientDirigeantsRechercheEntreprise } from '#clients/recherche-entreprise/dirigeants'; import { EAdministration } from '#models/administrations/EAdministration'; @@ -19,7 +19,7 @@ export const getDirigeantsRNE = async ( const siren = verifySiren(maybeSiren); try { - const { dirigeants } = await fetchRNEImmatriculation(siren); + const { dirigeants } = await clientRNEImmatriculation(siren); return { data: dirigeants, metadata: { isFallback: false } }; } catch (e: any) { if (e instanceof HttpNotFound) { diff --git a/models/rne/immatriculation.ts b/models/rne/immatriculation.ts deleted file mode 100644 index c91913f82..000000000 --- a/models/rne/immatriculation.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - fetchRNEImmatriculation, - fetchRNEImmatriculationFallback, -} from '#clients/api-proxy/rne'; -import { HttpNotFound } from '#clients/exceptions'; -import { EAdministration } from '#models/administrations/EAdministration'; -import { - APINotRespondingFactory, - IAPINotRespondingError, -} from '#models/api-not-responding'; -import { IUniteLegaleImmatriculation } from '#models/core/types'; -import { verifySiren } from '#utils/helpers'; - -/* - * Request Immatriculation from INPI's RNE - * @param siren - */ -export const getRNEImmatriculation = async ( - maybeSiren: string -): Promise<IAPINotRespondingError | IUniteLegaleImmatriculation> => { - const siren = verifySiren(maybeSiren); - - try { - const { immatriculation } = await fetchRNEImmatriculation(siren); - return immatriculation; - } catch (eDefaultTry: any) { - if (eDefaultTry instanceof HttpNotFound) { - return APINotRespondingFactory(EAdministration.INPI, 404); - } - - try { - const { immatriculation } = await fetchRNEImmatriculationFallback(siren); - return immatriculation; - } catch (eFallback: any) { - if (eFallback instanceof HttpNotFound) { - return APINotRespondingFactory(EAdministration.INPI, 404); - } - - // no need to log an error as API-Proxy already logged it - return APINotRespondingFactory(EAdministration.INPI, 500); - } - } -}; diff --git a/models/rne/observations.ts b/models/rne/observations.ts index b1de2cbb9..0a885711f 100644 --- a/models/rne/observations.ts +++ b/models/rne/observations.ts @@ -1,5 +1,7 @@ -import { fetchRNEImmatriculation } from '#clients/api-proxy/rne'; -import { fetchRNEImmatriculationFallback } from '#clients/api-proxy/rne/fallback'; +import { + clientRNEImmatriculation, + clientRNEImmatriculationFallback, +} from '#clients/api-proxy/rne'; import { HttpNotFound } from '#clients/exceptions'; import { EAdministration } from '#models/administrations/EAdministration'; import { @@ -13,20 +15,22 @@ import { IObservations } from './types'; * Request observations from INPI's RNE * @param siren */ -export const getObservations = async ( +export const getRNEObservations = async ( maybeSiren: string ): Promise<IAPINotRespondingError | IObservations> => { const siren = verifySiren(maybeSiren); try { - return await fetchRNEImmatriculation(siren); + const { observations } = await clientRNEImmatriculation(siren); + return { data: observations, metadata: { isFallback: false } }; } catch (eDefaultTry: any) { if (eDefaultTry instanceof HttpNotFound) { return APINotRespondingFactory(EAdministration.INPI, 404); } try { - return await fetchRNEImmatriculationFallback(siren); + const { observations } = await clientRNEImmatriculationFallback(siren); + return { data: observations, metadata: { isFallback: true } }; } catch (eFallback: any) { if (eFallback instanceof HttpNotFound) { return APINotRespondingFactory(EAdministration.INPI, 404); diff --git a/models/rne/types.ts b/models/rne/types.ts index 95326de26..8d9115fe2 100644 --- a/models/rne/types.ts +++ b/models/rne/types.ts @@ -36,7 +36,7 @@ export interface IPersonneMorale { } export interface IObservations { - observations: { + data: { numObservation: string; dateAjout: string; description: string; diff --git a/utils/helpers/rne-variables/index.ts b/utils/helpers/rne-variables/index.ts index 010fd1c59..290c0803b 100644 --- a/utils/helpers/rne-variables/index.ts +++ b/utils/helpers/rne-variables/index.ts @@ -10,13 +10,13 @@ export function getDateFin( duree: number | null, dateImmatriculation: string | null ): string { - if (duree && dateImmatriculation) { - try { + try { + if (duree && dateImmatriculation) { const d = new Date(dateImmatriculation); d.setFullYear(d.getFullYear() + duree); return formatDate(d) || ''; - } catch {} - } + } + } catch {} return ''; } @@ -38,9 +38,9 @@ export const getCapital = ( return `${new Intl.NumberFormat('fr-FR', { style: 'currency', currency: devise ?? 'EUR', - }).format(capital)} ${estVariable ? 'variable' : 'fixe'}`; + }).format(capital)} ${estVariable ? '(variable)' : '(fixe)'}`; } catch { - return `${capital} ${devise} ${estVariable ? 'variable' : 'fixe'}`; + return `${capital} ${devise} ${estVariable ? '(variable)' : '(fixe)'}`; } } return ''; diff --git a/utils/helpers/rne-variables/rne-variables.test.ts b/utils/helpers/rne-variables/rne-variables.test.ts index 33bb4a9cb..c67c9d78e 100644 --- a/utils/helpers/rne-variables/rne-variables.test.ts +++ b/utils/helpers/rne-variables/rne-variables.test.ts @@ -12,9 +12,9 @@ describe('Check RNE variables helpers', () => { }); test('Succeeds with valid inputs', () => { - expect(getCapital(10, '£', true)).toBe('10 £ variable'); - expect(getCapital(1000000, '€', false)).toBe('1000000 € fixe'); - expect(getCapital(10, 'POUNDS', true)).toBe('10 POUNDS variable'); + expect(getCapital(10, '£', true)).toBe('10 £ (variable)'); + expect(getCapital(1000000, '€', false)).toBe('1000000 € (fixe)'); + expect(getCapital(10, 'POUNDS', true)).toBe('10 POUNDS (variable)'); }); }); From 937302df244e446cb1517b9b28528f6fead855ec Mon Sep 17 00:00:00 2001 From: Xavier Jp <xavier.jouppe@beta.gouv.fr> Date: Mon, 2 Sep 2024 13:32:09 +0200 Subject: [PATCH 09/16] Update app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx Co-authored-by: Hajar AEK <48837850+HAEKADI@users.noreply.github.com> Signed-off-by: Xavier Jp <xajouppe@gmail.com> --- .../entreprise/[slug]/_components/inscriptions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx index 00e4a84e5..143fd4eaa 100644 --- a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx @@ -186,7 +186,7 @@ export const UniteLegaleInscriptionRNA = ({ > <InformationTooltip tabIndex={undefined} - label="Cette structure est inscrite au Registre National des Association (RNA)." + label="Cette structure est inscrite au Registre National des Associations (RNA)." > <a href="#association-section"> <OpenClosedTag From 642778b29a48086d5d99b5824059ffc8bc22fc40 Mon Sep 17 00:00:00 2001 From: Xavier Jp <xavier.jouppe@beta.gouv.fr> Date: Mon, 2 Sep 2024 13:32:20 +0200 Subject: [PATCH 10/16] Update data/faq/registre-des-beneficiaires-effectifs.yml Co-authored-by: Hajar AEK <48837850+HAEKADI@users.noreply.github.com> Signed-off-by: Xavier Jp <xajouppe@gmail.com> --- data/faq/registre-des-beneficiaires-effectifs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/faq/registre-des-beneficiaires-effectifs.yml b/data/faq/registre-des-beneficiaires-effectifs.yml index be773164d..967be8fa6 100644 --- a/data/faq/registre-des-beneficiaires-effectifs.yml +++ b/data/faq/registre-des-beneficiaires-effectifs.yml @@ -29,7 +29,7 @@ body: | - nom, prénoms, pseudonyme et nom d'usage - mois et année de naissance - pays de résidence et nationalité - - nature et modalité de controle détenus par le bénéficiaire + - nature et modalité de contrôle détenus par le bénéficiaire ## Comment peut-on accéder au RBE à partir du 31 juillet 2024 ? From 01bff363cb8a049710a362f617db0c00feb0cace Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Thu, 5 Sep 2024 16:00:23 +0200 Subject: [PATCH 11/16] feat: use button rather than links for download --- .../_components/justificatifs/insee.tsx | 2 +- .../[slug]/_components/inscriptions.tsx | 26 ++++++++----------- .../[slug]/_components/summary-section.tsx | 13 +++++++++- components-ui/faq-link/index.tsx | 2 +- components/etablissement-section/index.tsx | 1 + .../avis-situation-link/index.tsx | 17 +++++++++--- .../justificatifs/extrait-rne-link/index.tsx | 14 +++++----- 7 files changed, 48 insertions(+), 27 deletions(-) diff --git a/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx b/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx index d197411ac..045da286f 100644 --- a/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx +++ b/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import ButtonLink from '#components-ui/button'; import IsActiveTag from '#components-ui/is-active-tag'; import { Tag } from '#components-ui/tag'; @@ -12,6 +11,7 @@ import { IEtablissement, IUniteLegale } from '#models/core/types'; import { EScope, hasRights } from '#models/user/rights'; import { ISession } from '#models/user/session'; import { formatSiret } from '#utils/helpers'; +import React from 'react'; const AvisSituationTable: React.FC<{ etablissements: IEtablissement[]; diff --git a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx index 00e4a84e5..16095d4cd 100644 --- a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx @@ -38,13 +38,12 @@ export const UniteLegaleInscriptionSirene = ({ return ( <Wrapper link={ - <Icon slug="download"> - <AvisSituationLink - session={session} - etablissement={uniteLegale.siege} - label="Avis de situation Sirene" - /> - </Icon> + <AvisSituationLink + session={session} + etablissement={uniteLegale.siege} + label="Avis de situation" + button={true} + /> } > <InformationTooltip @@ -119,14 +118,11 @@ export const UniteLegaleInscriptionRNE = ({ return ( <Wrapper link={ - <Icon slug="download"> - <ExtraitRNELink - uniteLegale={uniteLegale} - session={session} - label="Extrait RNE" - />{' '} - (<a href="/faq/extrait-kbis">équivalent KBIS/D1</a>) - </Icon> + <ExtraitRNELink + uniteLegale={uniteLegale} + session={session} + label="Extrait RNE" + /> } > <InformationTooltip diff --git a/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx b/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx index 8854f0812..13885c14f 100644 --- a/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx @@ -39,7 +39,18 @@ const UniteLegaleSummarySection: React.FC<{ const data = [ [ - 'État des inscriptions', + <FAQLink tooltipLabel="État des inscriptions"> + Toutes les structures référencées sur notre site sont inscrites à un ou + plusieurs référentiels publics (base Sirene, RNE, RNA). + <br /> + <br /> + {uniteLegale.dateMiseAJourInpi && ( + <> + L’Extrait RNE est le justificatif d’immatriculation de l’entreprise. + Il contient les mêmes données qu’un extrait KBIS/D1. + </> + )} + </FAQLink>, <> <UniteLegaleInscriptionSirene uniteLegale={uniteLegale} diff --git a/components-ui/faq-link/index.tsx b/components-ui/faq-link/index.tsx index 486b66bde..2efe21113 100644 --- a/components-ui/faq-link/index.tsx +++ b/components-ui/faq-link/index.tsx @@ -5,7 +5,7 @@ import React, { PropsWithChildren } from 'react'; import styles from './style.module.css'; const FAQLink: React.FC< - PropsWithChildren<{ tooltipLabel: string; to?: string }> + PropsWithChildren<{ tooltipLabel: string | JSX.Element; to?: string }> > = ({ to, tooltipLabel, children }) => ( <InformationTooltip label={children} diff --git a/components/etablissement-section/index.tsx b/components/etablissement-section/index.tsx index c90fd508a..a7cffd5d0 100644 --- a/components/etablissement-section/index.tsx +++ b/components/etablissement-section/index.tsx @@ -157,6 +157,7 @@ const EtablissementSection: React.FC<IProps> = ({ session={session} etablissement={etablissement} label="télécharger" + button={true} /> {!usedInEntreprisePage && uniteLegale.dateMiseAJourInpi && ( <> diff --git a/components/justificatifs/avis-situation-link/index.tsx b/components/justificatifs/avis-situation-link/index.tsx index b082ec1ea..a056c249f 100644 --- a/components/justificatifs/avis-situation-link/index.tsx +++ b/components/justificatifs/avis-situation-link/index.tsx @@ -1,6 +1,7 @@ -import React from 'react'; import routes from '#clients/routes'; +import ButtonLink from '#components-ui/button'; import FAQLink from '#components-ui/faq-link'; +import { Icon } from '#components-ui/icon/wrapper'; import { estDiffusible, estNonDiffusibleProtected, @@ -9,13 +10,23 @@ import { import { IEtablissement } from '#models/core/types'; import { EScope, hasRights } from '#models/user/rights'; import { ISession } from '#models/user/session'; +import React from 'react'; const AvisSituationLink: React.FC<{ etablissement: IEtablissement; session: ISession | null; label?: string; -}> = ({ etablissement, label, session }) => { - const link = ( + button?: boolean; +}> = ({ etablissement, label, button = false, session }) => { + const link = button ? ( + <ButtonLink + small + alt + to={`${routes.sireneInsee.avis}${etablissement.siret}`} + > + <Icon slug="download">{label || 'Avis de situation'}</Icon> + </ButtonLink> + ) : ( <a target="_blank" rel="noopener noreferrer" diff --git a/components/justificatifs/extrait-rne-link/index.tsx b/components/justificatifs/extrait-rne-link/index.tsx index 79e9db500..285d27be2 100644 --- a/components/justificatifs/extrait-rne-link/index.tsx +++ b/components/justificatifs/extrait-rne-link/index.tsx @@ -1,4 +1,6 @@ import React from 'react'; +import ButtonLink from '#components-ui/button'; +import { Icon } from '#components-ui/icon/wrapper'; import { estDiffusible, nonDiffusibleDataFormatter, @@ -14,13 +16,13 @@ const ExtraitRNELink: React.FC<{ }> = ({ uniteLegale, label, session }) => { return estDiffusible(uniteLegale) || hasRights(session, EScope.nonDiffusible) ? ( - <a - target="_blank" - rel="noopener" - href={`/justificatif-immatriculation-pdf/${uniteLegale.siren}`} + <ButtonLink + small + alt + to={`/justificatif-immatriculation-pdf/${uniteLegale.siren}`} > - {label || 'télécharger'} - </a> + <Icon slug="download">{label || 'télécharger'}</Icon> + </ButtonLink> ) : ( <a href="/faq/justificatif-immatriculation-non-diffusible"> {nonDiffusibleDataFormatter('document non-diffusible')} From dacb3c087a69cf60b6795d4b31e47add252aa8cd Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Tue, 17 Sep 2024 08:44:22 +0200 Subject: [PATCH 12/16] test: add immatriculation tests e2e --- .../_components/immatriculation-section.tsx | 8 ++++- .../[slug]/_components/inscriptions.tsx | 4 +-- .../summary-section.tsx | 29 ------------------- cypress/e2e/immatriculation.cy.js | 24 +++++++++++++++ cypress/e2e/seo.cy.js | 6 ---- data/changelog.yml | 8 ++--- 6 files changed, 37 insertions(+), 42 deletions(-) create mode 100644 cypress/e2e/immatriculation.cy.js diff --git a/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx index 8099395a7..2a0e39df3 100644 --- a/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/immatriculation-section.tsx @@ -26,7 +26,7 @@ export const UniteLegaleImmatriculationSection = ({ return ( <DataSection - title="Immatricuation au RNE" + title="Immatriculation au RNE" id="immatriculation-rne" sources={[EAdministration.INPI]} data={immatriculation} @@ -98,6 +98,12 @@ export const UniteLegaleImmatriculationSection = ({ ], ] : []), + [ + 'Dirigeants', + <a href={`/dirigeants/${uniteLegale.siren}`}> + → Consulter la liste des dirigeants + </a>, + ], ] : []), ]} diff --git a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx index 41747f469..4dde7fb62 100644 --- a/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/inscriptions.tsx @@ -1,3 +1,4 @@ +import React, { PropsWithChildren } from 'react'; import { OpenClosedTag } from '#components-ui/badge/frequent'; import { Icon } from '#components-ui/icon/wrapper'; import InformationTooltip from '#components-ui/information-tooltip'; @@ -11,7 +12,6 @@ import { } from '#models/core/types'; import { ISession } from '#models/user/session'; import { formatDate } from '#utils/helpers'; -import React, { PropsWithChildren } from 'react'; import styles from './style.module.css'; const Wrapper: React.FC<PropsWithChildren<{ link: JSX.Element }>> = ({ @@ -102,7 +102,7 @@ export const UniteLegaleInscriptionRNE = ({ <InformationTooltip tabIndex={undefined} label={ - 'Cette structure est n’a pas été retrouvée sur le téléservice du Registre National des Entreprises (RNE) tenu par l’INPI. Pourtant, vu sa forme juridique, elle devrait y être inscrite. Vous pouvez essayer de la retrouver sur le site data.inpi.fr' + 'Cette structure est n’a pas été retrouvée dans le Registre National des Entreprises (RNE) tenu par l’INPI. Pourtant, vu sa forme juridique, elle devrait y être inscrite. Il peut s’agir d’une erreur ou d’un cas particulier. Vous pouvez essayer de la retrouver sur le site data.inpi.fr' } > <OpenClosedTag diff --git a/components/espace-agent-components/summary-section.tsx b/components/espace-agent-components/summary-section.tsx index aa9c62cc4..14cd99087 100644 --- a/components/espace-agent-components/summary-section.tsx +++ b/components/espace-agent-components/summary-section.tsx @@ -1,4 +1,3 @@ -import FAQLink from '#components-ui/faq-link'; import { HorizontalSeparator } from '#components-ui/horizontal-separator'; import { Icon } from '#components-ui/icon/wrapper'; import { PrintNever } from '#components-ui/print-visibility'; @@ -23,34 +22,6 @@ export const EspaceAgentSummarySection: NextPageWithLayout<IProps> = ({ <Section title="Résumé pour les agents publics" isProtected> <TwoColumnTable body={[ - [ - <FAQLink - tooltipLabel="Immatriculation au RNE" - to="https://www.inpi.fr/le-registre-national-des-entreprises" - > - Depuis le 1er Janvier 2023, toute entreprise exerçant sur le - territoire français (sauf Polynésie française, - Nouvelle-Calédonie et Wallis et Futuna) une activité de nature - commerciale, artisanale, agricole ou indépendante est - enregistrée au RNE. - </FAQLink>, - <a - href={`/justificatif-immatriculation-pdf/${uniteLegale.siren}`} - > - <Icon slug="download"> - Télécharger l’extrait d’immatriculation au RNE - </Icon> - </a>, - ], - [ - '', - - <a href={`/dirigeants/${uniteLegale.siren}`}> - → Consulter la page dirigeants & le registre des bénéficiaires - effectifs - </a>, - ], - ['', <br />], [ 'Documents juridiques', <a href={`/documents/${uniteLegale.siren}#actes`}> diff --git a/cypress/e2e/immatriculation.cy.js b/cypress/e2e/immatriculation.cy.js new file mode 100644 index 000000000..dc607aa09 --- /dev/null +++ b/cypress/e2e/immatriculation.cy.js @@ -0,0 +1,24 @@ +describe('Immatriculation RNE', () => { + // danone + it('Should display immatriculation', () => { + cy.visit('/entreprise/552032534'); + cy.contains('Immatriculée au RNE'); + cy.contains('99 ans, jusqu’au 01/03/2054'); + }); + + it('Should display immatriculation even for non diffusible', () => { + cy.visit(`/entreprise/300025764`); + cy.contains('Immatriculée au RNE'); + cy.contains('Gestion de biens, Libérale non réglementée'); + }); + + it('Should display immatriculation even for closed structure', () => { + cy.visit(`/entreprise/880878145`); + cy.contains('Radiée au RNE'); + cy.contains('99 ans, jusqu’au 23/01/2119'); + }); + + it('Should display warning when not found in RNE', () => {}); + cy.visit(`/entreprise/356000000`); + cy.contains('Non trouvée dans le RNE'); +}); diff --git a/cypress/e2e/seo.cy.js b/cypress/e2e/seo.cy.js index 1792e0ea6..fa09ddb4e 100644 --- a/cypress/e2e/seo.cy.js +++ b/cypress/e2e/seo.cy.js @@ -37,12 +37,6 @@ describe('SEO Index or noindex', () => { cy.get('meta[name="robots"][content*="follow"]').should('have.length', 1); }); - it('cannot index justificatif page', () => { - cy.visit(`/justificatif/356000000`); - cy.get('meta[name="robots"][content*="noindex"]').should('have.length', 1); - cy.get('meta[name="robots"][content*="follow"]').should('have.length', 1); - }); - it('cannot index closed entreprise page', () => { cy.visit(`/entreprise/839517323`); cy.get('meta[name="robots"][content*="noindex"]').should('have.length', 1); diff --git a/data/changelog.yml b/data/changelog.yml index 7f5ebbe5f..5e9ee2ff5 100644 --- a/data/changelog.yml +++ b/data/changelog.yml @@ -15,11 +15,11 @@ target: site: true body: | - L’onglet justificatif disparait ! Les informations qu’il contenait sont toujours présentes mais changent de place : + L’onglet **justificatif** disparait ! Les informations qu’il contenait ont été réparties dans les autres onglets. L’objectif est d'afficher dès la première page certaines informations essentielles (capital social, nature d’entreprise) et d'alléger l’interface : - - les information d’immatriculation au RNE (date d’immatriculation, capital social, nature d'entreprise) sont déplacées dans l’onglet “Fiche résumé” - - les justificatifs d’existence (annonce JOAFE, avis Sirene ou extrait RNE) sont déplacés dans l’onglet “Documents” - - les observations au RNE (uniquement pour les entreprises) sont déplacées dans l’onglet “Annonces”, renommé “Annonces & observations” + - les information d’immatriculation au RNE (date d’immatriculation, capital social, nature d'entreprise) sont déplacées dans l’onglet **Fiche résumé** + - les justificatifs d’existence (annonce JOAFE, avis Sirene ou extrait RNE) sont déplacés dans l’onglet **Documents** + - les observations au RNE (uniquement pour les entreprises) sont déplacées dans l’onglet **Annonces**, renommé **Annonces & observations** - date: 31/07/2024 target: agent: true From 01b8d25347f453e014b7f8a10c0a09a7593cb881 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Tue, 17 Sep 2024 08:46:13 +0200 Subject: [PATCH 13/16] chore: import order --- .../documents/[slug]/_components/justificatifs/insee.tsx | 2 +- app/(header-default)/elus/_component/section/elus-section.tsx | 2 +- .../entreprise/[slug]/_components/summary-section.tsx | 2 +- app/(header-default)/entreprise/[slug]/page.tsx | 2 +- pages/personne/index.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx b/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx index 045da286f..d197411ac 100644 --- a/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx +++ b/app/(header-default)/documents/[slug]/_components/justificatifs/insee.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import ButtonLink from '#components-ui/button'; import IsActiveTag from '#components-ui/is-active-tag'; import { Tag } from '#components-ui/tag'; @@ -11,7 +12,6 @@ import { IEtablissement, IUniteLegale } from '#models/core/types'; import { EScope, hasRights } from '#models/user/rights'; import { ISession } from '#models/user/session'; import { formatSiret } from '#utils/helpers'; -import React from 'react'; const AvisSituationTable: React.FC<{ etablissements: IEtablissement[]; diff --git a/app/(header-default)/elus/_component/section/elus-section.tsx b/app/(header-default)/elus/_component/section/elus-section.tsx index a00adc028..48e93f52b 100644 --- a/app/(header-default)/elus/_component/section/elus-section.tsx +++ b/app/(header-default)/elus/_component/section/elus-section.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import NonRenseigne from '#components/non-renseigne'; import { Section } from '#components/section'; import { FullTable } from '#components/table/full'; @@ -5,7 +6,6 @@ import { EAdministration } from '#models/administrations/EAdministration'; import { isCollectiviteTerritoriale, IUniteLegale } from '#models/core/types'; import { IEtatCivil } from '#models/rne/types'; import { capitalize, formatDatePartial } from '#utils/helpers'; -import React from 'react'; /** * Elus section diff --git a/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx b/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx index 13885c14f..05a7ed1a5 100644 --- a/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx +++ b/app/(header-default)/entreprise/[slug]/_components/summary-section.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import FAQLink from '#components-ui/faq-link'; import { ConventionCollectivesBadgesSection } from '#components/badges-section/convention-collectives'; import { ProtectedCertificatesBadgesSection } from '#components/badges-section/labels-and-certificates/protected-certificats'; @@ -17,7 +18,6 @@ import { ISession } from '#models/user/session'; import { formatDate, formatIntFr, formatSiret } from '#utils/helpers'; import { libelleCategorieEntreprise } from '#utils/helpers/formatting/categories-entreprise'; import { libelleTrancheEffectif } from '#utils/helpers/formatting/codes-effectifs'; -import React from 'react'; import { LabelsAndCertificatesBadgesSection, checkHasLabelsAndCertificates, diff --git a/app/(header-default)/entreprise/[slug]/page.tsx b/app/(header-default)/entreprise/[slug]/page.tsx index 0ba71718e..958f62a5d 100644 --- a/app/(header-default)/entreprise/[slug]/page.tsx +++ b/app/(header-default)/entreprise/[slug]/page.tsx @@ -1,3 +1,4 @@ +import { Metadata } from 'next'; import { HorizontalSeparator } from '#components-ui/horizontal-separator'; import AssociationSection from '#components/association-section'; import CollectiviteTerritorialeSection from '#components/collectivite-territoriale-section'; @@ -29,7 +30,6 @@ import extractParamsAppRouter, { import getSession from '#utils/server-side-helper/app/get-session'; import { UniteLegaleImmatriculationSection } from 'app/(header-default)/entreprise/[slug]/_components/immatriculation-section'; import UniteLegaleSummarySection from 'app/(header-default)/entreprise/[slug]/_components/summary-section'; -import { Metadata } from 'next'; export const generateMetadata = async ( props: AppRouterProps diff --git a/pages/personne/index.tsx b/pages/personne/index.tsx index 7e806ec05..5ac744d07 100644 --- a/pages/personne/index.tsx +++ b/pages/personne/index.tsx @@ -1,3 +1,4 @@ +import { GetServerSideProps } from 'next'; import { Info } from '#components-ui/alerts'; import { HorizontalSeparator } from '#components-ui/horizontal-separator'; import Meta from '#components/meta/meta-client'; @@ -18,7 +19,6 @@ import { IPropsWithMetadata, postServerSideProps, } from '#utils/server-side-helper/page/post-server-side-props'; -import { GetServerSideProps } from 'next'; import { NextPageWithLayout } from 'pages/_app'; interface IProps extends IPropsWithMetadata { From 8f796e6fe84a2bedd5c8a32e57a28b18b0d451a6 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Tue, 17 Sep 2024 15:09:10 +0200 Subject: [PATCH 14/16] chore: e2e snaps --- .../_snapshots/siren-883010316.json | 2 +- .../_snapshots/siren-908595879.json | 2 +- .../_snapshots/protected.json | 27 ++- .../_snapshots/rge.json | 61 ++++--- .../_snapshots/CA-resultat-filter.json | 13 +- .../_snapshots/colter.json | 12 +- .../_snapshots/search-130025265.json | 3 +- .../_snapshots/search-198100125.json | 3 +- .../_snapshots/search-217500016.json | 3 +- .../_snapshots/search-487444697.json | 5 +- .../_snapshots/search-48744469700428.json | 5 +- .../_snapshots/search-552032534.json | 14 +- .../_snapshots/search-800329849.json | 3 +- .../_snapshots/search-843701079.json | 4 +- .../_snapshots/search-880878145.json | 4 +- .../_snapshots/search-88087814500015.json | 4 +- .../_snapshots/search-883010316.json | 4 +- .../_snapshots/search-908595879.json | 4 +- .../_snapshots/search-xavier jouppe.json | 12 +- .../_snapshots/siren-300025764.json | 159 +++++------------- .../_snapshots/siren-883010316.json | 11 +- .../_snapshots/siren-908595879.json | 9 +- cypress/e2e/immatriculation.cy.js | 7 +- 23 files changed, 177 insertions(+), 194 deletions(-) diff --git a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json index f20b2b00a..6d3db80f5 100644 --- a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json +++ b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json @@ -16,7 +16,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-08-21T14:06:59.440Z", + "dateDerniereMiseAJour": "2024-09-17T13:08:36.970Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", diff --git a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json index 5fab651fb..cf4a1fd41 100644 --- a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json +++ b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json @@ -16,7 +16,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-08-21T14:06:59.405Z", + "dateDerniereMiseAJour": "2024-09-17T13:08:36.906Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, diff --git a/clients/_test/clientRNEImmatriculation/_snapshots/protected.json b/clients/_test/clientRNEImmatriculation/_snapshots/protected.json index e4813a02c..6bde453a6 100644 --- a/clients/_test/clientRNEImmatriculation/_snapshots/protected.json +++ b/clients/_test/clientRNEImmatriculation/_snapshots/protected.json @@ -3,19 +3,19 @@ "908595879" ], "result": { - "siren": "908595879", - "identite": { - "denomination": "SEVERNAYA", + "observations": [], + "immatriculation": { + "natureEntreprise": [ + "Commerciale" + ], "dateImmatriculation": "2021-12-27", - "dateDebutActiv": "2022-01-01", + "dateDebutActivite": "2022-01-01", "dateRadiation": "", - "dateCessationActivite": "", + "dateFin": "27/12/2120", "isPersonneMorale": true, - "dateClotureExercice": "3112", - "dureePersonneMorale": 99, - "capital": "1 000 EUR (fixe)", - "libelleNatureJuridique": "SAS, société par actions simplifiée", - "natureEntreprise": "Commerciale" + "dateCloture": "3112", + "duree": 99, + "capital": "1 000 EUR (fixe)" }, "dirigeants": [ { @@ -25,11 +25,6 @@ "dateNaissancePartial": "1985-12", "dateNaissanceFull": "" } - ], - "beneficiaires": [], - "observations": [], - "metadata": { - "isFallback": false - } + ] } } \ No newline at end of file diff --git a/clients/_test/clientRNEImmatriculation/_snapshots/rge.json b/clients/_test/clientRNEImmatriculation/_snapshots/rge.json index f3cbcf381..fe83c2805 100644 --- a/clients/_test/clientRNEImmatriculation/_snapshots/rge.json +++ b/clients/_test/clientRNEImmatriculation/_snapshots/rge.json @@ -3,35 +3,6 @@ "487444697" ], "result": { - "siren": "487444697", - "identite": { - "dateImmatriculation": null, - "dateDebutActiv": "2005-12-06", - "dateRadiation": null, - "dateCessationActivite": null, - "denomination": "ESSOR ENERGIES", - "dureePersonneMorale": null, - "dateClotureExercice": "3112", - "capital": "2099975 EUR", - "isPersonneMorale": true, - "libelleNatureJuridique": "SARL, Société à responsabilité limitée (sans autre indication)", - "natureEntreprise": "Commerciale, Artisanale, Gestion de biens" - }, - "dirigeants": [ - { - "nom": "POUYANNE", - "prenom": "DAVID, JEAN-CLAUDE", - "role": "Gérant", - "dateNaissancePartial": "1965-10" - }, - { - "nom": "POUYANNE (POUYANNE)", - "prenom": "DAVID, JEAN, CLAUDE", - "role": "Gérant", - "dateNaissancePartial": "1965-10" - } - ], - "beneficiaires": [], "observations": [ { "numObservation": "F24/001909", @@ -59,8 +30,34 @@ "description": "Radiation du RCS de Bordeaux le 07/03/2023" } ], - "metadata": { - "isFallback": true - } + "immatriculation": { + "natureEntreprise": [ + "Commerciale", + "Artisanale", + "Gestion de biens" + ], + "dateImmatriculation": null, + "dateDebutActivite": "2005-12-06", + "dateRadiation": null, + "dateFin": "", + "isPersonneMorale": true, + "dateCloture": "3112", + "duree": null, + "capital": "2099975 EUR" + }, + "dirigeants": [ + { + "nom": "POUYANNE", + "prenom": "DAVID, JEAN-CLAUDE", + "role": "Gérant", + "dateNaissancePartial": "1965-10" + }, + { + "nom": "POUYANNE (POUYANNE)", + "prenom": "DAVID, JEAN, CLAUDE", + "role": "Gérant", + "dateNaissancePartial": "1965-10" + } + ] } } \ 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 1cff2aa2c..26b3acfc0 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/CA-resultat-filter.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/CA-resultat-filter.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "ganymede", "searchFilterParams": "&ca_min=100&resultat_net_max=100000" }, @@ -189,6 +189,7 @@ "listeIdcc": [ "0478" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "414971929", @@ -313,6 +314,7 @@ "prenom": "Charles", "prenoms": "Charles", "role": "Directeur Général", + "nationalite": "Française", "dateNaissancePartial": "1944-05", "lieuNaissance": "" }, @@ -322,6 +324,7 @@ "prenom": "Olivier", "prenoms": "Olivier", "role": "Commissaire aux comptes suppléant", + "nationalite": "Française", "dateNaissancePartial": "1971-11", "lieuNaissance": "" }, @@ -509,6 +512,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, @@ -519,6 +523,7 @@ "prenom": "Franck", "prenoms": "Franck", "role": "Gérant", + "nationalite": "Française", "dateNaissancePartial": "1952-06", "lieuNaissance": "" } @@ -696,6 +701,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [ { "siren": "491470597", @@ -744,6 +750,7 @@ "prenom": "Dominique", "prenoms": "Dominique", "role": "Gérant", + "nationalite": "Française", "dateNaissancePartial": "1964-10", "lieuNaissance": "" } @@ -933,6 +940,7 @@ "1596", "2609" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "800069130", @@ -984,6 +992,7 @@ "prenom": "Suat", "prenoms": "Suat", "role": "Gérant", + "nationalite": "Turque", "dateNaissancePartial": "1980-08", "lieuNaissance": "" } @@ -1169,6 +1178,7 @@ "listeIdcc": [ "1527" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "852504034", @@ -1219,6 +1229,7 @@ "prenom": "Eric", "prenoms": "Eric", "role": "Président de SAS", + "nationalite": "Française", "dateNaissancePartial": "1947-09", "lieuNaissance": "" } diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/colter.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/colter.json index 1eab5fc96..c8e3d4441 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/colter.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/colter.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "", "searchFilterParams": "&est_rge=true&est_collectivite_territoriale=true" }, @@ -776,6 +776,7 @@ "2149", "5021" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "200036473", @@ -1575,6 +1576,7 @@ "5021", "9999" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "226300010", @@ -2296,6 +2298,7 @@ "listeIdcc": [ "5021" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "223100017", @@ -3688,6 +3691,7 @@ "9999", "5021" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "200035715", @@ -4538,6 +4542,7 @@ "1486", "5021" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "200071827", @@ -5243,6 +5248,7 @@ "listeIdcc": [ "5021" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "200069383", @@ -5810,6 +5816,7 @@ "listeIdcc": [ "9999" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "244400503", @@ -6320,6 +6327,7 @@ "9999", "5021" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "241700624", @@ -7052,6 +7060,7 @@ "listeIdcc": [ "5021" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "243400769", @@ -7685,6 +7694,7 @@ "listeIdcc": [ "5021" ], + "immatriculation": null, "matchingEtablissements": [ { "siren": "200018406", diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-130025265.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-130025265.json index 05fb148d1..31605f717 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-130025265.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-130025265.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "130025265", "searchFilterParams": "" }, @@ -181,6 +181,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-198100125.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-198100125.json index b51f72857..173d45935 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-198100125.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-198100125.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "198100125", "searchFilterParams": "" }, @@ -195,6 +195,7 @@ "listeIdcc": [ "9999" ], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-217500016.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-217500016.json index 2012f373b..7351c20a0 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-217500016.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-217500016.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "217500016", "searchFilterParams": "" }, @@ -1682,6 +1682,7 @@ "1043", "9999" ], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 3012, "nombreEtablissementsOuverts": 2904, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json index 88a74eaa4..8134a8003 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "487444697", "searchFilterParams": "" }, @@ -187,6 +187,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 42, "nombreEtablissementsOuverts": 29, @@ -197,6 +198,7 @@ "prenom": "David", "prenoms": "David, Jean, Claude", "role": null, + "nationalite": null, "dateNaissancePartial": "1965-10", "lieuNaissance": "" }, @@ -206,6 +208,7 @@ "prenom": "David", "prenoms": "David, Jean-claude", "role": "Gérant", + "nationalite": "Française", "dateNaissancePartial": "1965-10", "lieuNaissance": "" } diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json index b1e73a1e9..e9dcc485e 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "48744469700428", "searchFilterParams": "" }, @@ -187,6 +187,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [ { "siren": "487444697", @@ -237,6 +238,7 @@ "prenom": "David", "prenoms": "David, Jean, Claude", "role": null, + "nationalite": null, "dateNaissancePartial": "1965-10", "lieuNaissance": "" }, @@ -246,6 +248,7 @@ "prenom": "David", "prenoms": "David, Jean-claude", "role": "Gérant", + "nationalite": "Française", "dateNaissancePartial": "1965-10", "lieuNaissance": "" } diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json index f03ff36ea..70bf00754 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "552032534", "searchFilterParams": "" }, @@ -195,6 +195,7 @@ "listeIdcc": [ "9999" ], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 17, "nombreEtablissementsOuverts": 2, @@ -205,6 +206,7 @@ "prenom": "Antoine", "prenoms": "Antoine", "role": "Directeur Général", + "nationalite": "Française", "dateNaissancePartial": "1964-12", "lieuNaissance": "" }, @@ -214,6 +216,7 @@ "prenom": "Frederic", "prenoms": "Frederic", "role": "Administrateur", + "nationalite": "Française", "dateNaissancePartial": "1967-08", "lieuNaissance": "" }, @@ -223,6 +226,7 @@ "prenom": "Valerie", "prenoms": "Valerie", "role": "Administrateur", + "nationalite": "Française", "dateNaissancePartial": "1962-11", "lieuNaissance": "" }, @@ -232,6 +236,7 @@ "prenom": "Gilbert", "prenoms": "Gilbert", "role": "Administrateur", + "nationalite": "Canadienne", "dateNaissancePartial": "1960-02", "lieuNaissance": "" }, @@ -241,6 +246,7 @@ "prenom": "Lise", "prenoms": "Lise", "role": "Administrateur", + "nationalite": "Danoise", "dateNaissancePartial": "1961-08", "lieuNaissance": "" }, @@ -250,6 +256,7 @@ "prenom": "Patrice", "prenoms": "Patrice", "role": "Administrateur", + "nationalite": "Américaine", "dateNaissancePartial": "1964-09", "lieuNaissance": "" }, @@ -259,6 +266,7 @@ "prenom": "Sanjiv", "prenoms": "Sanjiv", "role": "Administrateur", + "nationalite": "Indienne", "dateNaissancePartial": "1960-07", "lieuNaissance": "" }, @@ -268,6 +276,7 @@ "prenom": "Bettina", "prenoms": "Bettina", "role": "Administrateur", + "nationalite": null, "dateNaissancePartial": "1962-07", "lieuNaissance": "" }, @@ -277,6 +286,7 @@ "prenom": "Geraldine", "prenoms": "Geraldine", "role": "Administrateur", + "nationalite": "Française", "dateNaissancePartial": "1970-02", "lieuNaissance": "" }, @@ -286,6 +296,7 @@ "prenom": "Susan-barbara", "prenoms": "Susan-barbara", "role": "Administrateur", + "nationalite": "Britannique", "dateNaissancePartial": "1957-05", "lieuNaissance": "" }, @@ -295,6 +306,7 @@ "prenom": "Gilles", "prenoms": "Gilles", "role": "Administrateur", + "nationalite": "Française", "dateNaissancePartial": "1958-10", "lieuNaissance": "" }, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-800329849.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-800329849.json index e5d920382..a24425d2f 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-800329849.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-800329849.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "800329849", "searchFilterParams": "" }, @@ -189,6 +189,7 @@ "listeIdcc": [ "3090" ], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 2, "nombreEtablissementsOuverts": 1, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json index 77b4e5125..c4738fe87 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "843701079", "searchFilterParams": "" }, @@ -223,6 +223,7 @@ "2609", "1596" ], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, @@ -233,6 +234,7 @@ "prenom": "Lionel", "prenoms": "Lionel, Andre", "role": null, + "nationalite": null, "dateNaissancePartial": "1981-04", "lieuNaissance": "" } diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json index 00247c4a0..6824df253 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "880878145", "searchFilterParams": "" }, @@ -181,6 +181,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 0, @@ -191,6 +192,7 @@ "prenom": "Xavier", "prenoms": "Xavier, Marie, Erwan", "role": "Liquidateur", + "nationalite": "Française", "dateNaissancePartial": "1990-02", "lieuNaissance": "" } diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json index b4f7c097b..adc99dabb 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "88087814500015", "searchFilterParams": "" }, @@ -181,6 +181,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [ { "siren": "880878145", @@ -229,6 +230,7 @@ "prenom": "Xavier", "prenoms": "Xavier, Marie, Erwan", "role": "Liquidateur", + "nationalite": "Française", "dateNaissancePartial": "1990-02", "lieuNaissance": "" } diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json index 1125a9eca..56104de19 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "883010316", "searchFilterParams": "" }, @@ -181,6 +181,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 0, @@ -191,6 +192,7 @@ "prenom": "Raphael", "prenoms": "Raphael", "role": null, + "nationalite": null, "dateNaissancePartial": null, "lieuNaissance": "" } diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json index f3a307f28..6df03e465 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "908595879", "searchFilterParams": "" }, @@ -189,6 +189,7 @@ "listeIdcc": [ "9999" ], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, @@ -199,6 +200,7 @@ "prenom": "Pierre", "prenoms": "Pierre", "role": "Président de SAS", + "nationalite": "Française", "dateNaissancePartial": "1985-12", "lieuNaissance": "" } diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json index a7aabecd3..6e22e6e93 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json @@ -1,6 +1,6 @@ { "args": { - "page": 1, + "pageResultatsRecherche": 1, "searchTerms": "xavier jouppe", "searchFilterParams": "" }, @@ -181,6 +181,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, @@ -191,6 +192,7 @@ "prenom": "Marie-christine", "prenoms": "Marie-christine, Germaine, Odette", "role": "Gérant et associé indéfiniment responsable", + "nationalite": "Française", "dateNaissancePartial": "1964-03", "lieuNaissance": "" }, @@ -200,6 +202,7 @@ "prenom": "Bernard", "prenoms": "Bernard", "role": "Gérant et associé indéfiniment responsable", + "nationalite": "Française", "dateNaissancePartial": "1961-06", "lieuNaissance": "" }, @@ -209,6 +212,7 @@ "prenom": "Guillaume", "prenoms": "Guillaume", "role": "Associé indéfiniment responsable", + "nationalite": "Française", "dateNaissancePartial": "1988-05", "lieuNaissance": "" }, @@ -218,6 +222,7 @@ "prenom": "Jean-brieuc", "prenoms": "Jean-brieuc", "role": "Associé indéfiniment responsable", + "nationalite": "Française", "dateNaissancePartial": "1996-10", "lieuNaissance": "" }, @@ -227,6 +232,7 @@ "prenom": "Mayeul", "prenoms": "Mayeul", "role": "Associé indéfiniment responsable", + "nationalite": "Française", "dateNaissancePartial": "1992-02", "lieuNaissance": "" }, @@ -236,6 +242,7 @@ "prenom": "Sigolene", "prenoms": "Sigolene", "role": "Associé indéfiniment responsable", + "nationalite": "Française", "dateNaissancePartial": "1995-06", "lieuNaissance": "" }, @@ -245,6 +252,7 @@ "prenom": "Xavier", "prenoms": "Xavier", "role": "Associé indéfiniment responsable", + "nationalite": "Française", "dateNaissancePartial": "1990-02", "lieuNaissance": "" } @@ -422,6 +430,7 @@ "codeColter": null }, "listeIdcc": [], + "immatriculation": null, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 0, @@ -432,6 +441,7 @@ "prenom": "Xavier", "prenoms": "Xavier, Marie, Erwan", "role": "Liquidateur", + "nationalite": "Française", "dateNaissancePartial": "1990-02", "lieuNaissance": "" } diff --git a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json index 49cfb72fc..6853f7cd1 100644 --- a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json +++ b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json @@ -36,7 +36,8 @@ "idOrganismeFormation": [], "idRge": [], "idUai": [] - } + }, + "ancienSiege": false }, "tva": null, "anciensSiegesSirets": [ @@ -45,71 +46,34 @@ ], "statutDiffusion": "partiellement diffusible", "etatAdministratif": "en activité", - "nomComplet": "Michel SAUVAGE", + "nomComplet": "M 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", + "oldSiret": "", + "etatAdministratif": "inconnu", + "statutDiffusion": "diffusible", "estSiege": true, - "enseigne": "", - "denomination": "", + "enseigne": null, + "denomination": null, "nic": "00048", - "dateCreation": "2019-12-23", - "dateDerniereMiseAJour": "2024-08-14T13:22:05.174Z", - "dateMiseAJourInsee": "2024-03-30T00:23:00.551", + "dateCreation": "2019-12-31", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", "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, + "dateFermeture": "", + "adresse": "", + "adressePostale": "", + "codePostal": "", + "commune": "", + "activitePrincipale": "", + "libelleActivitePrincipale": "", + "trancheEffectif": "", "libelleTrancheEffectif": "", "latitude": "", "longitude": "", @@ -122,33 +86,34 @@ "idRge": [], "idUai": [] }, - "anneeTrancheEffectif": null, "ancienSiege": false } ], - "open": [ + "open": [], + "unknown": [], + "closed": [ { "siren": "300025764", "siret": "30002576400048", - "oldSiret": "30002576400048", - "etatAdministratif": "en activité", - "statutDiffusion": "partiellement diffusible", + "oldSiret": "", + "etatAdministratif": "inconnu", + "statutDiffusion": "diffusible", "estSiege": true, - "enseigne": "", - "denomination": "", + "enseigne": null, + "denomination": null, "nic": "00048", - "dateCreation": "2019-12-23", - "dateDerniereMiseAJour": "2024-08-14T13:22:05.174Z", - "dateMiseAJourInsee": "2024-03-30T00:23:00.551", + "dateCreation": "2019-12-31", + "dateDerniereMiseAJour": "", + "dateMiseAJourInsee": "", "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, + "dateFermeture": "", + "adresse": "", + "adressePostale": "", + "codePostal": "", + "commune": "", + "activitePrincipale": "", + "libelleActivitePrincipale": "", + "trancheEffectif": "", "libelleTrancheEffectif": "", "latitude": "", "longitude": "", @@ -161,52 +126,11 @@ "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, + "nombreEtablissementsOuverts": 0, + "nombreEtablissements": 1, "usePagination": false, "currentEtablissementPage": 1 }, @@ -246,6 +170,7 @@ "colter": { "codeColter": null }, - "listeIdcc": [] + "listeIdcc": [], + "immatriculation": null } } \ 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 4f64df852..1a35b220c 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-21T14:06:59.627Z", + "dateDerniereMiseAJour": "2024-09-17T13:08:37.208Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", @@ -43,7 +43,7 @@ "anciensSiegesSirets": [], "statutDiffusion": "diffusible", "etatAdministratif": "cessée", - "nomComplet": "Raphael DUBIGNY", + "nomComplet": "R DUBIGNY", "chemin": "883010316", "natureJuridique": "1000", "libelleNatureJuridique": "Entrepreneur individuel", @@ -60,7 +60,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-08-21T14:06:59.627Z", + "dateDerniereMiseAJour": "2024-09-17T13:08:37.209Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", @@ -101,7 +101,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-08-21T14:06:59.627Z", + "dateDerniereMiseAJour": "2024-09-17T13:08:37.209Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", @@ -169,6 +169,7 @@ "colter": { "codeColter": null }, - "listeIdcc": [] + "listeIdcc": [], + "immatriculation": null } } \ No newline at end of file diff --git a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-908595879.json b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-908595879.json index a3d714ace..f7dfeaa0b 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-21T14:06:59.518Z", + "dateDerniereMiseAJour": "2024-09-17T13:08:36.965Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, @@ -60,7 +60,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-08-21T14:06:59.545Z", + "dateDerniereMiseAJour": "2024-09-17T13:08:37.091Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, @@ -99,7 +99,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-08-21T14:06:59.545Z", + "dateDerniereMiseAJour": "2024-09-17T13:08:37.091Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, @@ -169,6 +169,7 @@ "colter": { "codeColter": null }, - "listeIdcc": [] + "listeIdcc": [], + "immatriculation": null } } \ No newline at end of file diff --git a/cypress/e2e/immatriculation.cy.js b/cypress/e2e/immatriculation.cy.js index dc607aa09..65062ff85 100644 --- a/cypress/e2e/immatriculation.cy.js +++ b/cypress/e2e/immatriculation.cy.js @@ -18,7 +18,8 @@ describe('Immatriculation RNE', () => { cy.contains('99 ans, jusqu’au 23/01/2119'); }); - it('Should display warning when not found in RNE', () => {}); - cy.visit(`/entreprise/356000000`); - cy.contains('Non trouvée dans le RNE'); + it('Should display warning when not found in RNE', () => { + cy.visit(`/entreprise/356000000`); + cy.contains('Non trouvée dans le RNE'); + }); }); From 41d9edd4a2f22752b62ece77e3ce1882e3495902 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Tue, 17 Sep 2024 15:11:27 +0200 Subject: [PATCH 15/16] chore: fix certif phone number --- cypress/e2e/certifications.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/certifications.cy.js b/cypress/e2e/certifications.cy.js index c0a14bd05..4246a7f18 100644 --- a/cypress/e2e/certifications.cy.js +++ b/cypress/e2e/certifications.cy.js @@ -12,7 +12,7 @@ describe('Certifications', () => { it('Should display company phone number', () => { cy.visit(`/labels-certificats/487444697`); - cy.contains('09 82 26 64 14'); + cy.contains('05 53 02 91 16'); }); }); describe('ESS & Spectacles vivants', () => { From 136e145e803a32d051c0e1760f4be2cebed4bc79 Mon Sep 17 00:00:00 2001 From: xavier jouppe <xajouppe@gmail.com> Date: Tue, 17 Sep 2024 15:30:12 +0200 Subject: [PATCH 16/16] test: update snaps with immat --- .../_snapshots/siren-883010316.json | 2 +- .../_snapshots/siren-908595879.json | 2 +- .../_snapshots/search-487444697.json | 16 +- .../_snapshots/search-48744469700428.json | 16 +- .../_snapshots/search-552032534.json | 14 +- .../_snapshots/search-843701079.json | 14 +- .../_snapshots/search-880878145.json | 14 +- .../_snapshots/search-88087814500015.json | 14 +- .../_snapshots/search-883010316.json | 12 +- .../_snapshots/search-908595879.json | 14 +- .../_snapshots/search-xavier jouppe.json | 28 ++- .../simpleSearch.test.ts | 1 + .../_snapshots/siren-300025764.json | 185 +++++++++++++----- .../_snapshots/siren-883010316.json | 6 +- .../_snapshots/siren-908595879.json | 6 +- 15 files changed, 272 insertions(+), 72 deletions(-) diff --git a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json index 6d3db80f5..633141f45 100644 --- a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json +++ b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-883010316.json @@ -16,7 +16,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-09-17T13:08:36.970Z", + "dateDerniereMiseAJour": "2024-09-17T13:26:52.375Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", diff --git a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json index cf4a1fd41..a5e2411d7 100644 --- a/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json +++ b/clients/_test/clientAllEtablissementsInsee/_snapshots/siren-908595879.json @@ -16,7 +16,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-09-17T13:08:36.906Z", + "dateDerniereMiseAJour": "2024-09-17T13:26:52.323Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json index 8134a8003..f1cd99248 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-487444697.json @@ -187,7 +187,21 @@ "codeColter": null }, "listeIdcc": [], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2005-12-06", + "dateRadiation": "", + "dateImmatriculation": "2005-12-12", + "duree": 99, + "dateFin": "12/12/2104", + "natureEntreprise": [ + "Gestion de biens", + "Artisanale non réglementée", + "Commerciale" + ], + "dateCloture": "3112", + "isPersonneMorale": true, + "capital": "2 099 975,00 € (fixe)" + }, "matchingEtablissements": [], "nombreEtablissements": 42, "nombreEtablissementsOuverts": 29, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json index e9dcc485e..c6db4f6bc 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-48744469700428.json @@ -187,7 +187,21 @@ "codeColter": null }, "listeIdcc": [], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2005-12-06", + "dateRadiation": "", + "dateImmatriculation": "2005-12-12", + "duree": 99, + "dateFin": "12/12/2104", + "natureEntreprise": [ + "Gestion de biens", + "Artisanale non réglementée", + "Commerciale" + ], + "dateCloture": "3112", + "isPersonneMorale": true, + "capital": "2 099 975,00 € (fixe)" + }, "matchingEtablissements": [ { "siren": "487444697", diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json index 70bf00754..3038a9235 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-552032534.json @@ -195,7 +195,19 @@ "listeIdcc": [ "9999" ], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "", + "dateRadiation": "", + "dateImmatriculation": "1955-03-01", + "duree": 99, + "dateFin": "01/03/2054", + "natureEntreprise": [ + "Commerciale" + ], + "dateCloture": "3112", + "isPersonneMorale": true, + "capital": "169 888 497,75 € (fixe)" + }, "matchingEtablissements": [], "nombreEtablissements": 17, "nombreEtablissementsOuverts": 2, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json index c4738fe87..1cce99b0d 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-843701079.json @@ -223,7 +223,19 @@ "2609", "1596" ], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2018-11-12", + "dateRadiation": "", + "dateImmatriculation": "2018-11-12", + "duree": 99, + "dateFin": "12/11/2117", + "natureEntreprise": [ + "Commerciale" + ], + "dateCloture": "3112", + "isPersonneMorale": true, + "capital": "5 000,00 € (fixe)" + }, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json index 6824df253..1c2069e62 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-880878145.json @@ -181,7 +181,19 @@ "codeColter": null }, "listeIdcc": [], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2020-01-13", + "dateRadiation": "2022-11-14", + "dateImmatriculation": "2020-01-23", + "duree": 99, + "dateFin": "23/01/2119", + "natureEntreprise": [ + "Commerciale" + ], + "dateCloture": "3112", + "isPersonneMorale": true, + "capital": "1 000,00 € (fixe)" + }, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 0, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json index adc99dabb..17e77bd49 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-88087814500015.json @@ -181,7 +181,19 @@ "codeColter": null }, "listeIdcc": [], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2020-01-13", + "dateRadiation": "2022-11-14", + "dateImmatriculation": "2020-01-23", + "duree": 99, + "dateFin": "23/01/2119", + "natureEntreprise": [ + "Commerciale" + ], + "dateCloture": "3112", + "isPersonneMorale": true, + "capital": "1 000,00 € (fixe)" + }, "matchingEtablissements": [ { "siren": "880878145", diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json index 56104de19..37ba90ef3 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-883010316.json @@ -181,7 +181,17 @@ "codeColter": null }, "listeIdcc": [], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2018-05-06", + "dateRadiation": "2020-09-01", + "dateImmatriculation": "2018-05-06", + "duree": 0, + "dateFin": "", + "natureEntreprise": [], + "dateCloture": "", + "isPersonneMorale": false, + "capital": "" + }, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 0, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json index 6df03e465..ba73b2cb4 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-908595879.json @@ -189,7 +189,19 @@ "listeIdcc": [ "9999" ], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2022-01-01", + "dateRadiation": "", + "dateImmatriculation": "2021-12-27", + "duree": 99, + "dateFin": "27/12/2120", + "natureEntreprise": [ + "Commerciale" + ], + "dateCloture": "3112", + "isPersonneMorale": true, + "capital": "1 000,00 € (fixe)" + }, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, diff --git a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json index 6e22e6e93..6acd4307c 100644 --- a/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json +++ b/clients/_test/clientSearchRechercheEntreprise/_snapshots/search-xavier jouppe.json @@ -181,7 +181,19 @@ "codeColter": null }, "listeIdcc": [], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2010-07-02", + "dateRadiation": "", + "dateImmatriculation": "2010-07-05", + "duree": 99, + "dateFin": "05/07/2109", + "natureEntreprise": [ + "Commerciale" + ], + "dateCloture": "", + "isPersonneMorale": true, + "capital": "250 000,00 € (fixe)" + }, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 1, @@ -430,7 +442,19 @@ "codeColter": null }, "listeIdcc": [], - "immatriculation": null, + "immatriculation": { + "dateDebutActivite": "2020-01-13", + "dateRadiation": "2022-11-14", + "dateImmatriculation": "2020-01-23", + "duree": 99, + "dateFin": "23/01/2119", + "natureEntreprise": [ + "Commerciale" + ], + "dateCloture": "3112", + "isPersonneMorale": true, + "capital": "1 000,00 € (fixe)" + }, "matchingEtablissements": [], "nombreEtablissements": 1, "nombreEtablissementsOuverts": 0, diff --git a/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts b/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts index b894f7e32..c01b71de8 100644 --- a/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts +++ b/clients/_test/clientSearchRechercheEntreprise/simpleSearch.test.ts @@ -41,6 +41,7 @@ function itShouldMatchSnapshotForSearch( args: [ { pageResultatsRecherche: 1, + inclureImmatriculation: true, searchFilterParams: new SearchFilterParams({}), searchTerms, }, diff --git a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json index 6853f7cd1..ddf2cfc5b 100644 --- a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json +++ b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-300025764.json @@ -6,25 +6,25 @@ "siege": { "siren": "300025764", "siret": "30002576400048", - "oldSiret": "", - "etatAdministratif": "inconnu", - "statutDiffusion": "diffusible", + "oldSiret": "30002576400048", + "etatAdministratif": "en activité", + "statutDiffusion": "partiellement diffusible", "estSiege": true, - "enseigne": null, - "denomination": null, + "enseigne": "", + "denomination": "", "nic": "00048", - "dateCreation": "2019-12-31", - "dateDerniereMiseAJour": "", - "dateMiseAJourInsee": "", + "dateCreation": "2019-12-23", + "dateDerniereMiseAJour": "2024-09-17T13:23:37.163Z", + "dateMiseAJourInsee": "2024-03-30T00:23:00.551", "dateDebutActivite": "", - "dateFermeture": "", - "adresse": "", - "adressePostale": "", - "codePostal": "", - "commune": "", - "activitePrincipale": "", - "libelleActivitePrincipale": "", - "trancheEffectif": "", + "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": "", @@ -37,7 +37,7 @@ "idRge": [], "idUai": [] }, - "ancienSiege": false + "anneeTrancheEffectif": null }, "tva": null, "anciensSiegesSirets": [ @@ -52,28 +52,65 @@ "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-09-17T13:23:37.163Z", + "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": "", - "etatAdministratif": "inconnu", - "statutDiffusion": "diffusible", + "oldSiret": "30002576400048", + "etatAdministratif": "en activité", + "statutDiffusion": "partiellement diffusible", "estSiege": true, - "enseigne": null, - "denomination": null, + "enseigne": "", + "denomination": "", "nic": "00048", - "dateCreation": "2019-12-31", - "dateDerniereMiseAJour": "", - "dateMiseAJourInsee": "", + "dateCreation": "2019-12-23", + "dateDerniereMiseAJour": "2024-09-17T13:23:37.163Z", + "dateMiseAJourInsee": "2024-03-30T00:23:00.551", "dateDebutActivite": "", - "dateFermeture": "", - "adresse": "", - "adressePostale": "", - "codePostal": "", - "commune": "", - "activitePrincipale": "", - "libelleActivitePrincipale": "", - "trancheEffectif": "", + "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": "", @@ -86,34 +123,33 @@ "idRge": [], "idUai": [] }, + "anneeTrancheEffectif": null, "ancienSiege": false } ], - "open": [], - "unknown": [], - "closed": [ + "open": [ { "siren": "300025764", "siret": "30002576400048", - "oldSiret": "", - "etatAdministratif": "inconnu", - "statutDiffusion": "diffusible", + "oldSiret": "30002576400048", + "etatAdministratif": "en activité", + "statutDiffusion": "partiellement diffusible", "estSiege": true, - "enseigne": null, - "denomination": null, + "enseigne": "", + "denomination": "", "nic": "00048", - "dateCreation": "2019-12-31", - "dateDerniereMiseAJour": "", - "dateMiseAJourInsee": "", + "dateCreation": "2019-12-23", + "dateDerniereMiseAJour": "2024-09-17T13:23:37.163Z", + "dateMiseAJourInsee": "2024-03-30T00:23:00.551", "dateDebutActivite": "", - "dateFermeture": "", - "adresse": "", - "adressePostale": "", - "codePostal": "", - "commune": "", - "activitePrincipale": "", - "libelleActivitePrincipale": "", - "trancheEffectif": "", + "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": "", @@ -126,11 +162,52 @@ "idRge": [], "idUai": [] }, + "anneeTrancheEffectif": null, "ancienSiege": false } ], - "nombreEtablissementsOuverts": 0, - "nombreEtablissements": 1, + "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-09-17T13:23:37.163Z", + "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 }, diff --git a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-883010316.json b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-883010316.json index 1a35b220c..a52c07395 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-09-17T13:08:37.208Z", + "dateDerniereMiseAJour": "2024-09-17T13:26:52.715Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", @@ -60,7 +60,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-09-17T13:08:37.209Z", + "dateDerniereMiseAJour": "2024-09-17T13:26:52.718Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", @@ -101,7 +101,7 @@ "denomination": "", "nic": "00015", "dateCreation": "2018-05-06", - "dateDerniereMiseAJour": "2024-09-17T13:08:37.209Z", + "dateDerniereMiseAJour": "2024-09-17T13:26:52.718Z", "dateMiseAJourInsee": "2024-03-30T08:06:53.621", "dateDebutActivite": "", "dateFermeture": "2020-09-01", diff --git a/clients/_test/clientUniteLegaleInsee/_snapshots/siren-908595879.json b/clients/_test/clientUniteLegaleInsee/_snapshots/siren-908595879.json index f7dfeaa0b..7607eb67c 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-09-17T13:08:36.965Z", + "dateDerniereMiseAJour": "2024-09-17T13:26:52.447Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, @@ -60,7 +60,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-09-17T13:08:37.091Z", + "dateDerniereMiseAJour": "2024-09-17T13:26:52.602Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null, @@ -99,7 +99,7 @@ "denomination": "", "nic": "00010", "dateCreation": "2022-01-01", - "dateDerniereMiseAJour": "2024-09-17T13:08:37.091Z", + "dateDerniereMiseAJour": "2024-09-17T13:26:52.602Z", "dateMiseAJourInsee": "2024-03-29T23:18:52.426", "dateDebutActivite": "", "dateFermeture": null,