diff --git a/app/models/profile.rb b/app/models/profile.rb index 16d5082ac8e..b8e59cf7569 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -189,13 +189,6 @@ def deactivate_for_fraud_review ) end - def bump_fraud_review_pending_timestamps - update!( - fraud_review_pending_at: Time.zone.now, - fraud_rejection_at: nil, - ) - end - def reject_for_fraud(notify_user:) update!( active: false, diff --git a/spec/factories/profiles.rb b/spec/factories/profiles.rb index e906b2f6e64..8d05154518e 100644 --- a/spec/factories/profiles.rb +++ b/spec/factories/profiles.rb @@ -52,6 +52,7 @@ gpo_verification_pending_at { 1.day.ago } end + # flagged by TM for review, eventually rejected by us trait :fraud_rejection do fraud_pending_reason { 'threatmetrix_review' } fraud_rejection_at { 15.days.ago } diff --git a/spec/features/idv/steps/gpo_otp_verification_step_spec.rb b/spec/features/idv/steps/gpo_otp_verification_step_spec.rb index c7109e1f5f2..52916a4d67d 100644 --- a/spec/features/idv/steps/gpo_otp_verification_step_spec.rb +++ b/spec/features/idv/steps/gpo_otp_verification_step_spec.rb @@ -7,18 +7,8 @@ let(:profile) do create( :profile, - deactivation_reason: 3, - gpo_verification_pending_at: 2.days.ago, - pii: { - address1: '1 Secure Way', - address2: 'Unit #4', - city: 'Loginville', - state: 'DC', - zipcode: '11111', - ssn: '123-45-6789', - dob: '1970-01-01', - }, - fraud_pending_reason: fraud_pending_reason, + :verify_by_mail_pending, + :with_pii, ) end let(:gpo_confirmation_code) do @@ -30,7 +20,6 @@ end let(:user) { profile.user } let(:threatmetrix_enabled) { false } - let(:fraud_pending_reason) { nil } let(:redirect_after_verification) { nil } let(:profile_should_be_active) { true } let(:fraud_review_pending) { false } @@ -44,7 +33,14 @@ context 'ThreatMetrix disabled, but we have ThreatMetrix status on proofing component' do let(:threatmetrix_enabled) { false } - let(:fraud_pending_reason) { 'threatmetrix_review' } + let(:profile) do + create( + :profile, + :verify_by_mail_pending, + :with_pii, + fraud_pending_reason: 'threatmetrix_review', + ) + end it_behaves_like 'gpo otp verification' end @@ -56,21 +52,32 @@ end context 'ThreatMetrix says "review"' do - let(:fraud_pending_reason) { 'threatmetrix_review' } let(:profile_should_be_active) { false } - let(:fraud_review_pending) { true } + let(:profile) do + create( + :profile, + :verify_by_mail_pending, + :with_pii, + fraud_pending_reason: 'threatmetrix_review', + ) + end it_behaves_like 'gpo otp verification' end context 'ThreatMetrix says "reject"' do - let(:fraud_pending_reason) { 'threatmetrix_reject' } let(:profile_should_be_active) { false } - let(:fraud_review_pending) { true } + let(:profile) do + create( + :profile, + :verify_by_mail_pending, + :with_pii, + fraud_pending_reason: 'threatmetrix_reject', + ) + end it_behaves_like 'gpo otp verification' end context 'No ThreatMetrix result on proofing component' do - let(:fraud_pending_reason) { nil } it_behaves_like 'gpo otp verification' end end @@ -135,13 +142,13 @@ end end - it 'allows a user to cancel and start over withinthe banner' do + it 'allows a user to cancel and start over within the banner' do sign_in_live_with_2fa(user) expect(current_path).to eq idv_verify_by_mail_enter_code_path expect(page).to have_content t('idv.gpo.alert_info') expect(page).to have_content t('idv.gpo.wrong_address') - expect(page).to have_content '1 Secure Way' + expect(page).to have_content Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE[:address1] click_on t('idv.gpo.clear_and_start_over') diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb index 8adea5833d9..fbef249cc90 100644 --- a/spec/models/profile_spec.rb +++ b/spec/models/profile_spec.rb @@ -1054,34 +1054,6 @@ end end - describe '#bump_fraud_review_pending_timestamps' do - context 'a profile is fraud review pending' do - it 'updates the fraud review pending timestamp' do - profile = create(:profile, :fraud_review_pending, user: user) - - profile.bump_fraud_review_pending_timestamps - - expect(profile).to_not be_active - expect(profile.fraud_review_pending?).to eq(true) - expect(profile.fraud_rejection?).to eq(false) - expect(profile.fraud_pending_reason).to eq('threatmetrix_review') - end - end - - context 'a profile is fraud review rejected' do - it 'removes the fraud rejection timestamp and updates the fraud review pending timestamp' do - profile = create(:profile, :fraud_rejection, user: user) - - profile.bump_fraud_review_pending_timestamps - - expect(profile).to_not be_active - expect(profile.fraud_review_pending?).to eq(true) - expect(profile.fraud_rejection?).to eq(false) - expect(profile.fraud_pending_reason).to eq('threatmetrix_review') - end - end - end - describe '#reject_for_fraud' do before do # This is necessary because UserMailer reaches into the diff --git a/spec/services/idv/profile_maker_spec.rb b/spec/services/idv/profile_maker_spec.rb index a2ec10138c4..421bdafa63d 100644 --- a/spec/services/idv/profile_maker_spec.rb +++ b/spec/services/idv/profile_maker_spec.rb @@ -29,6 +29,7 @@ expect(profile.id).to_not be_nil expect(profile.encrypted_pii).to_not be_nil expect(profile.encrypted_pii).to_not match('Some') + expect(profile.fraud_pending_reason).to be_nil expect(profile.proofing_components).to match(proofing_component.as_json) expect(profile.active).to eq(false) expect(profile.deactivation_reason).to be_nil @@ -49,6 +50,7 @@ expect(profile.activated_at).to be_nil expect(profile.active).to eq(false) expect(profile.deactivation_reason).to eq('encryption_error') + expect(profile.fraud_pending_reason).to be_nil expect(profile.fraud_review_pending?).to eq(false) expect(profile.gpo_verification_pending_at.present?).to eq(false) expect(profile.initiating_service_provider).to eq(nil) @@ -68,6 +70,7 @@ expect(profile.activated_at).to be_nil expect(profile.active).to eq(false) expect(profile.deactivation_reason).to be_nil + expect(profile.fraud_pending_reason).to eq('threatmetrix_review') expect(profile.fraud_review_pending?).to eq(true) expect(profile.gpo_verification_pending_at.present?).to eq(false) expect(profile.initiating_service_provider).to eq(nil) @@ -87,6 +90,7 @@ expect(profile.activated_at).to be_nil expect(profile.active).to eq(false) expect(profile.deactivation_reason).to be_nil + expect(profile.fraud_pending_reason).to be_nil expect(profile.fraud_review_pending?).to eq(false) expect(profile.gpo_verification_pending_at.present?).to eq(true) expect(profile.initiating_service_provider).to eq(nil) @@ -106,6 +110,7 @@ expect(profile.activated_at).to be_nil expect(profile.active).to eq(false) expect(profile.deactivation_reason).to be_nil + expect(profile.fraud_pending_reason).to be_nil expect(profile.in_person_verification_pending?).to eq(true) expect(profile.fraud_review_pending?).to eq(false) expect(profile.gpo_verification_pending_at.present?).to eq(false) @@ -126,6 +131,7 @@ expect(profile.activated_at).to be_nil expect(profile.active).to eq(false) expect(profile.deactivation_reason).to be_nil + expect(profile.fraud_pending_reason).to be_nil expect(profile.fraud_review_pending?).to eq(false) expect(profile.gpo_verification_pending_at.present?).to eq(false) expect(profile.initiating_service_provider).to eq(nil) @@ -147,6 +153,7 @@ expect(profile.activated_at).to be_nil expect(profile.active).to eq(false) expect(profile.deactivation_reason).to be_nil + expect(profile.fraud_pending_reason).to be_nil expect(profile.fraud_review_pending?).to eq(false) expect(profile.gpo_verification_pending_at.present?).to eq(false) expect(profile.initiating_service_provider).to eq(initiating_service_provider)