2023-11-06 15:15:51 +01:00
|
|
|
|
describe 'fetch API Particulier Data', js: true do
|
2021-09-28 15:11:15 +02:00
|
|
|
|
let(:administrateur) { create(:administrateur) }
|
|
|
|
|
|
|
|
|
|
let(:expected_token) { 'd7e9c9f4c3ca00caadde31f50fd4521a' }
|
|
|
|
|
|
|
|
|
|
let(:expected_sources) do
|
|
|
|
|
{
|
2021-11-24 17:30:35 +01:00
|
|
|
|
'cnaf' =>
|
2021-09-28 15:11:15 +02:00
|
|
|
|
{
|
2021-11-24 17:30:35 +01:00
|
|
|
|
'adresse' => ['identite', 'complementIdentite', 'complementIdentiteGeo', 'numeroRue', 'lieuDit', 'codePostalVille', 'pays'],
|
|
|
|
|
'allocataires' => ['nomPrenom', 'dateDeNaissance', 'sexe'],
|
|
|
|
|
'enfants' => ['nomPrenom', 'dateDeNaissance', 'sexe'],
|
|
|
|
|
'quotient_familial' => ['quotientFamilial', 'annee', 'mois']
|
|
|
|
|
},
|
|
|
|
|
'dgfip' =>
|
|
|
|
|
{
|
|
|
|
|
'declarant1' => ['dateNaissance', 'nom', 'nomNaissance', 'prenoms'],
|
|
|
|
|
'declarant2' => ['dateNaissance', 'nom', 'nomNaissance', 'prenoms'],
|
|
|
|
|
'echeance_avis' => ['dateEtablissement', 'dateRecouvrement'],
|
|
|
|
|
'foyer_fiscal' => ['adresse', 'annee', 'nombreParts', 'nombrePersonnesCharge', 'situationFamille'],
|
|
|
|
|
'agregats_fiscaux' => ['anneeImpots', 'anneeRevenus', 'impotRevenuNetAvantCorrections', 'montantImpot', 'revenuBrutGlobal', 'revenuFiscalReference', 'revenuImposable'],
|
|
|
|
|
'complements' => ['situationPartielle', 'erreurCorrectif']
|
2021-12-01 10:21:30 +01:00
|
|
|
|
},
|
|
|
|
|
'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']
|
2021-12-15 15:25:02 +01:00
|
|
|
|
},
|
|
|
|
|
'mesri' => {
|
|
|
|
|
'identifiant' => ['ine'],
|
|
|
|
|
'identite' => ['nom', 'prenom', 'dateNaissance'],
|
|
|
|
|
'inscriptions' => ['statut', 'regime', 'dateDebutInscription', 'dateFinInscription', 'codeCommune'],
|
|
|
|
|
'admissions' => ['statut', 'regime', 'dateDebutAdmission', 'dateFinAdmission', 'codeCommune'],
|
|
|
|
|
'etablissements' => ['uai', 'nom']
|
2021-09-28 15:11:15 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
before do
|
2021-11-24 17:30:35 +01:00
|
|
|
|
stub_const('API_PARTICULIER_URL', 'https://particulier.api.gouv.fr/api')
|
2021-09-28 15:11:15 +02:00
|
|
|
|
Flipper.enable(:api_particulier)
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
context 'when an administrateur is logged in' do
|
2021-09-28 15:11:15 +02:00
|
|
|
|
let(:procedure) do
|
2022-12-20 11:21:52 +01:00
|
|
|
|
create(:procedure, :with_service, :with_instructeur, :with_zone,
|
2021-09-28 15:11:15 +02:00
|
|
|
|
aasm_state: :brouillon,
|
|
|
|
|
administrateurs: [administrateur],
|
2021-11-24 17:30:35 +01:00
|
|
|
|
libelle: 'libellé de la procédure',
|
|
|
|
|
path: 'libelle-de-la-procedure')
|
2021-09-28 15:11:15 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
before { login_as administrateur.user, scope: :user }
|
|
|
|
|
|
|
|
|
|
scenario 'it can enable api particulier' do
|
|
|
|
|
visit admin_procedure_path(procedure)
|
2021-11-24 17:30:35 +01:00
|
|
|
|
expect(page).to have_content('Configurer le jeton API particulier')
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
|
|
|
|
find('#api-particulier').click
|
|
|
|
|
expect(page).to have_current_path(admin_procedure_api_particulier_path(procedure))
|
|
|
|
|
|
|
|
|
|
find('#add-jeton').click
|
|
|
|
|
expect(page).to have_current_path(admin_procedure_api_particulier_jeton_path(procedure))
|
|
|
|
|
|
|
|
|
|
fill_in 'procedure_api_particulier_token', with: expected_token
|
2021-11-24 17:30:35 +01:00
|
|
|
|
VCR.use_cassette('api_particulier/success/introspect') { click_on 'Enregistrer' }
|
2021-09-28 15:11:15 +02:00
|
|
|
|
expect(page).to have_text('Le jeton a bien été mis à jour')
|
|
|
|
|
expect(page).to have_current_path(admin_procedure_api_particulier_sources_path(procedure))
|
|
|
|
|
|
|
|
|
|
['allocataires', 'enfants'].each do |scope|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within("#cnaf-#{scope}") do
|
2021-09-28 15:11:15 +02:00
|
|
|
|
check('noms et prénoms')
|
|
|
|
|
check('date de naissance')
|
|
|
|
|
check('sexe')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within('#cnaf-adresse') do
|
2021-09-28 15:11:15 +02:00
|
|
|
|
check('identité')
|
|
|
|
|
check('complément d’identité')
|
|
|
|
|
check('complément d’identité géographique')
|
|
|
|
|
check('numéro et rue')
|
|
|
|
|
check('lieu-dit')
|
|
|
|
|
check('code postal et ville')
|
|
|
|
|
check('pays')
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within('#cnaf-quotient_familial') do
|
2021-09-28 15:11:15 +02:00
|
|
|
|
check('quotient familial')
|
|
|
|
|
check('année')
|
|
|
|
|
check('mois')
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-24 17:30:35 +01:00
|
|
|
|
['declarant1', 'declarant2'].each do |scope|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within("#dgfip-#{scope}") do
|
2021-11-24 17:30:35 +01:00
|
|
|
|
check('nom')
|
|
|
|
|
check('nom de naissance')
|
|
|
|
|
check('prénoms')
|
|
|
|
|
check('date de naissance')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
scroll_to(find('#dgfip-echeance_avis'))
|
|
|
|
|
within ('#dgfip-echeance_avis') do
|
2021-11-24 17:30:35 +01:00
|
|
|
|
check('date de recouvrement')
|
|
|
|
|
check("date d’établissement")
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within('#dgfip-foyer_fiscal') do
|
2021-11-24 17:30:35 +01:00
|
|
|
|
check('année')
|
|
|
|
|
check('adresse')
|
|
|
|
|
check('nombre de parts')
|
|
|
|
|
check('situation familiale')
|
|
|
|
|
check('nombre de personnes à charge')
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within('#dgfip-agregats_fiscaux') do
|
2021-11-24 17:30:35 +01:00
|
|
|
|
check('revenu brut global')
|
|
|
|
|
check('revenu imposable')
|
|
|
|
|
check('impôt sur le revenu net avant correction')
|
|
|
|
|
check("montant de l’impôt")
|
|
|
|
|
check('revenu fiscal de référence')
|
|
|
|
|
check("année d’imposition")
|
|
|
|
|
check('année des revenus')
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within('#dgfip-complements') do
|
2021-11-24 17:30:35 +01:00
|
|
|
|
check('erreur correctif')
|
|
|
|
|
check('situation partielle')
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within('#pole_emploi-identite') do
|
|
|
|
|
check('identifiant')
|
|
|
|
|
check('civilité')
|
|
|
|
|
check('nom')
|
|
|
|
|
check("nom d’usage")
|
|
|
|
|
check('prénom')
|
|
|
|
|
check('sexe')
|
|
|
|
|
check('date de naissance')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
within('#pole_emploi-adresse') do
|
|
|
|
|
check('code INSEE de la commune')
|
|
|
|
|
check('code postal')
|
|
|
|
|
check('localité')
|
|
|
|
|
check('voie')
|
|
|
|
|
check('destinataire')
|
|
|
|
|
check('adresse')
|
|
|
|
|
check('distribution')
|
|
|
|
|
check('nom')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
within('#pole_emploi-contact') do
|
|
|
|
|
check('email')
|
|
|
|
|
check('téléphone')
|
|
|
|
|
check('téléphone 2')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
within('#pole_emploi-inscription') do
|
|
|
|
|
check("date d’inscription")
|
|
|
|
|
check("date de cessation d’inscription")
|
|
|
|
|
check('code de certification CNAV')
|
|
|
|
|
check("code de catégorie d’inscription")
|
|
|
|
|
check("libellé de catégorie d’inscription")
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-15 15:25:02 +01:00
|
|
|
|
within('#mesri-identifiant') do
|
|
|
|
|
check('INE')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
within('#mesri-identite') do
|
|
|
|
|
check('nom')
|
|
|
|
|
check('prénom')
|
|
|
|
|
check('date de naissance')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
within('#mesri-inscriptions') do
|
|
|
|
|
check('statut')
|
|
|
|
|
check('régime')
|
2022-12-01 13:41:12 +01:00
|
|
|
|
check("date de début d’inscription")
|
|
|
|
|
check("date de fin d’inscription")
|
2021-12-15 15:25:02 +01:00
|
|
|
|
check("code de la commune")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
within('#mesri-admissions') do
|
|
|
|
|
check('statut')
|
|
|
|
|
check('régime')
|
2022-12-01 13:41:12 +01:00
|
|
|
|
check("date de début d’admission")
|
|
|
|
|
check("date de fin d’admission")
|
2021-12-15 15:25:02 +01:00
|
|
|
|
check("code de la commune")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
within('#mesri-etablissements') do
|
|
|
|
|
check('UAI')
|
|
|
|
|
check('nom')
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-24 17:30:35 +01:00
|
|
|
|
click_on 'Enregistrer'
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
within('#cnaf-enfants') do
|
2021-09-28 15:11:15 +02:00
|
|
|
|
expect(find('input[value=nomPrenom]')).to be_checked
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-24 17:30:35 +01:00
|
|
|
|
procedure.reload
|
|
|
|
|
|
2021-12-15 15:25:02 +01:00
|
|
|
|
expect(procedure.api_particulier_sources.keys).to contain_exactly('cnaf', 'dgfip', 'pole_emploi', 'mesri')
|
2021-11-24 17:30:35 +01:00
|
|
|
|
expect(procedure.api_particulier_sources['cnaf'].keys).to contain_exactly('adresse', 'allocataires', 'enfants', 'quotient_familial')
|
|
|
|
|
expect(procedure.api_particulier_sources['dgfip'].keys).to contain_exactly('declarant1', 'declarant2', 'echeance_avis', 'foyer_fiscal', 'agregats_fiscaux', 'complements')
|
2021-12-01 10:21:30 +01:00
|
|
|
|
expect(procedure.api_particulier_sources['pole_emploi'].keys).to contain_exactly('identite', 'adresse', 'contact', 'inscription')
|
2021-12-15 15:25:02 +01:00
|
|
|
|
expect(procedure.api_particulier_sources['mesri'].keys).to contain_exactly('identifiant', 'identite', 'inscriptions', 'admissions', 'etablissements')
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
|
|
|
|
procedure.api_particulier_sources.each do |provider, scopes|
|
|
|
|
|
scopes.each do |scope, fields|
|
|
|
|
|
expect(fields).to match_array(expected_sources[provider][scope])
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
|
|
|
|
visit champs_admin_procedure_path(procedure)
|
|
|
|
|
|
|
|
|
|
add_champ
|
2022-06-16 14:56:53 +02:00
|
|
|
|
select('Données de la Caisse nationale des allocations familiales', from: 'Type de champ')
|
|
|
|
|
fill_in 'Libellé du champ', with: 'libellé de champ'
|
2021-09-28 15:11:15 +02:00
|
|
|
|
blur
|
|
|
|
|
expect(page).to have_content('Formulaire enregistré')
|
|
|
|
|
|
|
|
|
|
visit admin_procedure_path(procedure)
|
|
|
|
|
find('#publish-procedure-link').click
|
|
|
|
|
expect(find_field('procedure_path').value).to eq procedure.path
|
|
|
|
|
fill_in 'lien_site_web', with: 'http://some.website'
|
2023-10-10 16:51:06 +02:00
|
|
|
|
within('form') { click_on 'Publier' }
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
|
|
|
|
expect(page).to have_text('Démarche publiée')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
context 'when a user is logged in' do
|
2021-09-28 15:11:15 +02:00
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
let(:numero_allocataire) { '5843972' }
|
|
|
|
|
let(:code_postal) { '92110' }
|
2021-11-24 17:30:35 +01:00
|
|
|
|
let(:numero_fiscal) { '2097699999077' }
|
|
|
|
|
let(:reference_avis) { '2097699999077' }
|
2021-09-28 15:11:15 +02:00
|
|
|
|
let(:instructeur) { create(:instructeur) }
|
2021-12-01 10:21:30 +01:00
|
|
|
|
let(:identifiant) { 'georges_moustaki_77' }
|
2021-12-15 15:25:02 +01:00
|
|
|
|
let(:ine) { '090601811AB' }
|
2021-12-01 10:21:30 +01:00
|
|
|
|
let(:api_particulier_token) { '29eb50b65f64e8e00c0847a8bbcbd150e1f847' }
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
|
|
|
|
let(:procedure) do
|
2022-05-17 10:39:24 +02:00
|
|
|
|
create(:procedure, :for_individual, :with_service, :published,
|
2021-11-24 17:30:35 +01:00
|
|
|
|
libelle: 'libellé de la procédure',
|
|
|
|
|
path: 'libelle-de-la-procedure',
|
2021-09-28 15:11:15 +02:00
|
|
|
|
instructeurs: [instructeur],
|
|
|
|
|
api_particulier_sources: expected_sources,
|
2022-05-17 10:39:24 +02:00
|
|
|
|
api_particulier_token: api_particulier_token).tap do |p|
|
|
|
|
|
p.active_revision.add_type_de_champ(type_champ: :cnaf, libelle: 'cnaf')
|
|
|
|
|
p.active_revision.add_type_de_champ(type_champ: :dgfip, libelle: 'dgfip')
|
|
|
|
|
p.active_revision.add_type_de_champ(type_champ: :pole_emploi, libelle: 'pole_emploi')
|
|
|
|
|
p.active_revision.add_type_de_champ(type_champ: :mesri, libelle: 'mesri')
|
|
|
|
|
end
|
2021-09-28 15:11:15 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
before { login_as user, scope: :user }
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
context 'CNAF' do
|
2023-10-26 16:02:23 +02:00
|
|
|
|
scenario 'it can fill an cnaf champ', vcr: { cassette_name: 'api_particulier/success/composition_familiale' } do
|
2021-12-01 10:21:30 +01:00
|
|
|
|
visit commencer_path(path: procedure.path)
|
|
|
|
|
click_on 'Commencer la démarche'
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2023-09-05 14:42:56 +02:00
|
|
|
|
find('label', text: 'Monsieur').click
|
2023-09-18 18:15:28 +02:00
|
|
|
|
fill_in('Prénom', with: 'prenom')
|
|
|
|
|
fill_in('Nom', with: 'nom')
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
click_button('Continuer')
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
fill_in 'Le numéro d’allocataire CAF', with: numero_allocataire
|
|
|
|
|
fill_in 'Le code postal', with: 'wrong_code'
|
2021-10-06 12:03:12 +02:00
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
dossier = Dossier.last
|
2022-11-10 22:21:14 +01:00
|
|
|
|
cnaf_champ = dossier.champs_public.find(&:cnaf?)
|
2022-06-16 14:56:53 +02:00
|
|
|
|
|
2022-10-25 13:52:52 +02:00
|
|
|
|
wait_until { cnaf_champ.reload.code_postal == 'wrong_code' }
|
2021-12-01 10:21:30 +01:00
|
|
|
|
|
|
|
|
|
click_on 'Déposer le dossier'
|
2023-09-19 11:07:50 +02:00
|
|
|
|
expect(page).to have_content("cnaf doit posséder 5 caractères")
|
2021-10-06 12:03:12 +02:00
|
|
|
|
|
2023-10-26 16:02:23 +02:00
|
|
|
|
fill_in 'Le code postal', with: code_postal
|
|
|
|
|
wait_until { cnaf_champ.reload.external_id.present? }
|
|
|
|
|
|
|
|
|
|
click_on 'Déposer le dossier'
|
|
|
|
|
perform_enqueued_jobs
|
|
|
|
|
|
2022-10-28 11:12:39 +02:00
|
|
|
|
expect(page).to have_current_path(merci_dossier_path(Dossier.last))
|
2021-10-06 12:03:12 +02:00
|
|
|
|
|
2023-05-11 16:56:43 +02:00
|
|
|
|
perform_enqueued_jobs
|
2023-05-10 10:41:17 +02:00
|
|
|
|
wait_until { cnaf_champ.reload.data.present? }
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
visit demande_dossier_path(dossier)
|
|
|
|
|
expect(page).to have_content(/Des données.*ont été reçues depuis la CAF/)
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
log_out
|
|
|
|
|
|
|
|
|
|
login_as instructeur.user, scope: :user
|
|
|
|
|
|
|
|
|
|
visit instructeur_dossier_path(procedure, dossier)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('code postal et ville 92110 Clichy')
|
|
|
|
|
expect(page).to have_content('identité Mr SNOW Eric')
|
|
|
|
|
expect(page).to have_content('complément d’identité ne connait rien')
|
|
|
|
|
expect(page).to have_content('numéro et rue 109 rue La Boétie')
|
|
|
|
|
expect(page).to have_content('pays FRANCE')
|
|
|
|
|
expect(page).to have_content('complément d’identité géographique au nord de paris')
|
|
|
|
|
expect(page).to have_content('lieu-dit glagla')
|
|
|
|
|
expect(page).to have_content('ERIC SNOW masculin 07/01/1991')
|
|
|
|
|
expect(page).to have_content('SANSA SNOW féminin 15/01/1992')
|
|
|
|
|
expect(page).to have_content('PAUL SNOW masculin 04/01/2018')
|
|
|
|
|
expect(page).to have_content('1856 6 2021')
|
2021-09-28 15:11:15 +02:00
|
|
|
|
end
|
2021-12-01 10:21:30 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'Pôle emploi' do
|
|
|
|
|
let(:api_particulier_token) { '06fd8675601267d2988cbbdef56ecb0de1d45223' }
|
|
|
|
|
|
2023-10-26 16:02:23 +02:00
|
|
|
|
scenario 'it can fill a Pôle emploi field', vcr: { cassette_name: 'api_particulier/success/situation_pole_emploi' } do
|
2021-12-01 10:21:30 +01:00
|
|
|
|
visit commencer_path(path: procedure.path)
|
|
|
|
|
click_on 'Commencer la démarche'
|
|
|
|
|
|
2023-09-05 14:42:56 +02:00
|
|
|
|
find('label', text: 'Monsieur').click
|
2023-09-18 18:15:28 +02:00
|
|
|
|
fill_in('Prénom', with: 'Georges')
|
|
|
|
|
fill_in('Nom', with: 'Moustaki')
|
2021-12-01 10:21:30 +01:00
|
|
|
|
|
|
|
|
|
click_button('Continuer')
|
|
|
|
|
|
|
|
|
|
fill_in "Identifiant", with: 'wrong code'
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
dossier = Dossier.last
|
2022-11-10 22:21:14 +01:00
|
|
|
|
pole_emploi_champ = dossier.champs_public.find(&:pole_emploi?)
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2022-10-25 13:52:52 +02:00
|
|
|
|
wait_until { pole_emploi_champ.reload.identifiant == 'wrong code' }
|
|
|
|
|
|
2022-10-04 12:27:03 +02:00
|
|
|
|
clear_enqueued_jobs
|
|
|
|
|
pole_emploi_champ.update(external_id: nil, identifiant: nil)
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2023-10-26 16:02:23 +02:00
|
|
|
|
fill_in "Identifiant", with: identifiant
|
|
|
|
|
wait_until { pole_emploi_champ.reload.external_id.present? }
|
|
|
|
|
|
|
|
|
|
click_on 'Déposer le dossier'
|
|
|
|
|
perform_enqueued_jobs
|
|
|
|
|
|
2022-10-28 11:12:39 +02:00
|
|
|
|
expect(page).to have_current_path(merci_dossier_path(Dossier.last))
|
2021-12-01 10:21:30 +01:00
|
|
|
|
|
2023-05-11 16:56:43 +02:00
|
|
|
|
perform_enqueued_jobs
|
2023-05-10 10:41:17 +02:00
|
|
|
|
wait_until { pole_emploi_champ.reload.data.present? }
|
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
visit demande_dossier_path(dossier)
|
|
|
|
|
expect(page).to have_content(/Des données.*ont été reçues depuis Pôle emploi/)
|
|
|
|
|
|
|
|
|
|
log_out
|
|
|
|
|
|
|
|
|
|
login_as instructeur.user, scope: :user
|
|
|
|
|
|
|
|
|
|
visit instructeur_dossier_path(procedure, dossier)
|
2021-09-28 15:11:15 +02:00
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
|
expect(page).to have_content('identifiant georges_moustaki_77')
|
|
|
|
|
expect(page).to have_content('civilité M.')
|
|
|
|
|
expect(page).to have_content('nom Moustaki')
|
|
|
|
|
expect(page).to have_content("nom d’usage Moustaki")
|
|
|
|
|
expect(page).to have_content('prénom Georges')
|
|
|
|
|
expect(page).to have_content('sexe masculin')
|
|
|
|
|
expect(page).to have_content('date de naissance 3 mai 1934')
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('code INSEE de la commune 75118')
|
|
|
|
|
expect(page).to have_content('code postal 75018')
|
|
|
|
|
expect(page).to have_content('localité 75018 Paris')
|
|
|
|
|
expect(page).to have_content('voie 3 rue des Huttes')
|
|
|
|
|
expect(page).to have_content('nom MOUSTAKI')
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('email georges@moustaki.fr')
|
|
|
|
|
expect(page).to have_content('téléphone 0629212921')
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content("date d’inscription 3 mai 1965")
|
|
|
|
|
expect(page).to have_content("date de cessation d’inscription 3 mai 1966")
|
|
|
|
|
expect(page).to have_content('code de certification CNAV VC')
|
|
|
|
|
expect(page).to have_content("code de catégorie d’inscription 1")
|
|
|
|
|
expect(page).to have_content("libellé de catégorie d’inscription PERSONNE SANS EMPLOI DISPONIBLE DUREE INDETERMINEE PLEIN TPS")
|
|
|
|
|
|
|
|
|
|
expect(page).not_to have_content('téléphone 2')
|
|
|
|
|
expect(page).not_to have_content('destinataire')
|
|
|
|
|
expect(page).not_to have_content('adresse')
|
|
|
|
|
expect(page).not_to have_content('distribution')
|
|
|
|
|
end
|
2021-09-28 15:11:15 +02:00
|
|
|
|
end
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2021-12-15 15:25:02 +01:00
|
|
|
|
context 'MESRI' do
|
|
|
|
|
let(:api_particulier_token) { 'c6d23f3900b8fb4b3586c4804c051af79062f54b' }
|
|
|
|
|
|
|
|
|
|
scenario 'it can fill a MESRI field' do
|
|
|
|
|
visit commencer_path(path: procedure.path)
|
|
|
|
|
click_on 'Commencer la démarche'
|
|
|
|
|
|
2023-09-18 18:15:28 +02:00
|
|
|
|
find('label', text: 'Madame').click
|
|
|
|
|
fill_in('Prénom', with: 'Dubois')
|
|
|
|
|
fill_in('Nom', with: 'Angela Claire Louise')
|
2021-12-15 15:25:02 +01:00
|
|
|
|
|
|
|
|
|
click_button('Continuer')
|
|
|
|
|
|
|
|
|
|
fill_in "INE", with: 'wrong code'
|
|
|
|
|
|
|
|
|
|
dossier = Dossier.last
|
2022-11-10 22:21:14 +01:00
|
|
|
|
mesri_champ = dossier.champs_public.find(&:mesri?)
|
2021-12-15 15:25:02 +01:00
|
|
|
|
|
2022-10-25 13:52:52 +02:00
|
|
|
|
wait_until { mesri_champ.reload.ine == 'wrong code' }
|
2022-10-04 12:27:03 +02:00
|
|
|
|
clear_enqueued_jobs
|
|
|
|
|
mesri_champ.update(external_id: nil, ine: nil)
|
2021-12-15 15:25:02 +01:00
|
|
|
|
|
|
|
|
|
VCR.use_cassette('api_particulier/success/etudiants') do
|
2022-10-25 13:52:52 +02:00
|
|
|
|
fill_in "INE", with: ine
|
|
|
|
|
wait_until { mesri_champ.reload.external_id.present? }
|
|
|
|
|
click_on 'Déposer le dossier'
|
|
|
|
|
perform_enqueued_jobs
|
2021-12-15 15:25:02 +01:00
|
|
|
|
end
|
2022-10-28 11:12:39 +02:00
|
|
|
|
expect(page).to have_current_path(merci_dossier_path(Dossier.last))
|
2021-12-15 15:25:02 +01:00
|
|
|
|
|
2023-05-11 16:56:43 +02:00
|
|
|
|
perform_enqueued_jobs
|
2023-05-10 10:41:17 +02:00
|
|
|
|
wait_until { mesri_champ.reload.data.present? }
|
|
|
|
|
|
2021-12-15 15:25:02 +01:00
|
|
|
|
visit demande_dossier_path(dossier)
|
|
|
|
|
expect(page).to have_content(/Des données.*ont été reçues depuis le MESRI/)
|
|
|
|
|
|
|
|
|
|
log_out
|
|
|
|
|
|
|
|
|
|
login_as instructeur.user, scope: :user
|
|
|
|
|
|
|
|
|
|
visit instructeur_dossier_path(procedure, dossier)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('INE 090601811AB')
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('nom DUBOIS')
|
|
|
|
|
expect(page).to have_content('prénom Angela Claire Louise')
|
|
|
|
|
expect(page).to have_content('date de naissance 24 août 1962')
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('statut inscrit')
|
|
|
|
|
expect(page).to have_content('régime formation continue')
|
2022-12-01 13:41:12 +01:00
|
|
|
|
expect(page).to have_content("date de début d’inscription 1 septembre 2022")
|
|
|
|
|
expect(page).to have_content("date de fin d’inscription 31 août 2023")
|
2021-12-15 15:25:02 +01:00
|
|
|
|
expect(page).to have_content('code de la commune 75106')
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('statut admis')
|
|
|
|
|
expect(page).to have_content('régime formation continue')
|
2022-12-01 13:41:12 +01:00
|
|
|
|
expect(page).to have_content("date de début d’admission 1 septembre 2021")
|
|
|
|
|
expect(page).to have_content("date de fin d’admission 31 août 2022")
|
2021-12-15 15:25:02 +01:00
|
|
|
|
expect(page).to have_content('code de la commune 75106')
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content('UAI 0751722P')
|
|
|
|
|
expect(page).to have_content('nom Université Pierre et Marie Curie - UPCM (Paris 6)')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
context 'DGFiP' do
|
2023-05-16 17:55:44 +02:00
|
|
|
|
scenario 'it can fill a DGFiP field', vcr: { cassette_name: 'api_particulier/success/avis_imposition' } do
|
2022-06-16 14:56:53 +02:00
|
|
|
|
visit commencer_path(path: procedure.path)
|
|
|
|
|
click_on 'Commencer la démarche'
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2023-09-18 18:15:28 +02:00
|
|
|
|
find('label', text: 'Madame').click
|
|
|
|
|
fill_in('Nom', with: 'FERRI')
|
|
|
|
|
fill_in('Prénom', with: 'Karine')
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
click_button('Continuer')
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
fill_in 'Le numéro fiscal', with: numero_fiscal
|
2022-12-01 13:41:12 +01:00
|
|
|
|
fill_in "La référence d’avis d’imposition", with: 'wrong_code'
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
dossier = Dossier.last
|
2022-11-10 22:21:14 +01:00
|
|
|
|
dgfip_champ = dossier.champs_public.find(&:dgfip?)
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-10-25 13:52:52 +02:00
|
|
|
|
wait_until { dgfip_champ.reload.reference_avis == 'wrong_code' }
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
click_on 'Déposer le dossier'
|
2023-09-19 11:07:50 +02:00
|
|
|
|
expect(page).to have_content(/dgfip doit posséder 13 ou 14 caractères/)
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2023-05-16 17:55:44 +02:00
|
|
|
|
fill_in "La référence d’avis d’imposition", with: reference_avis
|
2023-10-26 16:02:23 +02:00
|
|
|
|
wait_until { dgfip_champ.reload.external_id.present? }
|
|
|
|
|
|
2023-05-16 17:55:44 +02:00
|
|
|
|
click_on 'Déposer le dossier'
|
|
|
|
|
perform_enqueued_jobs
|
|
|
|
|
|
2022-10-28 11:12:39 +02:00
|
|
|
|
expect(page).to have_current_path(merci_dossier_path(Dossier.last))
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2023-05-11 16:56:43 +02:00
|
|
|
|
perform_enqueued_jobs
|
2023-05-10 10:41:17 +02:00
|
|
|
|
wait_until { dgfip_champ.reload.data.present? }
|
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
visit demande_dossier_path(dossier)
|
|
|
|
|
expect(page).to have_content(/Des données.*ont été reçues depuis la DGFiP/)
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
log_out
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
login_as instructeur.user, scope: :user
|
|
|
|
|
|
|
|
|
|
visit instructeur_dossier_path(procedure, dossier)
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
expect(page).to have_content('nom FERRI')
|
|
|
|
|
expect(page).to have_content('nom de naissance FERRI')
|
|
|
|
|
expect(page).to have_content('prénoms Karine')
|
|
|
|
|
expect(page).to have_content('date de naissance 12/08/1978')
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
expect(page).to have_content('date de recouvrement 09/10/2020')
|
|
|
|
|
expect(page).to have_content("date d’établissement 07/07/2020")
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
expect(page).to have_content('année 2020')
|
|
|
|
|
expect(page).to have_content("adresse fiscale de l’année passée 13 rue de la Plage 97615 Pamanzi")
|
|
|
|
|
expect(page).to have_content('nombre de parts 1')
|
|
|
|
|
expect(page).to have_content('situation familiale Célibataire')
|
|
|
|
|
expect(page).to have_content('nombre de personnes à charge 0')
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
expect(page).to have_content('revenu brut global 38814')
|
|
|
|
|
expect(page).to have_content('revenu imposable 38814')
|
|
|
|
|
expect(page).to have_content('impôt sur le revenu net avant correction 38814')
|
|
|
|
|
expect(page).to have_content("montant de l’impôt 38814")
|
|
|
|
|
expect(page).to have_content('revenu fiscal de référence 38814')
|
|
|
|
|
expect(page).to have_content("année d’imposition 2020")
|
|
|
|
|
expect(page).to have_content('année des revenus 2020')
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
expect(page).to have_content('situation partielle SUP DOM')
|
2021-11-24 17:30:35 +01:00
|
|
|
|
|
2022-06-16 14:56:53 +02:00
|
|
|
|
expect(page).not_to have_content('erreur correctif')
|
|
|
|
|
end
|
2021-11-24 17:30:35 +01:00
|
|
|
|
end
|
2021-09-28 15:11:15 +02:00
|
|
|
|
end
|
|
|
|
|
end
|