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
7 changes: 0 additions & 7 deletions app/models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions spec/factories/profiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
49 changes: 28 additions & 21 deletions spec/features/idv/steps/gpo_otp_verification_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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')

Expand Down
28 changes: 0 additions & 28 deletions spec/models/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions spec/services/idv/profile_maker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down