Skip to content
Closed
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
11 changes: 10 additions & 1 deletion app/presenters/account_show_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ def pending_idv?
end

def pending_ipp?
!!user.pending_profile&.in_person_verification_pending?
in_person_enrollment = user&.in_person_enrollments&.first
if in_person_enrollment&.expired?
user.pending_in_person_enrollment.present?
elsif in_person_enrollment&.cancelled?
user.pending_in_person_enrollment.present?
elsif in_person_enrollment&.failed?
user.pending_in_person_enrollment.present?
else
!!user.pending_profile&.in_person_verification_pending?
end
Comment on lines +66 to +75
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.

Maybe simpler option to check that the enrollment associated with the pending profile is explicitly pending?

Suggested change
in_person_enrollment = user&.in_person_enrollments&.first
if in_person_enrollment&.expired?
user.pending_in_person_enrollment.present?
elsif in_person_enrollment&.cancelled?
user.pending_in_person_enrollment.present?
elsif in_person_enrollment&.failed?
user.pending_in_person_enrollment.present?
else
!!user.pending_profile&.in_person_verification_pending?
end
!!user.pending_profile&.in_person_enrollment&.pending?

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.

Thanks for the feedback. 🙏🏻 I am going to close this PR because, as Gina mentioned here, Joy decided to backfill the data. This PR is no longer relevant.

(I am going to merge the regression specs in a separate PR.)

end

def pending_gpo?
Expand Down
32 changes: 32 additions & 0 deletions spec/views/accounts/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,38 @@
end
end

context 'when current user has an in_person_enrollment that was failed' do
let(:vtr) { ['Pe'] }
let(:sp_name) { 'sinatra-test-app' }
let(:user) { create(:user, :with_pending_in_person_enrollment, :with_multiple_emails) }

before do
# Make the in_person_enrollment and associated profile failed
in_person_enrollment = user.in_person_enrollments.first
in_person_enrollment.update!(status: :failed, status_check_completed_at: Time.zone.now)
end

it 'renders the idv partial' do
expect(render).to render_template(partial: 'accounts/_identity_verification')
end
end

context 'when current user has an in_person_enrollment that was cancelled' do
let(:vtr) { ['Pe'] }
let(:sp_name) { 'sinatra-test-app' }
let(:user) { build(:user, :with_pending_in_person_enrollment) }

before do
# Make the in_person_enrollment and associated profile cancelled
in_person_enrollment = user.in_person_enrollments.first
in_person_enrollment.update!(status: :cancelled, status_check_completed_at: Time.zone.now)
end

it 'renders the idv partial' do
expect(render).to render_template(partial: 'accounts/_identity_verification')
end
end

context 'when current user has an in_person_enrollment that expired' do
let(:vtr) { ['Pe'] }
let(:sp_name) { 'sinatra-test-app' }
Expand Down