feat(demarche): sign up when prefilling a dossier (#8247)

* store prefill params in session

Instead of using query params on /dossier/new, we assume the user comes
from /commencer/:path, which is the new prefill link.

There, we store the prefill params in session, and use them to prefill
the dossier when creating it, in /dossiers/new.

* spec: cover the case

* review: serialize with json instead of yaml

* review: rename method

* review: store only query params

* review: comment why we dont override already stored params
This commit is contained in:
Sébastien Carceles 2022-12-15 10:58:17 +01:00 committed by GitHub
parent 663c13f819
commit b8ff0ba4a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 141 additions and 30 deletions

View file

@ -1,6 +1,7 @@
module Users
class DossiersController < UserController
include DossierHelper
include QueryParamsStoreConcern
layout 'procedure_context', only: [:identite, :update_identite, :siret, :update_siret]
@ -304,7 +305,7 @@ module Users
)
dossier.build_default_individual
dossier.save!
dossier.prefill!(PrefillParams.new(dossier, params).to_a)
dossier.prefill!(PrefillParams.new(dossier, retrieve_and_delete_stored_query_params).to_a)
if dossier.procedure.for_individual
redirect_to identite_dossier_path(dossier)