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
21 changes: 21 additions & 0 deletions app/controllers/api/verify/password_confirm_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,27 @@ def save_in_person_enrollment(user, profile)
enrollment = InPersonEnrollment.create!(
profile: profile,
user: user,
Comment thread
sheldon-b marked this conversation as resolved.
current_address_matches_id: user_session.dig(:idv, :applicant, :same_address_as_id),
selected_location_details: {
'name' => 'BALTIMORE — Post Office™',
'streetAddress' => '900 E FAYETTE ST RM 118',
'city' => 'BALTIMORE',
'state' => 'MD',
'zip5' => '21233',
'zip4' => '9715',
'phone' => '555-123-6409',
'hours' => [
{
'weekdayHours' => '8:30 AM - 4:30 PM',
},
{
'saturdayHours' => '9:00 AM - 12:00 PM',
},
{
'sundayHours' => 'Closed',
},
],
},
Comment on lines +100 to +119
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a temporary solution. Once the user's location selection is saved to the session we will begin using that value instead of this hard-coded value

)

enrollment_code = create_usps_enrollment(enrollment)
Expand Down
27 changes: 1 addition & 26 deletions app/controllers/idv/in_person/ready_to_verify_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,7 @@ def confirm_in_person_session
end

def enrollment
InPersonEnrollment.new(
user: current_user,
enrollment_code: '2048702198804358',
created_at: Time.zone.now,
current_address_matches_id: true,
selected_location_details: {
'name' => 'BALTIMORE — Post Office™',
'streetAddress' => '900 E FAYETTE ST RM 118',
'city' => 'BALTIMORE',
'state' => 'MD',
'zip5' => '21233',
'zip4' => '9715',
'phone' => '555-123-6409',
'hours' => [
{
'weekdayHours' => '8:30 AM - 4:30 PM',
},
{
'saturdayHours' => '9:00 AM - 12:00 PM',
},
{
'sundayHours' => 'Closed',
},
],
},
)
current_user.pending_in_person_enrollment
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
describe Idv::InPerson::ReadyToVerifyController do
let(:user) { create(:user) }
let(:in_person_proofing_enabled) { false }
let(:enrollment) { nil }

before do
stub_analytics
stub_sign_in(user)
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).
and_return(in_person_proofing_enabled)
allow(controller).to receive(:enrollment).and_return(enrollment)
end

describe 'before_actions' do
Expand All @@ -34,15 +32,8 @@
end

context 'with enrollment' do
let(:user) { create(:user, :with_pending_in_person_enrollment) }
let(:profile) { create(:profile, :with_pii, user: user) }
let(:enrollment) do
InPersonEnrollment.new(
user: user,
profile: profile,
enrollment_code: '2048702198804358',
created_at: Time.zone.now,
)
end

it 'renders show template' do
expect(response).to render_template :show
Expand Down
7 changes: 7 additions & 0 deletions spec/factories/in_person_enrollments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
factory :in_person_enrollment do
user { association :user, :signed_up }
profile { association :profile, user: user }

trait :pending do
after :build do |enrollment|
enrollment.status = :pending
enrollment.enrollment_code = Faker::Number.number(digits: 16)
end
end
end
end
7 changes: 7 additions & 0 deletions spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@
end
end

trait :with_pending_in_person_enrollment do
after :build do |user|
profile = create(:profile, :with_pii, user: user)
create(:in_person_enrollment, :pending, user: user, profile: profile)
end
end

trait :deactivated_password_reset_profile do
signed_up

Expand Down
7 changes: 6 additions & 1 deletion spec/features/idv/in_person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
allow(IdentityConfig.store).to receive(:idv_api_enabled_steps).and_return(
['password_confirm',
'personal_key',
'personal_key_confirm'],
)
end

it 'works for a happy path', allow_browser_log: true do
Expand Down Expand Up @@ -84,7 +89,7 @@
end

# ready to verify page
enrollment_code = JSON.parse(UspsIppFixtures.request_enrollment_code_response)['enrollmentCode']
enrollment_code = JSON.parse(UspsIppFixtures.request_enroll_response)['enrollmentCode']
expect(page).to have_content(t('in_person_proofing.headings.barcode'))
expect(page).to have_content(Idv::InPerson::EnrollmentCodeFormatter.format(enrollment_code))
expect(page).to have_content(t('in_person_proofing.body.barcode.deadline', deadline: deadline))
Expand Down