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
23 changes: 20 additions & 3 deletions lib/tasks/review_profile.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ namespace :users do
namespace :review do
desc 'Pass a user that has a pending review'
task pass: :environment do |_task, args|
user_uuid = STDIN.getpass('Enter the User UUID to pass (input will be hidden):')
STDOUT.sync = true
print 'Enter the name of the investigator: '
investigator_name = STDIN.gets.chomp
print 'Enter the issue/ticket/reason for the investigation: '
investigation_number = STDIN.gets.chomp
print 'Enter the User UUID to pass: '
user_uuid = STDIN.gets.chomp
puts "investigator name: #{investigator_name}"
puts "investigation reason: #{investigation_number}"
puts "uuid: #{user_uuid}"
user = User.find_by(uuid: user_uuid)

if user.fraud_review_pending? && user.proofing_component.review_eligible?
Expand Down Expand Up @@ -35,14 +44,22 @@ namespace :users do

desc 'Reject a user that has a pending review'
task reject: :environment do |_task, args|
user_uuid = STDIN.getpass('Enter the User UUID to reject (input will be hidden):')
STDOUT.sync = true
print 'Enter the name of the investigator: '
investigator_name = STDIN.gets.chomp
print 'Enter the issue/ticket/reason for the investigation: '
investigation_number = STDIN.gets.chomp
print 'Enter the User UUID to reject: '
user_uuid = STDIN.gets.chomp
puts "investigator name: #{investigator_name}"
puts "investigation reason: #{investigation_number}"
puts "uuid: #{user_uuid}"
user = User.find_by(uuid: user_uuid)

if user.fraud_review_pending? && user.proofing_component.review_eligible?
profile = user.fraud_review_pending_profile

profile.reject_for_fraud(notify_user: true)

puts "User's profile has been deactivated due to fraud rejection."
elsif !user.proofing_component.review_eligible?
puts 'User is past the 30 day review eligibility'
Expand Down
9 changes: 8 additions & 1 deletion lib/tasks/users_lookup.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ namespace :users do
desc 'Look up a user by email address'
task lookup_by_email: :environment do |_task, args|
require 'io/console'
STDOUT.sync = true
print 'Enter the name of the investigator: '
investigator_name = STDIN.gets.chomp
print 'Enter the issue/ticket/reason for the investigation: '
investigation_number = STDIN.gets.chomp
email = STDIN.getpass('Enter the email address to look up (input will be hidden): ')
puts "investigator name: #{investigator_name}"
puts "investigation reason: #{investigation_number}"
user = User.find_with_email(email)
if user.present?
puts "uuid: #{user.uuid}"
else
puts 'No user found'
puts 'uuid: Not Found'
end
end
end
6 changes: 5 additions & 1 deletion spec/lib/tasks/review_profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
before do
Rake.application.rake_require('lib/tasks/review_profile', [Rails.root.to_s])
Rake::Task.define_task(:environment)
allow(STDIN).to receive(:getpass) { user.uuid }
allow(STDIN).to receive(:gets).and_return(
"John Doe\n",
"Rspec Test\n",
user.uuid,
)
end

describe 'users:review:pass' do
Expand Down