|
543 | 543 | end
|
544 | 544 | end
|
545 | 545 |
|
| 546 | + context 'when instant verify address proofing results in an exception' do |
| 547 | + let(:document_capture_session) do |
| 548 | + DocumentCaptureSession.create(user:) |
| 549 | + end |
| 550 | + let(:success) { false } |
| 551 | + let(:errors) { {} } |
| 552 | + let(:exception) { nil } |
| 553 | + let(:error_attributes) { nil } |
| 554 | + let(:vendor_name) { 'instantverify_placeholder' } |
| 555 | + let(:async_state) do |
| 556 | + # Here we're trying to match the store to redis -> read from redis flow this data travels |
| 557 | + adjudicated_result = Proofing::Resolution::ResultAdjudicator.new( |
| 558 | + state_id_result: Proofing::StateIdResult.new(success: true), |
| 559 | + phone_finder_result: Proofing::AddressResult.new( |
| 560 | + success: success, |
| 561 | + errors: {}, |
| 562 | + exception: exception, |
| 563 | + vendor_name: 'instant_verify_test', |
| 564 | + ), |
| 565 | + device_profiling_result: Proofing::DdpResult.new(success: true), |
| 566 | + ipp_enrollment_in_progress: false, |
| 567 | + residential_resolution_result: Proofing::Resolution::Result.new(success: true), |
| 568 | + resolution_result: Proofing::Resolution::Result.new( |
| 569 | + success: success, |
| 570 | + errors: {}, |
| 571 | + exception: 'fake exception', |
| 572 | + vendor_name: vendor_name, |
| 573 | + attributes_requiring_additional_verification: error_attributes, |
| 574 | + ), |
| 575 | + same_address_as_id: nil, |
| 576 | + should_proof_state_id: true, |
| 577 | + applicant_pii: Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN, |
| 578 | + ).adjudicated_result.to_h |
| 579 | + |
| 580 | + document_capture_session.create_proofing_session |
| 581 | + |
| 582 | + document_capture_session.store_proofing_result(adjudicated_result) |
| 583 | + |
| 584 | + document_capture_session.load_proofing_result |
| 585 | + end |
| 586 | + before do |
| 587 | + allow(controller).to receive(:load_async_state).and_return(async_state) |
| 588 | + end |
| 589 | + |
| 590 | + context 'address is the only exception' do |
| 591 | + let(:error_attributes) { ['address'] } |
| 592 | + |
| 593 | + it 'redirects user to address warning' do |
| 594 | + put :show |
| 595 | + expect(response).to redirect_to idv_session_errors_address_warning_url |
| 596 | + end |
| 597 | + |
| 598 | + it 'logs an event' do |
| 599 | + get :show |
| 600 | + |
| 601 | + expect(@analytics).to have_logged_event( |
| 602 | + :idv_doc_auth_address_warning_visited, |
| 603 | + step_name: 'verify_info', |
| 604 | + remaining_submit_attempts: kind_of(Numeric), |
| 605 | + ) |
| 606 | + end |
| 607 | + end |
| 608 | + |
| 609 | + context 'there are more instant verify exceptions' do |
| 610 | + let(:error_attributes) { ['address', 'dob', 'ssn'] } |
| 611 | + |
| 612 | + it 'redirects user to address warning' do |
| 613 | + put :show |
| 614 | + expect(response).to redirect_to idv_session_errors_exception_url |
| 615 | + end |
| 616 | + end |
| 617 | + end |
| 618 | + |
546 | 619 | context 'when the resolution proofing job fails and there is no exception' do
|
547 | 620 | before do
|
548 | 621 | allow(controller).to receive(:load_async_state).and_return(async_state)
|
|
0 commit comments