Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the resend functionality from the RequestLetterController #10866

Merged
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
59 changes: 3 additions & 56 deletions app/controllers/idv/by_mail/request_letter_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,25 @@ module ByMail
class RequestLetterController < ApplicationController
include Idv::AvailabilityConcern
include IdvStepConcern
skip_before_action :confirm_no_pending_gpo_profile
include Idv::StepIndicatorConcern
include VerifyByMailConcern

before_action :confirm_mail_not_rate_limited
before_action :confirm_step_allowed
before_action :confirm_profile_not_too_old

def index
@applicant = idv_session.applicant
@presenter = RequestLetterPresenter.new(current_user, url_options)

Funnel::DocAuth::RegisterStep.new(current_user.id, current_sp&.issuer).
call(:usps_address, :view, true)
analytics.idv_request_letter_visited(
letter_already_sent: @presenter.resend_requested?,
)
analytics.idv_request_letter_visited
end

def create
clear_future_steps!
update_tracking
idv_session.address_verification_mechanism = :gpo

if resend_requested? && pii_locked?
redirect_to capture_password_url
elsif resend_requested?
resend_letter
flash[:success] = t('idv.messages.gpo.another_letter_on_the_way')
redirect_to idv_letter_enqueued_url
else
redirect_to idv_enter_password_url
end
redirect_to idv_enter_password_url
end

def self.step_info
Expand All @@ -55,59 +41,20 @@ def self.step_info

private

def confirm_profile_not_too_old
redirect_to idv_path if gpo_verify_by_mail_policy.profile_too_old?
end

def update_tracking
Funnel::DocAuth::RegisterStep.new(current_user.id, current_sp&.issuer).
call(:usps_letter_sent, :update, true)

log_letter_requested_analytics(resend: resend_requested?)
log_letter_requested_analytics(resend: false)
create_user_event(:gpo_mail_sent, current_user)

ProofingComponent.find_or_create_by(user: current_user).update(address_check: 'gpo_letter')
end

def resend_requested?
current_user.gpo_verification_pending_profile?
end

def confirm_mail_not_rate_limited
redirect_to idv_enter_password_url if gpo_verify_by_mail_policy.rate_limited?
end

def resend_letter
log_letter_enqueued_analytics(resend: true)
confirmation_maker = confirmation_maker_perform
send_reminder
return unless FeatureManagement.reveal_gpo_code?
session[:last_gpo_confirmation_code] = confirmation_maker.otp
end

def confirmation_maker_perform
confirmation_maker = GpoConfirmationMaker.new(
pii: pii,
service_provider: current_sp,
profile: current_user.pending_profile,
)
confirmation_maker.perform
confirmation_maker
end

def pii
Pii::Cacher.new(current_user, user_session).
fetch(current_user.gpo_verification_pending_profile.id)
end

def send_reminder
current_user.send_email_to_all_addresses(:verify_by_mail_letter_requested)
end

def pii_locked?
!Pii::Cacher.new(current_user, user_session).exists_in_session?
end

def step_indicator_steps
if in_person_proofing?
Idv::Flows::InPersonFlow::STEP_INDICATOR_STEPS_GPO
Expand Down
59 changes: 0 additions & 59 deletions app/presenters/idv/by_mail/request_letter_presenter.rb

This file was deleted.

3 changes: 0 additions & 3 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3261,16 +3261,13 @@ def idv_proofing_resolution_result_missing(
)
end

# @param [Boolean] letter_already_sent
# GPO "request letter" page visited
# @identity.idp.previous_event_name IdV: USPS address visited
def idv_request_letter_visited(
letter_already_sent:,
**extra
)
track_event(
'IdV: request letter visited',
letter_already_sent: letter_already_sent,
**extra,
)
end
Expand Down
107 changes: 44 additions & 63 deletions app/views/idv/by_mail/request_letter/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,77 +9,58 @@
) %>
<% end %>

<% if @presenter.resend_requested? %>
<%= render PageHeadingComponent.new.with_content(@presenter.title) %>
<p>
<%= t('idv.gpo.request_another_letter.instructions_html') %>
</p>
<p>
<%= new_tab_link_to(
t('idv.gpo.request_another_letter.learn_more_link'),
help_center_redirect_url(
category: 'verify-your-identity',
article: 'verify-your-address-by-mail',
flow: :idv,
step: :gpo_send_letter,
),
) %>
</p>
<% else %>
<%= render AlertComponent.new(
type: :info,
message: t('idv.messages.gpo.info_alert'),
class: 'margin-bottom-4',
) %>
<%= render PageHeadingComponent.new.with_content(@presenter.title) %>
<p>
<%= t('idv.messages.gpo.timeframe_html') %>
<br />
<%= new_tab_link_to(
t('idv.messages.gpo.learn_more_verify_by_mail'),
help_center_redirect_url(
category: 'verify-your-identity',
article: 'verify-your-address-by-mail',
flow: :idv,
step: :gpo_send_letter,
),
)
%>
</p>
<p>
<%= t('idv.messages.gpo.address_on_file') %>
</p>
<%= render AlertComponent.new(
type: :info,
message: t('idv.messages.gpo.info_alert'),
class: 'margin-bottom-4',
) %>

<%= render PageHeadingComponent.new.with_content(t('idv.titles.mail.verify')) %>

<p>
<%= t('idv.messages.gpo.timeframe_html') %>
<br />
<%= new_tab_link_to(
t('idv.messages.gpo.learn_more_verify_by_mail'),
help_center_redirect_url(
category: 'verify-your-identity',
article: 'verify-your-address-by-mail',
flow: :idv,
step: :gpo_send_letter,
),
)
%>
</p>
<p>
<%= t('idv.messages.gpo.address_on_file') %>
</p>

<p>
<%= @applicant[:address1] %>
<br />
<% if @applicant[:address2] %>
<%= @applicant[:address2] %>
<br />
<% end %>
<%= @applicant[:city] %>, <%= @applicant[:state] %> <%= @applicant[:zipcode] %>
<br />
</p>
<p>
<%= render 'shared/address',
address: @applicant.slice(:address1, :address2, :city, :state, :zipcode)
%>
</p>

<p>
<%= start_over_link_html = link_to(
<p>
<%= t(
'idv.messages.gpo.start_over_html',
start_over_link_html: link_to(
t('idv.messages.gpo.start_over_link_text'),
idv_confirm_start_over_before_letter_path,
)
t(
'idv.messages.gpo.start_over_html',
start_over_link_html: start_over_link_html,
)
%>
</p>

<% end %>
),
)
%>
</p>

<div class="margin-y-5">
<%= button_to @presenter.button,
<%= button_to t('idv.buttons.mail.send'),
idv_request_letter_path,
method: 'put',
class: 'usa-button usa-button--big usa-button--wide' %>
</div>

<%= render @presenter.back_or_cancel_partial, @presenter.back_or_cancel_parameters %>
<% if FeatureManagement.idv_by_mail_only? %>
<%= render 'idv/doc_auth/cancel', step: 'gpo' %>
<% else %>
<%= render 'idv/shared/back', fallback_path: idv_phone_path %>
<% end %>
Loading