Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/controllers/idv/in_person/passport_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def show
end

def update
enrollment.update!(document_type: :passport_book)
redirect_to idv_in_person_address_path
end

Expand Down Expand Up @@ -52,6 +53,10 @@ def analytics_arguments
.merge(extra_analytics_properties)
end

def enrollment
current_user.establishing_in_person_enrollment
end

def initialize_pii_from_user
user_session['idv/in_person'] ||= {}
user_session['idv/in_person']['pii_from_user'] ||= { uuid: current_user.uuid }
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@
put '/in_person' => 'in_person#update'
get '/in_person/choose_id_type' => 'in_person/choose_id_type#show'
put '/in_person/choose_id_type' => 'in_person/choose_id_type#update'
get '/in_person/passport' => 'in_person/passport#show'
Copy link
Copy Markdown
Contributor Author

@gina-yamada gina-yamada May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate from https://github.com/18F/identity-idp/pull/12134/files
You can see get route exists below on line 452/451

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

get '/in_person/ready_to_verify' => 'in_person/ready_to_verify#show',
as: :in_person_ready_to_verify
post '/in_person/usps_locations' => 'in_person/usps_locations#index'
Expand Down
22 changes: 15 additions & 7 deletions spec/controllers/idv/in_person/passport_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
create(:document_capture_session, user:, passport_status: 'requested')
end
let(:idv_session) { subject.idv_session }
let(:enrollment) { InPersonEnrollment.new }
let(:enrollment) { create(:in_person_enrollment, :establishing, user: user) }

before do
stub_sign_in(user)
Expand Down Expand Up @@ -71,6 +71,7 @@

it 'renders the passport form' do
expect(response).to render_template 'idv/in_person/passport/show'
expect(enrollment.document_type).to eq(nil)
end

it 'logs the idv_in_person_proofing_passport_visited event' do
Expand Down Expand Up @@ -99,13 +100,20 @@
end

describe '#update' do
before do
allow(idv_session).to receive(:in_person_passports_allowed?).and_return(true)
put :update
end
context 'when in person passports are allowed' do
before do
allow(idv_session).to receive(:in_person_passports_allowed?).and_return(true)
expect(enrollment.document_type).to eq(nil)
put :update
end

it 'redirects to the address form' do
expect(response).to redirect_to(idv_in_person_address_path)
it 'sets the enrollment document type' do
expect(enrollment.document_type).to eq(InPersonEnrollment::DOCUMENT_TYPE_PASSPORT_BOOK)
end

it 'redirects to the address form' do
expect(response).to redirect_to(idv_in_person_address_path)
end
end
end
end
4 changes: 4 additions & 0 deletions spec/factories/in_person_enrollments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,9 @@
trait :state_id do
document_type { :state_id }
end

trait :passport_book do
document_type { :passport_book }
end
end
end