Skip to content
Merged
21 changes: 21 additions & 0 deletions app/controllers/concerns/idv/outage_concern.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Idv
module OutageConcern
extend ActiveSupport::Concern

def check_for_outage
return if flow_session[:skip_vendor_outage]
Comment thread
amirbey marked this conversation as resolved.
Outdated

return redirect_for_gpo_only if FeatureManagement.idv_gpo_only?
end

def redirect_for_gpo_only
return redirect_to vendor_outage_url unless FeatureManagement.gpo_verification_enabled?

# During a phone outage, skip the hybrid handoff
# step and go straight to document upload
flow_session[:skip_upload_step] = true unless FeatureManagement.idv_allow_hybrid_flow?

redirect_to idv_mail_only_warning_url
end
end
end
20 changes: 1 addition & 19 deletions app/controllers/idv/doc_auth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class DocAuthController < ApplicationController
include Flow::FlowStateMachine
include Idv::ThreatMetrixConcern
include FraudReviewConcern
include Idv::OutageConcern

before_action :redirect_if_flow_completed
before_action :handle_fraud
Expand Down Expand Up @@ -56,24 +57,5 @@ def do_meta_refresh(meta_refresh_count)
def flow_session
user_session['idv/doc_auth']
end

def check_for_outage
return if flow_session[:skip_vendor_outage]

return redirect_for_gpo_only if FeatureManagement.idv_gpo_only?
end

def redirect_for_gpo_only
return redirect_to vendor_outage_url unless FeatureManagement.gpo_verification_enabled?

# During a phone outage, skip the hybrid handoff
# step and go straight to document upload
flow_session[:skip_upload_step] = true unless FeatureManagement.idv_allow_hybrid_flow?

session[:vendor_outage_redirect] = current_step

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.

Yay!! love deleting unused session vars!

session[:vendor_outage_redirect_from_idv] = true

redirect_to idv_mail_only_warning_url
end
end
end
2 changes: 2 additions & 0 deletions app/controllers/idv/document_capture_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class DocumentCaptureController < ApplicationController
include DocumentCaptureConcern
include IdvSession
include IdvStepConcern
include OutageConcern
Comment on lines 6 to +7

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.

We talked about including OutageConcern in IdvStepConcern and putting the before action there. Did something end up blocking that?

@amirbey amirbey Jun 6, 2023

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.

I attempted this suggestion; however, the feature tests kept failing ... perhaps this can be refactored in a future iteration.

include StepIndicatorConcern
include StepUtilitiesConcern
include RateLimitConcern
Expand All @@ -12,6 +13,7 @@ class DocumentCaptureController < ApplicationController
before_action :confirm_upload_step_complete
before_action :confirm_document_capture_needed
before_action :override_csp_to_allow_acuant
before_action :check_for_outage, only: :show

def show
analytics.idv_doc_auth_document_capture_visited(**analytics_arguments)
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/idv/hybrid_handoff_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ class HybridHandoffController < ApplicationController
include ActionView::Helpers::DateHelper
include IdvSession
include IdvStepConcern
include OutageConcern
include StepIndicatorConcern
include StepUtilitiesConcern

before_action :confirm_two_factor_authenticated
before_action :confirm_agreement_step_complete
before_action :confirm_hybrid_handoff_needed, only: :show
before_action :check_for_outage, only: :show

def show
analytics.idv_doc_auth_upload_visited(**analytics_arguments)
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/idv/in_person/verify_info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ class VerifyInfoController < ApplicationController
include StepUtilitiesConcern
include Steps::ThreatMetrixStepHelper
include VerifyInfoConcern
include OutageConcern

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.

added as suggested by @tomas-nava 👍🏿


before_action :renders_404_if_flag_not_set
before_action :confirm_ssn_step_complete
before_action :confirm_verify_info_step_needed
before_action :check_for_outage, only: :show

def show
@step_indicator_steps = step_indicator_steps
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/idv/link_sent_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ class LinkSentController < ApplicationController
include DocumentCaptureConcern
include IdvSession
include IdvStepConcern
include OutageConcern
include StepIndicatorConcern
include StepUtilitiesConcern

before_action :confirm_two_factor_authenticated
before_action :confirm_upload_step_complete
before_action :confirm_document_capture_needed
before_action :extend_timeout_using_meta_refresh
before_action :check_for_outage, only: :show

def show
analytics.idv_doc_auth_link_sent_visited(**analytics_arguments)
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/idv/phone_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Idv
class PhoneController < ApplicationController
include IdvStepConcern
include StepIndicatorConcern
include OutageConcern
include PhoneOtpRateLimitable
include PhoneOtpSendable

Expand All @@ -10,6 +11,9 @@ class PhoneController < ApplicationController
before_action :confirm_verify_info_step_complete
before_action :confirm_step_needed
before_action :set_idv_form
# rubocop:disable Rails/LexicallyScopedActionFilter
before_action :check_for_outage, only: :show

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.

Why did rubocop complain about this one and not the others?

# rubocop:enable Rails/LexicallyScopedActionFilter

def new
analytics.idv_phone_use_different(step: params[:step]) if params[:step]
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/idv/ssn_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Idv
class SsnController < ApplicationController
include IdvSession
include IdvStepConcern
include OutageConcern
include StepIndicatorConcern
include StepUtilitiesConcern
include Steps::ThreatMetrixStepHelper
Expand All @@ -10,6 +11,7 @@ class SsnController < ApplicationController
before_action :confirm_verify_info_step_needed
before_action :confirm_document_capture_complete
before_action :override_csp_for_threat_metrix_no_fsm
before_action :check_for_outage, only: :show

attr_accessor :error_message

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/idv/verify_info_controller.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module Idv
class VerifyInfoController < ApplicationController
include IdvStepConcern
include OutageConcern
include StepUtilitiesConcern
include StepIndicatorConcern
include VerifyInfoConcern
include Steps::ThreatMetrixStepHelper

before_action :confirm_ssn_step_complete
before_action :confirm_verify_info_step_needed
before_action :check_for_outage, only: :show

def show
@step_indicator_steps = step_indicator_steps
Expand Down