From a24cf18c9d1ac4ad7da5cbbd6d9bb961523d7496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vantomme?= Date: Tue, 30 Nov 2021 12:50:02 +0100 Subject: [PATCH] feat (api particulier): add Pole Emploi support to sources service --- .../api_particulier/services/sources_service.rb | 12 +++++++++++- .../services/sources_service_spec.rb | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/lib/api_particulier/services/sources_service.rb b/app/lib/api_particulier/services/sources_service.rb index 48d58d0d4..627d539d2 100644 --- a/app/lib/api_particulier/services/sources_service.rb +++ b/app/lib/api_particulier/services/sources_service.rb @@ -77,7 +77,11 @@ module APIParticulier 'dgfip_annee_impot' => ['dgfip', 'annee_impot'], 'dgfip_annee_revenus' => ['dgfip', 'annee_revenus'], 'dgfip_erreur_correctif' => ['dgfip', 'erreur_correctif'], - 'dgfip_situation_partielle' => ['dgfip', 'situation_partielle'] + 'dgfip_situation_partielle' => ['dgfip', 'situation_partielle'], + 'pole_emploi_identite' => ['pole_emploi', 'identite'], + 'pole_emploi_adresse' => ['pole_emploi', 'adresse'], + 'pole_emploi_contact' => ['pole_emploi', 'contact'], + 'pole_emploi_inscription' => ['pole_emploi', 'inscription'] } end @@ -114,6 +118,12 @@ module APIParticulier 'annee_revenus' => { 'agregats_fiscaux' => ['anneeRevenus'] }, 'erreur_correctif' => { 'complements' => ['erreurCorrectif'] }, 'situation_partielle' => { 'complements' => ['situationPartielle'] } + }, + 'pole_emploi' => { + 'identite' => ['identifiant', 'civilite', 'nom', 'nomUsage', 'prenom', 'sexe', 'dateNaissance'], + 'adresse' => ['INSEECommune', 'codePostal', 'localite', 'ligneVoie', 'ligneComplementDestinataire', 'ligneComplementAdresse', 'ligneComplementDistribution', 'ligneNom'], + 'contact' => ['email', 'telephone', 'telephone2'], + 'inscription' => ['dateInscription', 'dateCessationInscription', 'codeCertificationCNAV', 'codeCategorieInscription', 'libelleCategorieInscription'] } } end diff --git a/spec/lib/api_particulier/services/sources_service_spec.rb b/spec/lib/api_particulier/services/sources_service_spec.rb index fd71fac3c..36ffeb6d6 100644 --- a/spec/lib/api_particulier/services/sources_service_spec.rb +++ b/spec/lib/api_particulier/services/sources_service_spec.rb @@ -47,6 +47,21 @@ describe APIParticulier::Services::SourcesService do it { is_expected.to match(dgfip_avis_imposition_et_adresse) } end + context 'when a procedure has a pole_emploi_identite and a pole_emploi_adresse scopes' do + let(:api_particulier_scopes) { ['pole_emploi_identite', 'pole_emploi_adresse'] } + + let(:pole_emploi_identite_et_adresse) do + { + 'pole_emploi' => { + 'identite' => ['identifiant', 'civilite', 'nom', 'nomUsage', 'prenom', 'sexe', 'dateNaissance'], + 'adresse' => ['INSEECommune', 'codePostal', 'localite', 'ligneVoie', 'ligneComplementDestinataire', 'ligneComplementAdresse', 'ligneComplementDistribution', 'ligneNom'] + } + } + end + + it { is_expected.to match(pole_emploi_identite_et_adresse) } + end + context 'when a procedure has an unknown scope' do let(:api_particulier_scopes) { ['unknown_scope'] }