Skip to content

Commit

Permalink
Revert "Move initial efile device collection to income review page an…
Browse files Browse the repository at this point in the history
…d rename…" (#5057)

This reverts commit a4f00eb.
  • Loading branch information
embarnard authored Dec 2, 2024
1 parent 065cc14 commit 12c2b82
Show file tree
Hide file tree
Showing 36 changed files with 194 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ module StateFile
module Questions
class AzPriorLastNamesController < QuestionsController
include ReturnToReviewConcern

def update
update_for_device_id_collection(current_intake&.initial_efile_device_info)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module StateFile
module Questions
class PostDataTransferController < QuestionsController
class DataReviewController < QuestionsController
def edit
super
# Redirect to offboarding here if not eligible
Expand All @@ -16,8 +16,6 @@ def edit
ip_address: ip_for_irs,
intake: current_intake,
)

redirect_to next_path if acts_like_production?
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ class IncomeReviewController < QuestionsController
def set_sorted_vars
@w2s = current_intake.state_file_w2s&.sort_by { |w2| [w2.employee_name, w2.employer_name] }
end

def update
update_for_device_id_collection(current_intake&.initial_efile_device_info)
end
end
end
end
5 changes: 5 additions & 0 deletions app/forms/state_file/az_prior_last_names_form.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
module StateFile
class AzPriorLastNamesForm < QuestionsForm
set_attributes_for :intake, :prior_last_names, :has_prior_last_names
set_attributes_for :state_file_efile_device_info, :device_id

validates :has_prior_last_names, inclusion: { in: %w[yes no], message: :blank }
validates :prior_last_names, presence: true, allow_blank: false, if: -> { has_prior_last_names == "yes" }

def save
efile_info = StateFileEfileDeviceInfo.find_by(event_type: "initial_creation", intake: @intake)
efile_info&.update!(attributes_for(:state_file_efile_device_info))

if has_prior_last_names == "no"
@intake.update(has_prior_last_names: "no", prior_last_names: nil)
else
Expand Down
10 changes: 0 additions & 10 deletions app/forms/state_file/income_review_form.rb

This file was deleted.

4 changes: 4 additions & 0 deletions app/forms/state_file/name_dob_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class NameDobForm < QuestionsForm
:spouse_suffix,
:primary_birth_date_month, :primary_birth_date_day, :primary_birth_date_year,
:spouse_birth_date_month, :spouse_birth_date_day, :spouse_birth_date_year
set_attributes_for :state_file_efile_device_info, :device_id


delegate :ask_months_in_home?,
Expand Down Expand Up @@ -48,6 +49,9 @@ def dependents
end

def save
efile_info = StateFileEfileDeviceInfo.find_by(event_type: "initial_creation", intake: @intake)
efile_info&.update!(attributes_for(:state_file_efile_device_info))

attributes_to_update = {
primary_first_name: primary_first_name,
primary_middle_initial: primary_middle_initial,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/navigation/state_file_az_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class StateFileAzQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::WaitingToLoadDataController),
]),
Navigation::NavigationSection.new("state_file.navigation.section_5", [
Navigation::NavigationStep.new(StateFile::Questions::PostDataTransferController, false),
Navigation::NavigationStep.new(StateFile::Questions::DataReviewController),
Navigation::NavigationStep.new(StateFile::Questions::FederalInfoController),
Navigation::NavigationStep.new(StateFile::Questions::DataTransferOffboardingController, false),
Navigation::NavigationStep.new(StateFile::Questions::NameDobController),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/navigation/state_file_id_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StateFileIdQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::WaitingToLoadDataController),
]),
Navigation::NavigationSection.new("state_file.navigation.section_5", [
Navigation::NavigationStep.new(StateFile::Questions::PostDataTransferController, false),
Navigation::NavigationStep.new(StateFile::Questions::DataReviewController),
Navigation::NavigationStep.new(StateFile::Questions::FederalInfoController),
Navigation::NavigationStep.new(StateFile::Questions::DataTransferOffboardingController, false),
Navigation::NavigationStep.new(StateFile::Questions::IncomeReviewController),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/navigation/state_file_md_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StateFileMdQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::WaitingToLoadDataController),
]),
Navigation::NavigationSection.new("state_file.navigation.section_5", [
Navigation::NavigationStep.new(StateFile::Questions::PostDataTransferController, false),
Navigation::NavigationStep.new(StateFile::Questions::DataReviewController),
Navigation::NavigationStep.new(StateFile::Questions::MdPermanentAddressController),
# Federal info does not show to users
Navigation::NavigationStep.new(StateFile::Questions::FederalInfoController),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/navigation/state_file_nc_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class StateFileNcQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::WaitingToLoadDataController),
]),
Navigation::NavigationSection.new("state_file.navigation.section_5", [
Navigation::NavigationStep.new(StateFile::Questions::PostDataTransferController, false),
Navigation::NavigationStep.new(StateFile::Questions::DataReviewController),
Navigation::NavigationStep.new(StateFile::Questions::FederalInfoController),
Navigation::NavigationStep.new(StateFile::Questions::DataTransferOffboardingController, false),
Navigation::NavigationStep.new(StateFile::Questions::NameDobController),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/navigation/state_file_nj_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class StateFileNjQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::WaitingToLoadDataController),
]),
Navigation::NavigationSection.new("state_file.navigation.section_5", [
Navigation::NavigationStep.new(StateFile::Questions::PostDataTransferController, false),
Navigation::NavigationStep.new(StateFile::Questions::DataReviewController),
# Federal info does not show to users
Navigation::NavigationStep.new(StateFile::Questions::FederalInfoController),
Navigation::NavigationStep.new(StateFile::Questions::DataTransferOffboardingController, false),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/navigation/state_file_ny_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class StateFileNyQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::WaitingToLoadDataController),
]),
Navigation::NavigationSection.new("state_file.navigation.section_5", [
Navigation::NavigationStep.new(StateFile::Questions::PostDataTransferController, false),
Navigation::NavigationStep.new(StateFile::Questions::DataReviewController),
Navigation::NavigationStep.new(StateFile::Questions::FederalInfoController),
Navigation::NavigationStep.new(StateFile::Questions::DataTransferOffboardingController, false),
Navigation::NavigationStep.new(StateFile::Questions::NameDobController),
Expand Down
2 changes: 1 addition & 1 deletion app/models/state_file_base_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def controller_for_current_step
end
rescue StandardError
if hashed_ssn.present?
StateFile::Questions::PostDataTransferController
StateFile::Questions::DataReviewController
else
StateFile::Questions::TermsAndConditionsController
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<h1 class="h2"><%= title %></h1>
<p><%= t(".subtitle") %></p>

<%= form_with model: @form, url: { action: :update }, local: true, method: "put", builder: VitaMinFormBuilder do |f| %>
<%= form_with model: @form, url: { action: :update }, local: true, method: "put",
data: { efile_security_information: true, form_name: "state_file_az_prior_last_names_form" },
builder: VitaMinFormBuilder do |f| %>
<%= f.hidden_field(:device_id) %>
<div class="question-with-follow-up">
<div class="question-with-follow-up__question">
<div class="white-group">
Expand Down
55 changes: 55 additions & 0 deletions app/views/state_file/questions/data_review/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<% title = t('.title') %>
<% content_for :page_title, title %>

<% content_for :card do %>
<h1 class="h2">
<%= title %>
</h1>

<strong>
<%= t(".basic_household_info_title") %>
</strong>
<p>
<%= t(".partially_complete_description") %>
<%= image_tag("icons/exclamation.svg", alt: "") %>
</p>

<strong>
<%= t(".filing_status_title") %>
</strong>
<p>
<%= t(".complete_description") %>
<%= image_tag("icons/check.svg", alt: "") %>
</p>

<strong>
<%= t(".income_and_deductions_title") %>
</strong>
<p>
<%= t(".partially_complete_description") %>
<%= image_tag("icons/exclamation.svg", alt: "") %>
</p>

<strong>
<%= t(".state_tax_withheld_title", name: current_state_name) %>
</strong>
<p>
<%= t(".complete_description") %>
<%= image_tag("icons/check.svg", alt: "") %>
</p>
<%= form_with model: @form, url: { action: :update }, data: { efile_security_information: true, form_name: "state_file_data_review_form" }, local: true, method: "put", builder: VitaMinFormBuilder do |f| %>
<%= f.hidden_field(:device_id) %>
<%= f.continue %>
<% end %>

<% unless acts_like_production? %>
<%=
link_to(
"I'm on a #{Rails.env} environment, let me edit the response XML",
StateFile::Questions::FederalInfoController.to_path_helper,
class: 'dev-button',
id: 'visit_federal_info_controller'
)
%>
<% end %>
<% end %>
6 changes: 1 addition & 5 deletions app/views/state_file/questions/income_review/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,5 @@
</div>
<% end %>

<%= form_with model: @form, url: { action: :update }, data: { efile_security_information: true, form_name: "state_file_income_review_form" },
local: true, method: "put", builder: VitaMinFormBuilder do |f| %>
<%= f.hidden_field(:device_id) %>
<%= f.continue %>
<% end %>
<%= link_to t("general.continue"), next_path, class: "button button--wide button--primary text--centered" %>
<% end %>
5 changes: 4 additions & 1 deletion app/views/state_file/questions/name_dob/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<p><%= t('.title1') %></p>
<p><%= t('.title2') %></p>

<%= form_with model: @form, url: { action: :update }, local: true, method: "put", builder: VitaMinFormBuilder do |f| %>
<%= form_with model: @form, url: { action: :update }, method: :put,
data: { efile_security_information: true, form_name: "state_file_name_dob_form" },
local: true, builder: VitaMinFormBuilder, class: 'form-card' do |f| %>
<%= f.hidden_field(:device_id) %>
</br>
<div class="white-group">
<p>
Expand Down
16 changes: 0 additions & 16 deletions app/views/state_file/questions/post_data_transfer/edit.html.erb

This file was deleted.

12 changes: 9 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2360,6 +2360,15 @@ en:
subtitle: With an account, you’ll receive status updates on your state tax return.
text_message_option: Text me a code
title: Next, create your account with a quick code
data_review:
edit:
basic_household_info_title: Basic household information
complete_description: Complete
filing_status_title: Filing status
income_and_deductions_title: Income and deductions
partially_complete_description: Partially complete
state_tax_withheld_title: "%{name} state tax withheld"
title: Your federal tax return is now transferred. We completed some sections to save you time.
data_transfer_offboarding:
edit:
ineligible_reason:
Expand Down Expand Up @@ -3201,9 +3210,6 @@ en:
action: Send code
phone_number_label: Your phone number
title: Enter your phone number
post_data_transfer:
edit:
title: Non-prod page only
primary_state_id:
edit:
ny_subtitle: This information is required for all NY residents with a state-issued ID.
Expand Down
12 changes: 9 additions & 3 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2334,6 +2334,15 @@ es:
subtitle: Con una cuenta recibirás notificaciones sobre el estado de tu declaración de impuestos estatales.
text_message_option: Enviar código por mensaje de texto.
title: Ahora crea tu cuenta con un código
data_review:
edit:
basic_household_info_title: Información básica del hogar
complete_description: Completo
filing_status_title: Estado civil para la declaración
income_and_deductions_title: Ingresos y deducciones
partially_complete_description: Parcialmente completa
state_tax_withheld_title: Retención de impuestos estatales de %{name}
title: Tu declaración de impuestos federales se ha transferido. Hemos completado algunas partes para ahorrarte tiempo.
data_transfer_offboarding:
edit:
ineligible_reason:
Expand Down Expand Up @@ -3188,9 +3197,6 @@ es:
action: Enviar el código
phone_number_label: Tu número de teléfono
title: Ingresa tu número de teléfono
post_data_transfer:
edit:
title: Solo página sin producción
primary_state_id:
edit:
ny_subtitle: Esta información es necesaria para todos los residentes de Nueva York con una identificación emitida por el estado.
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/state_file/intake_logins_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@
post :update, params: params

expect(subject.current_state_file_az_intake).to eq(intake)
expect(response).to redirect_to questions_post_data_transfer_path
expect(response).to redirect_to questions_data_review_path
expect(session["warden.user.state_file_az_intake.key"].first.first).to eq intake.id
end

Expand Down Expand Up @@ -567,7 +567,7 @@

expect(subject.current_state_file_az_intake).to eq(intake)
expect(intake.reload.unfinished_intake_ids).to match_array ["3", current_unfinished_intake.id.to_s]
expect(response).to redirect_to questions_post_data_transfer_path
expect(response).to redirect_to questions_data_review_path
expect(session["warden.user.state_file_az_intake.key"].first.first).to eq intake.id
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
end

describe "#update" do
let!(:efile_device_info) { create :state_file_efile_device_info, :initial_creation, intake: intake, device_id: nil }
let(:device_id) { "ABC123" }
let(:params) do
{ state_file_az_prior_last_names_form: {
has_prior_last_names: "yes",
prior_last_names: "McTestface",
device_id: device_id
} }
end

# use the return_to_review_concern shared example if the page
# should skip to the review page when the return_to_review param is present
# requires form_params to be set with any other required params
Expand All @@ -16,9 +26,26 @@
state_file_az_prior_last_names_form: {
has_prior_last_names: "yes",
prior_last_names: "McTestface",
device_id: "ABC123"
}
}
end
end

context "without device id information due to JS being disabled" do
let(:device_id) { nil }

it "flashes an alert and does re-renders edit" do
post :update, params: params
expect(flash[:alert]).to eq(I18n.t("general.enable_javascript"))
end
end

context "with device id" do
it "updates device id" do
post :update, params: params
expect(efile_device_info.reload.device_id).to eq "ABC123"
end
end
end
end
Loading

0 comments on commit 12c2b82

Please sign in to comment.