diff --git a/app/controllers/administrateurs/services_controller.rb b/app/controllers/administrateurs/services_controller.rb index ba87ccdef..c025a0ff1 100644 --- a/app/controllers/administrateurs/services_controller.rb +++ b/app/controllers/administrateurs/services_controller.rb @@ -116,8 +116,14 @@ module Administrateurs @service.validate if !@service.errors.include?(:siret) - result = @service.prefill_from_siret - prefilled = result.success? ? :success : :failure + prefilled = case @service.prefill_from_siret + in [Dry::Monads::Result::Success, Dry::Monads::Result::Success] + :success + in [Dry::Monads::Result::Failure, Dry::Monads::Result::Success] | [Dry::Monads::Result::Success, Dry::Monads::Result::Failure] + :partial + else + :failure + end end siret_errors = @service.errors.where(:siret) diff --git a/app/models/concerns/prefillable_from_service_public_concern.rb b/app/models/concerns/prefillable_from_service_public_concern.rb index ba421dc49..4d7fb5f27 100644 --- a/app/models/concerns/prefillable_from_service_public_concern.rb +++ b/app/models/concerns/prefillable_from_service_public_concern.rb @@ -5,9 +5,9 @@ module PrefillableFromServicePublicConcern included do def prefill_from_siret - result = AnnuaireServicePublicService.new.(siret:) - # TODO: get organisme, … from API Entreprise - case result + result_sp = AnnuaireServicePublicService.new.(siret:) + + case result_sp in Dry::Monads::Success(data) self.nom = data[:nom] if nom.blank? self.email = data[:adresse_courriel] if email.blank? @@ -18,7 +18,19 @@ module PrefillableFromServicePublicConcern # NOOP end - result + result_api_ent = APIRechercheEntreprisesService.new.call(siret:) + case result_api_ent + in Dry::Monads::Success(data) + self.type_organisme = detect_type_organisme(data) if type_organisme.blank? + + # some services (etablissements, …) are not in service public, so we also try to prefill them with API Entreprise + self.nom = data[:nom_complet] if nom.blank? + self.adresse = data.dig(:siege, :geo_adresse) if adresse.blank? + else + # NOOP + end + + [result_sp, result_api_ent] end private @@ -45,6 +57,23 @@ module PrefillableFromServicePublicConcern end.join("\n") end + def detect_type_organisme(data) + # Cf https://recherche-entreprises.api.gouv.fr/docs/#tag/Recherche-textuelle/paths/~1search/get + type = if data.dig(:complements, :collectivite_territoriale).present? + :collectivite_territoriale + elsif data.dig(:complements, :est_association) + :association + elsif data[:section_activite_principale] == "P" + :etablissement_enseignement + elsif data[:nom_complet].match?(/MINISTERE|MINISTERIEL/) + :administration_centrale + else # we can't differentiate between operateur d'état, administration centrale and service déconcentré de l'état, set the most frequent + :service_deconcentre_de_l_etat + end + + Service.type_organismes[type] + end + def format_time(str_time) Time.zone .parse(str_time) diff --git a/app/views/administrateurs/services/_form.html.haml b/app/views/administrateurs/services/_form.html.haml index 6386655b2..f9791c198 100644 --- a/app/views/administrateurs/services/_form.html.haml +++ b/app/views/administrateurs/services/_form.html.haml @@ -11,7 +11,10 @@ .fr-mb-2w - if local_assigns[:prefilled] == :success - %p.fr-info-text Génial ! Les informations du service ont été préremplies ci-dessous. Vérifiez-les et complétez-les le cas échéant. + %p.fr-info-text Génial ! La plupart des informations du service ont été préremplies ci-dessous. Vérifiez-les et complétez-les le cas échéant. + - elsif local_assigns[:prefilled] == :partial + %p.fr-info-text + Nous avons prérempli certaines informations correspondant à ce SIRET. Complétez les autres manuellement. - elsif local_assigns[:prefilled] == :failure %p.fr-error-text Une erreur a empêché le préremplissage des informations. @@ -24,8 +27,9 @@ .fr-input-group = f.label :type_organisme, class: "fr-label" do Type d’organisme + = render EditableChamp::AsteriskMandatoryComponent.new - = f.select :type_organisme, Service.type_organismes.keys.map { |key| [ I18n.t("type_organisme.#{key}"), key] }, {}, class: 'fr-select' + = f.select :type_organisme, Service.type_organismes.keys.map { |key| [ I18n.t("type_organisme.#{key}"), key] }, { include_blank: true }, { class: "fr-select" , required: true } = render Dsfr::CalloutComponent.new(title: "Informations de contact") do |c| - c.with_body do diff --git a/spec/controllers/administrateurs/services_controller_spec.rb b/spec/controllers/administrateurs/services_controller_spec.rb index fbfb334f4..510086688 100644 --- a/spec/controllers/administrateurs/services_controller_spec.rb +++ b/spec/controllers/administrateurs/services_controller_spec.rb @@ -31,7 +31,7 @@ describe Administrateurs::ServicesController, type: :controller do end end - context 'when attempting to prefilling from unknown SIRET' do + context 'when attempting to prefilling from invalid SIRET' do let(:xhr) { true } let(:params) do { @@ -41,11 +41,29 @@ describe Administrateurs::ServicesController, type: :controller do end it "render an error" do - VCR.use_cassette('annuaire_service_public_failure_20004021000000') do + subject + expect(response.body).to include('turbo-stream') + expect(assigns[:service].nom).to be_nil + expect(assigns[:service].errors.key?(:siret)).to be_present + end + end + + context 'when attempting to prefilling from not service public SIRET' do + let(:xhr) { true } + let(:params) do + { + procedure_id: procedure.id, + service: { siret: "41816609600051" } + } + end + + it "render partial information" do + VCR.use_cassette('annuaire_service_public_success_41816609600051') do subject expect(response.body).to include('turbo-stream') - expect(assigns[:service].nom).to be_nil - expect(assigns[:service].errors.key?(:siret)).to be_present + expect(assigns[:service].nom).to eq("OCTO-TECHNOLOGY") + expect(assigns[:service].horaires).to be_nil + expect(assigns[:service].errors.key?(:siret)).not_to be_present end end end diff --git a/spec/fixtures/cassettes/annuaire_service_public_success_11004601800013.yml b/spec/fixtures/cassettes/annuaire_service_public_success_11004601800013.yml new file mode 100644 index 000000000..36a6adc39 --- /dev/null +++ b/spec/fixtures/cassettes/annuaire_service_public_success_11004601800013.yml @@ -0,0 +1,116 @@ +--- +http_interactions: +- request: + method: get + uri: https://api-lannuaire.service-public.fr/api/explore/v2.1/catalog/datasets/api-lannuaire-administration/records?where=siret:11004601800013 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - openresty + Date: + - Tue, 15 Oct 2024 16:24:17 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '33' + X-Ratelimit-Remaining: + - '999918' + X-Ratelimit-Limit: + - '1000000' + X-Ratelimit-Reset: + - '2024-10-16 00:00:00+00:00' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Vary: + - Accept-Language, Cookie, Host + Content-Language: + - fr-fr + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - POST, GET, OPTIONS + Access-Control-Max-Age: + - '1000' + Access-Control-Allow-Headers: + - Authorization, X-Requested-With, Origin, ODS-API-Analytics-App, ODS-API-Analytics-Embed-Type, + ODS-API-Analytics-Embed-Referrer, ODS-Widgets-Version, Accept + Access-Control-Expose-Headers: + - ODS-Explore-API-Deprecation, Link, X-RateLimit-Remaining, X-RateLimit-Limit, + X-RateLimit-Reset, X-RateLimit-dataset-Remaining, X-RateLimit-dataset-Limit, + X-RateLimit-dataset-Reset + Strict-Transport-Security: + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - strict-origin-when-cross-origin + Permissions-Policy: + - midi=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=() + Content-Security-Policy: + - upgrade-insecure-requests; + X-Ua-Compatible: + - IE=edge + body: + encoding: ASCII-8BIT + string: '{"total_count": 0, "results": []}' + recorded_at: Tue, 15 Oct 2024 16:24:17 GMT +- request: + method: get + uri: https://recherche-entreprises.api.gouv.fr/search?q=11004601800013 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - nginx/1.27.1 + Date: + - Tue, 15 Oct 2024 16:24:17 GMT + Content-Type: + - application/json + Content-Length: + - '3289' + Vary: + - Accept-Encoding + - Accept-Encoding + Annuaire-Entreprises-Instance-Number: + - '02' + X-Frame-Options: + - DENY + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + Access-Control-Allow-Headers: + - Content-Type + Access-Control-Allow-Origin: + - "*" + body: + encoding: ASCII-8BIT + string: !binary |- + eyJyZXN1bHRzIjpbeyJzaXJlbiI6IjExMDA0NjAxOCIsIm5vbV9jb21wbGV0IjoiTUlOSVNURVJFIERFIExBIENVTFRVUkUiLCJub21fcmFpc29uX3NvY2lhbGUiOiJNSU5JU1RFUkUgREUgTEEgQ1VMVFVSRSIsInNpZ2xlIjpudWxsL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zIjoxfQ== + recorded_at: Tue, 15 Oct 2024 16:24:17 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/cassettes/annuaire_service_public_success_19750664500013.yml b/spec/fixtures/cassettes/annuaire_service_public_success_19750664500013.yml new file mode 100644 index 000000000..66250c90b --- /dev/null +++ b/spec/fixtures/cassettes/annuaire_service_public_success_19750664500013.yml @@ -0,0 +1,120 @@ +--- +http_interactions: +- request: + method: get + uri: https://api-lannuaire.service-public.fr/api/explore/v2.1/catalog/datasets/api-lannuaire-administration/records?where=siret:19750664500013 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - openresty + Date: + - Tue, 15 Oct 2024 14:57:11 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '33' + X-Ratelimit-Remaining: + - '999997' + X-Ratelimit-Limit: + - '1000000' + X-Ratelimit-Reset: + - '2024-10-16 00:00:00+00:00' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Vary: + - Accept-Language, Cookie, Host + Content-Language: + - fr-fr + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - POST, GET, OPTIONS + Access-Control-Max-Age: + - '1000' + Access-Control-Allow-Headers: + - Authorization, X-Requested-With, Origin, ODS-API-Analytics-App, ODS-API-Analytics-Embed-Type, + ODS-API-Analytics-Embed-Referrer, ODS-Widgets-Version, Accept + Access-Control-Expose-Headers: + - ODS-Explore-API-Deprecation, Link, X-RateLimit-Remaining, X-RateLimit-Limit, + X-RateLimit-Reset, X-RateLimit-dataset-Remaining, X-RateLimit-dataset-Limit, + X-RateLimit-dataset-Reset + Strict-Transport-Security: + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - strict-origin-when-cross-origin + Permissions-Policy: + - midi=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=() + Content-Security-Policy: + - upgrade-insecure-requests; + X-Ua-Compatible: + - IE=edge + body: + encoding: ASCII-8BIT + string: '{"total_count": 0, "results": []}' + recorded_at: Tue, 15 Oct 2024 14:57:11 GMT +- request: + method: get + uri: https://recherche-entreprises.api.gouv.fr/search?q=19750664500013 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - nginx/1.27.1 + Date: + - Tue, 15 Oct 2024 14:57:12 GMT + Content-Type: + - application/json + Content-Length: + - '3310' + Vary: + - Accept-Encoding + - Accept-Encoding + Annuaire-Entreprises-Instance-Number: + - '02' + X-Frame-Options: + - DENY + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + Access-Control-Allow-Headers: + - Content-Type + Access-Control-Allow-Origin: + - "*" + body: + encoding: ASCII-8BIT + string: '{"results":[{"siren":"197506645","nom_complet":"LYCEE GENERAL ET TECHNOLOGIQUE + RACINE","nom_raison_sociale":"LYCEE GENERAL ET TECHNOLOGIQUE RACINE","sigle":null,"nombre_etablissements":1,"nombre_etablissements_ouverts":1,"siege":{"activite_principale":"85.31Z","activite_principale_registre_metier":null,"annee_tranche_effectif_salarie":"2022","adresse":"20 + RUE DU ROCHER 75008 PARIS","caractere_employeur":"N","cedex":null,"code_pays_etranger":null,"code_postal":"75008","commune":"75108","complement_adresse":null,"coordonnees":"48.876451,2.3223","date_creation":"1983-03-01","date_debut_activite":"2008-01-01","date_fermeture":null,"date_mise_a_jour":null,"date_mise_a_jour_insee":"2024-03-30T03:25:45","departement":"75","distribution_speciale":null,"epci":"200054781","est_siege":true,"etat_administratif":"A","geo_adresse":"20 + Rue du Rocher 75008 Paris","geo_id":"75108_8291_00020","indice_repetition":null,"latitude":"48.876451","libelle_cedex":null,"libelle_commune":"PARIS","libelle_commune_etranger":null,"libelle_pays_etranger":null,"libelle_voie":"DU + ROCHER","liste_enseignes":null,"liste_finess":null,"liste_id_bio":null,"liste_idcc":["9999"],"liste_id_organisme_formation":null,"liste_rge":null,"liste_uai":["0750664P"],"longitude":"2.3223","nom_commercial":null,"numero_voie":"20","region":"11","siret":"19750664500013","statut_diffusion_etablissement":"O","tranche_effectif_salarie":"22","type_voie":"RUE"},"activite_principale":"85.31Z","categorie_entreprise":"PME","caractere_employeur":null,"annee_categorie_entreprise":"2022","date_creation":"1965-05-01","date_fermeture":null,"date_mise_a_jour":"2024-10-14T15:00:03","date_mise_a_jour_insee":"2024-03-22T14:26:06","date_mise_a_jour_rne":null,"dirigeants":[],"etat_administratif":"A","nature_juridique":"7331","section_activite_principale":"P","tranche_effectif_salarie":"22","annee_tranche_effectif_salarie":"2022","statut_diffusion":"O","matching_etablissements":[{"activite_principale":"85.31Z","ancien_siege":false,"annee_tranche_effectif_salarie":"2022","adresse":"20 + RUE DU ROCHER 75008 PARIS","caractere_employeur":"N","code_postal":"75008","commune":"75108","date_creation":"1983-03-01","date_debut_activite":"2008-01-01","date_fermeture":null,"epci":"200054781","est_siege":true,"etat_administratif":"A","geo_id":"75108_8291_00020","latitude":"48.876451","libelle_commune":"PARIS","liste_enseignes":null,"liste_finess":null,"liste_id_bio":null,"liste_idcc":["9999"],"liste_id_organisme_formation":null,"liste_rge":null,"liste_uai":["0750664P"],"longitude":"2.3223","nom_commercial":null,"region":"11","siret":"19750664500013","statut_diffusion_etablissement":"O","tranche_effectif_salarie":"22"}],"finances":null,"complements":{"collectivite_territoriale":null,"convention_collective_renseignee":true,"liste_idcc":["9999"],"egapro_renseignee":false,"est_association":false,"est_bio":false,"est_entrepreneur_individuel":false,"est_entrepreneur_spectacle":false,"est_ess":false,"est_finess":false,"est_organisme_formation":false,"est_qualiopi":false,"liste_id_organisme_formation":null,"est_rge":false,"est_service_public":true,"est_siae":false,"est_societe_mission":false,"est_uai":true,"identifiant_association":null,"statut_entrepreneur_spectacle":null,"type_siae":null}}],"total_results":1,"page":1,"per_page":10,"total_pages":1}' + recorded_at: Tue, 15 Oct 2024 14:57:11 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/cassettes/annuaire_service_public_success_20004021000060.yml b/spec/fixtures/cassettes/annuaire_service_public_success_20004021000060.yml index 92b868dbf..cbeeede03 100644 --- a/spec/fixtures/cassettes/annuaire_service_public_success_20004021000060.yml +++ b/spec/fixtures/cassettes/annuaire_service_public_success_20004021000060.yml @@ -97,4 +97,50 @@ http_interactions: \"ascenseur\"}]", "url_service_public": "https://lannuaire.service-public.fr/provence-alpes-cote-d-azur/var/3b9ce22d-f7bd-46d9-82d1-8b44c8d08e39", "information_complementaire": null, "date_diffusion": null}]}' recorded_at: Mon, 07 Oct 2024 14:41:57 GMT +- request: + method: get + uri: https://recherche-entreprises.api.gouv.fr/search?q=20004021000060 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - nginx/1.27.1 + Date: + - Tue, 15 Oct 2024 13:53:25 GMT + Content-Type: + - application/json + Content-Length: + - '6715' + Vary: + - Accept-Encoding + - Accept-Encoding + Annuaire-Entreprises-Instance-Number: + - '02' + X-Frame-Options: + - DENY + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + Access-Control-Allow-Headers: + - Content-Type + Access-Control-Allow-Origin: + - "*" + body: + encoding: ASCII-8BIT + string: !binary |- + eyJyZXN1bHRzIjpbeyJzaXJlbiI6IjIwMDA0MDIxMCIsIm5vbV9jb21wbGV0IjoiQ09NTVVOQVVURSBERSBDT01NVU5FUyBMQUNTIEVUIEdPUkdFUyBEVSBWRVJET04gKENDTEdWKSIsIm5vbV9yYWlzb25fc29jaWFsZSI6IkNPTU1VTkFVVEUgREUgQ09NTVVORVMgTEFDUyBFVCBHT1JHRVMgRFUgVkVSRE9OIiwic2lnbGUiOiJDQ0xHViIsIm5vbWJyZV9ldGFibGlzc2VtZW50cyI6Nywibm9tYnJlX2V0Y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WNsZSI6bnVsbCwidHlwZV9zaWFlIjpudWxsfX1dLCJ0b3RhbF9yZXN1bHRzIjoxLCJwYWdlIjoxLCJwZXJfcGFnZSI6MTAsInRvdGFsX3BhZ2VzIjoxfQ== + recorded_at: Tue, 15 Oct 2024 13:53:25 GMT recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/cassettes/annuaire_service_public_success_35600082800018.yml b/spec/fixtures/cassettes/annuaire_service_public_success_35600082800018.yml new file mode 100644 index 000000000..6414d37be --- /dev/null +++ b/spec/fixtures/cassettes/annuaire_service_public_success_35600082800018.yml @@ -0,0 +1,122 @@ +--- +http_interactions: +- request: + method: get + uri: https://api-lannuaire.service-public.fr/api/explore/v2.1/catalog/datasets/api-lannuaire-administration/records?where=siret:35600082800018 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - openresty + Date: + - Tue, 15 Oct 2024 16:24:16 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '33' + X-Ratelimit-Remaining: + - '999919' + X-Ratelimit-Limit: + - '1000000' + X-Ratelimit-Reset: + - '2024-10-16 00:00:00+00:00' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Vary: + - Accept-Language, Cookie, Host + Content-Language: + - fr-fr + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - POST, GET, OPTIONS + Access-Control-Max-Age: + - '1000' + Access-Control-Allow-Headers: + - Authorization, X-Requested-With, Origin, ODS-API-Analytics-App, ODS-API-Analytics-Embed-Type, + ODS-API-Analytics-Embed-Referrer, ODS-Widgets-Version, Accept + Access-Control-Expose-Headers: + - ODS-Explore-API-Deprecation, Link, X-RateLimit-Remaining, X-RateLimit-Limit, + X-RateLimit-Reset, X-RateLimit-dataset-Remaining, X-RateLimit-dataset-Limit, + X-RateLimit-dataset-Reset + Strict-Transport-Security: + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - strict-origin-when-cross-origin + Permissions-Policy: + - midi=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=() + Content-Security-Policy: + - upgrade-insecure-requests; + X-Ua-Compatible: + - IE=edge + body: + encoding: ASCII-8BIT + string: '{"total_count": 0, "results": []}' + recorded_at: Tue, 15 Oct 2024 16:24:16 GMT +- request: + method: get + uri: https://recherche-entreprises.api.gouv.fr/search?q=35600082800018 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - nginx/1.27.1 + Date: + - Tue, 15 Oct 2024 16:24:16 GMT + Content-Type: + - application/json + Content-Length: + - '3374' + Vary: + - Accept-Encoding + - Accept-Encoding + - Accept-Encoding + Annuaire-Entreprises-Instance-Number: + - '01' + - '02' + X-Frame-Options: + - DENY + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + Access-Control-Allow-Headers: + - Content-Type + Access-Control-Allow-Origin: + - "*" + body: + encoding: ASCII-8BIT + string: '{"results":[{"siren":"356000828","nom_complet":"LA POSTE (REGION RHONE + ALPES)","nom_raison_sociale":"LA POSTE","sigle":null,"nombre_etablissements":2948,"nombre_etablissements_ouverts":0,"siege":{"activite_principale":"53.10Z","activite_principale_registre_metier":null,"annee_tranche_effectif_salarie":null,"adresse":"4 + QUAI DU POINT DU JOUR 92100 BOULOGNE-BILLANCOURT","caractere_employeur":"N","cedex":null,"code_pays_etranger":null,"code_postal":"92100","commune":"92012","complement_adresse":null,"coordonnees":"48.832893,2.259972","date_creation":"1991-01-01","date_debut_activite":"2011-12-31","date_fermeture":"2011-12-31","date_mise_a_jour":null,"date_mise_a_jour_insee":"2024-03-22T15:40:57","departement":"92","distribution_speciale":null,"epci":"200054781","est_siege":true,"etat_administratif":"F","geo_adresse":"4 + Quai du Point du Jour 92100 Boulogne-Billancourt","geo_id":"92012_7231_00004","indice_repetition":null,"latitude":"48.832893","libelle_cedex":null,"libelle_commune":"BOULOGNE-BILLANCOURT","libelle_commune_etranger":null,"libelle_pays_etranger":null,"libelle_voie":"DU + POINT DU JOUR","liste_enseignes":null,"liste_finess":null,"liste_id_bio":null,"liste_idcc":null,"liste_id_organisme_formation":null,"liste_rge":null,"liste_uai":null,"longitude":"2.259972","nom_commercial":null,"numero_voie":"4","region":"11","siret":"35600082800018","statut_diffusion_etablissement":"O","tranche_effectif_salarie":null,"type_voie":"QUAI"},"activite_principale":"53.10Z","categorie_entreprise":null,"caractere_employeur":null,"annee_categorie_entreprise":null,"date_creation":"1991-01-01","date_fermeture":"2011-12-31","date_mise_a_jour":"2024-10-14T15:38:40","date_mise_a_jour_insee":"2024-03-22T14:26:06","date_mise_a_jour_rne":null,"dirigeants":[],"etat_administratif":"C","nature_juridique":"4130","section_activite_principale":"H","tranche_effectif_salarie":null,"annee_tranche_effectif_salarie":null,"statut_diffusion":"O","matching_etablissements":[{"activite_principale":"53.10Z","ancien_siege":false,"annee_tranche_effectif_salarie":null,"adresse":"4 + QUAI DU POINT DU JOUR 92100 BOULOGNE-BILLANCOURT","caractere_employeur":"N","code_postal":"92100","commune":"92012","date_creation":"1991-01-01","date_debut_activite":"2011-12-31","date_fermeture":"2011-12-31","epci":"200054781","est_siege":true,"etat_administratif":"F","geo_id":"92012_7231_00004","latitude":"48.832893","libelle_commune":"BOULOGNE-BILLANCOURT","liste_enseignes":null,"liste_finess":null,"liste_id_bio":null,"liste_idcc":null,"liste_id_organisme_formation":null,"liste_rge":null,"liste_uai":null,"longitude":"2.259972","nom_commercial":null,"region":"11","siret":"35600082800018","statut_diffusion_etablissement":"O","tranche_effectif_salarie":null}],"finances":null,"complements":{"collectivite_territoriale":null,"convention_collective_renseignee":false,"liste_idcc":null,"egapro_renseignee":false,"est_association":false,"est_bio":false,"est_entrepreneur_individuel":false,"est_entrepreneur_spectacle":false,"est_ess":false,"est_finess":false,"est_organisme_formation":false,"est_qualiopi":false,"liste_id_organisme_formation":null,"est_rge":false,"est_service_public":true,"est_siae":false,"est_societe_mission":false,"est_uai":false,"identifiant_association":null,"statut_entrepreneur_spectacle":null,"type_siae":null}}],"total_results":1,"page":1,"per_page":10,"total_pages":1}' + recorded_at: Tue, 15 Oct 2024 16:24:16 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/cassettes/annuaire_service_public_success_41816609600051.yml b/spec/fixtures/cassettes/annuaire_service_public_success_41816609600051.yml new file mode 100644 index 000000000..dc50ca6b5 --- /dev/null +++ b/spec/fixtures/cassettes/annuaire_service_public_success_41816609600051.yml @@ -0,0 +1,119 @@ +--- +http_interactions: +- request: + method: get + uri: https://recherche-entreprises.api.gouv.fr/search?q=41816609600051 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - nginx/1.27.1 + Date: + - Thu, 17 Oct 2024 07:51:06 GMT + Content-Type: + - application/json + Content-Length: + - '3471' + Vary: + - Accept-Encoding + - Accept-Encoding + - Accept-Encoding + Annuaire-Entreprises-Instance-Number: + - '02' + X-Frame-Options: + - DENY + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=31536000 + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + - 1; mode=block + Access-Control-Allow-Headers: + - Content-Type + Access-Control-Allow-Origin: + - "*" + body: + encoding: ASCII-8BIT + string: !binary |- + eyJyZXN1bHRzIjpbeyJzaXJlbiI6IjQxODE2NjA5NiIsIm5vbV9jb21wbGV0IjoiT0NUTy1URUNITk9MT0dZIiwibm9tX3JhaXNvbl9zb2NpYWxlIjoiT0NUTy1URUNITk9MT0dZIiwic2lnbGUiOm51bGwsIm5vbWJyZV9ldGFibGlzc2VtZW50cyI6Nywibm9tYnJlX2V0YWJsaXNzZW1lbnRzX291dmVydHMiOjEsInNpZWdlIjp7ImFjdGl2aXRlX3ByaW5jaXBhbGUiOi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9lbnRyZXByZW5ldXJfc3BlY3RhY2xlIjpudWxsLCJ0eXBlX3NpYWUiOm51bGx9fV0sInRvdGFsX3Jlc3VsdHMiOjEsInBhZ2UiOjEsInBlcl9wYWdlIjoxMCwidG90YWxfcGFnZXMiOjF9 + recorded_at: Thu, 17 Oct 2024 07:51:06 GMT +- request: + method: get + uri: https://api-lannuaire.service-public.fr/api/explore/v2.1/catalog/datasets/api-lannuaire-administration/records?where=siret:41816609600051 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - openresty + Date: + - Thu, 17 Oct 2024 07:51:06 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '33' + X-Ratelimit-Remaining: + - '999989' + X-Ratelimit-Limit: + - '1000000' + X-Ratelimit-Reset: + - '2024-10-18 00:00:00+00:00' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Vary: + - Accept-Language, Cookie, Host + Content-Language: + - fr-fr + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - POST, GET, OPTIONS + Access-Control-Max-Age: + - '1000' + Access-Control-Allow-Headers: + - Authorization, X-Requested-With, Origin, ODS-API-Analytics-App, ODS-API-Analytics-Embed-Type, + ODS-API-Analytics-Embed-Referrer, ODS-Widgets-Version, Accept + Access-Control-Expose-Headers: + - ODS-Explore-API-Deprecation, Link, X-RateLimit-Remaining, X-RateLimit-Limit, + X-RateLimit-Reset, X-RateLimit-dataset-Remaining, X-RateLimit-dataset-Limit, + X-RateLimit-dataset-Reset + Strict-Transport-Security: + - max-age=31536000 + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - strict-origin-when-cross-origin + Permissions-Policy: + - midi=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=() + Content-Security-Policy: + - upgrade-insecure-requests; + X-Ua-Compatible: + - IE=edge + body: + encoding: ASCII-8BIT + string: '{"total_count": 0, "results": []}' + recorded_at: Thu, 17 Oct 2024 07:51:06 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/models/concerns/prefillable_from_service_public_concern_spec.rb b/spec/models/concerns/prefillable_from_service_public_concern_spec.rb index 2475972ae..4580ac689 100644 --- a/spec/models/concerns/prefillable_from_service_public_concern_spec.rb +++ b/spec/models/concerns/prefillable_from_service_public_concern_spec.rb @@ -9,12 +9,13 @@ RSpec.describe PrefillableFromServicePublicConcern, type: :model do describe '#prefill_from_siret' do let(:service) { Service.new(siret:) } subject { service.prefill_from_siret } - context 'when API call is successful' do + context 'when API call is successful with collectivite' do it 'prefills service attributes' do VCR.use_cassette('annuaire_service_public_success_20004021000060') do - expect(subject).to be_success + expect(subject.all?(&:success?)).to be_truthy expect(service.nom).to eq("Communauté de communes - Lacs et Gorges du Verdon") + expect(service).to be_collectivite_territoriale expect(service.email).to eq("redacted@email.fr") expect(service.telephone).to eq("04 94 70 00 00") expect(service.horaires).to eq("Lundi au Jeudi : de 8:00 à 12:00 et de 13:30 à 17:30\nVendredi : de 8:00 à 12:00") @@ -39,7 +40,46 @@ RSpec.describe PrefillableFromServicePublicConcern, type: :model do let(:siret) { '20004021000000' } it 'returns a failure result' do VCR.use_cassette('annuaire_service_public_failure_20004021000000') do - expect(subject).to be_failure + expect(subject.all?(&:failure?)).to be_truthy + end + end + end + + context 'when SIRET is enseignement' do + let(:siret) { '19750664500013' } + it 'prefills for enseignement' do + VCR.use_cassette('annuaire_service_public_success_19750664500013') do + expect(subject.one?(&:success?)).to be_truthy + expect(service.nom).to eq("LYCEE GENERAL ET TECHNOLOGIQUE RACINE") + expect(service).to be_etablissement_enseignement + expect(service.adresse).to eq("20 Rue du Rocher 75008 Paris") + expect(service.horaires).to be_nil + end + end + end + + context 'when SIRET is a ministere' do + let(:siret) { '11004601800013' } + it 'prefills for administration centrale' do + VCR.use_cassette('annuaire_service_public_success_11004601800013') do + expect(subject.one?(&:success?)).to be_truthy + expect(service.nom).to eq("MINISTERE DE LA CULTURE") + expect(service).to be_administration_centrale + expect(service.adresse).to eq("182 Rue Saint-Honoré 75001 Paris") + expect(service.horaires).to be_nil + end + end + end + + context 'when SIRET is La Poste' do + let(:siret) { '35600082800018' } + it 'prefills for administration centrale' do + VCR.use_cassette('annuaire_service_public_success_35600082800018') do + expect(subject.one?(&:success?)).to be_truthy + expect(service.nom).to eq("LA POSTE (REGION RHONE ALPES)") + expect(service).to be_service_deconcentre_de_l_etat + expect(service.adresse).to eq("4 Quai du Point du Jour 92100 Boulogne-Billancourt") + expect(service.horaires).to be_nil end end end