Skip to content
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module StateFile
module Questions
class UnemploymentController < QuestionsController
include ReturnToReviewConcern
include OtherOptionsLinksConcern
before_action :load_links, only: [:new, :edit]

Expand Down Expand Up @@ -70,15 +71,15 @@ def destroy
private

def next_path
if params[:return_to_review].present?
if params[:return_to_review].present? && !current_intake.is_a?(StateFileNcIntake)
StateFile::Questions::IncomeReviewController.to_path_helper(return_to_review: params[:return_to_review])
else
super
end
end

def prev_path
if params[:return_to_review].present?
if params[:return_to_review].present? && !current_intake.is_a?(StateFileNcIntake)
StateFile::Questions::IncomeReviewController.to_path_helper(return_to_review: params[:return_to_review])
else
super
Expand Down
12 changes: 12 additions & 0 deletions app/lib/efile/nc/d400_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ def analytics_attrs
{}
end

def calculate_gov_payments
sum = 0

@intake.state_file1099_gs.each do |state_file_1099_g|
if @intake.filing_status_mfj? || state_file_1099_g.recipient_primary?
sum += state_file_1099_g.unemployment_compensation_amount&.round
end
end

sum
end

private

def calculate_line_9
Expand Down
1 change: 0 additions & 1 deletion app/lib/navigation/state_file_nc_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class StateFileNcQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::NcCountyController),
Navigation::NavigationStep.new(StateFile::Questions::NcVeteranStatusController),
Navigation::NavigationStep.new(StateFile::Questions::NcSalesUseTaxController),
Navigation::NavigationStep.new(StateFile::Questions::IncomeReviewController),
Navigation::NavigationStep.new(StateFile::Questions::UnemploymentController),
Navigation::NavigationStep.new(StateFile::Questions::NcSubtractionsController),
Navigation::NavigationStep.new(StateFile::Questions::PrimaryStateIdController),
Expand Down
18 changes: 18 additions & 0 deletions app/views/state_file/questions/nc_review/_review_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<% content_for :additional_review_header_sections do %>
<% if current_intake.state_file1099_gs.any? %>
<div id="income-info" class="white-group">
<div class="spacing-below-25">
<h2 class="text--body text--bold spacing-below-5"><%=t(".unemployment_compensation") %></h2>
</div>
<div class="spacing-below-5">
<p><%= number_to_currency(current_intake.calculator.calculate_gov_payments) %></p>
<%= link_to StateFile::Questions::UnemploymentController.to_path_helper(action: :index, return_to_review: "y"), class: "button--small" do %>
<%= t("general.edit") %>
<span class="sr-only"><%= t(".unemployment_compensation") %></span>
<% end %>
</div>
</div>
<% end %>
<% end %>

<%= render "state_file/questions/shared/abstract_review_header" %>
4 changes: 2 additions & 2 deletions app/views/state_file/questions/nc_review/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% content_for :page_title, t("state_file.questions.shared.review_header.title") %>
<% content_for :card do %>
<%= render "state_file/questions/shared/review_header" %>
<%= render "review_header" %>

<div id="nc-county" class="white-group">
<div class="spacing-below-5">
Expand All @@ -21,7 +21,7 @@
<%= link_to t("general.edit"), StateFile::Questions::NcVeteranStatusController.to_path_helper(return_to_review: "y"), class: "button--small" %>
</div>
</div>

<div id="use-tax" class="white-group">
<div class="spacing-below-5">
<p class="text--bold spacing-below-5"><%=t(".use_tax_applied") %></p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<h1 class="h2" id="main-question"><%= t(".title") %></h1>

<div class="review-header">
<% if @refund_or_owed_amount == 0 %>
<div class="white-group">
<h2 class="text--body text--bold">
<span><%= t(".taxes_owed_header") %></span>
<br/>
<span class="text--normal">$0</span>
</h2>
<%= t(".taxes_owed_html") %>
</div>
<% else %>
<div class="white-group">
<div class="spacing-below-5">
<h2 class="text--body text--bold spacing-below-5"><%=@refund_or_owed_label %></h2>
<p class="spacing-below-0"><%=number_to_currency(@refund_or_owed_amount.abs) %></p>
</div>
</div>
<% end %>

<div id="household-info" class="white-group">
<div class="spacing-below-25">
<h2 class="text--body text--bold spacing-below-5"><%=t(".household_info") %></h2>
</div>
<div class="spacing-below-5">
<h3 class="text--body text--bold spacing-below-5"><%=t(".your_name") %></h3>
<p><%=current_intake.primary.full_name %></p>
</div>
<% if current_intake.filing_status_mfj? %>
<div class="spacing-below-5 with-top-separator">
<h3 class="text--body text--bold spacing-below-5"><%=t(".spouse_name") %></h3>
<p><%=current_intake.spouse.full_name %></p>
</div>
<% end %>
<% current_intake.dependents.each_with_index do | dependent, index | %>
<div class="spacing-below-5 with-top-separator">
<% if index == 0 %>
<h3 class="text--body text--bold spacing-below-5"><%=t(".dependent_name") %></h3>
<% else %>
<h3 class="text--body text--bold spacing-below-5"><%=t(".nth_dependent_name", ordinal: number_in_words(index + 1)) %></h3>
<% end %>
<p><%=dependent.full_name %></p>
</div>
<div class="spacing-below-5">
<h3 class="text--body text--bold spacing-below-5"><%=t(".dependent_dob") %></h3>
<p><%=dependent.dob %></p>
</div>
<% if dependent.months_in_home.present? && @show_dependent_months_in_home %>
<div class="spacing-below-5">
<h3 class="text--body text--bold spacing-below-5"><%=t(".dependent_months_in_home") %></h3>
<p><%=dependent.months_in_home %></p>
</div>
<% end %>
<% end %>
</div>

<%= yield(:additional_review_header_sections) %>
</div>
62 changes: 4 additions & 58 deletions app/views/state_file/questions/shared/_review_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,60 +1,4 @@
<h1 class="h2" id="main-question"><%= t(".title") %></h1>

<div class="review-header">
<% if @refund_or_owed_amount == 0 %>
<div class="white-group">
<h2 class="text--body text--bold">
<span><%= t(".taxes_owed_header") %></span>
<br/>
<span class="text--normal">$0</span>
</h2>
<%= t(".taxes_owed_html") %>
</div>
<% else %>
<div class="white-group">
<div class="spacing-below-5">
<h2 class="text--body text--bold spacing-below-5"><%=@refund_or_owed_label %></h2>
<p class="spacing-below-0"><%=number_to_currency(@refund_or_owed_amount.abs) %></p>
</div>
</div>
<% end %>

<div id="household-info" class="white-group">
<div class="spacing-below-25">
<h2 class="text--body text--bold spacing-below-5"><%=t(".household_info") %></h2>
</div>
<div class="spacing-below-5">
<h3 class="text--body text--bold spacing-below-5"><%=t(".your_name") %></h3>
<p><%=current_intake.primary.full_name %></p>
</div>
<% if current_intake.filing_status_mfj? %>
<div class="spacing-below-5 with-top-separator">
<h3 class="text--body text--bold spacing-below-5"><%=t(".spouse_name") %></h3>
<p><%=current_intake.spouse.full_name %></p>
</div>
<% end %>
<% current_intake.dependents.each_with_index do | dependent, index | %>
<div class="spacing-below-5 with-top-separator">
<% if index == 0 %>
<h3 class="text--body text--bold spacing-below-5"><%=t(".dependent_name") %></h3>
<% else %>
<h3 class="text--body text--bold spacing-below-5"><%=t(".nth_dependent_name", ordinal: number_in_words(index + 1)) %></h3>
<% end %>
<p><%=dependent.full_name %></p>
</div>
<div class="spacing-below-5">
<h3 class="text--body text--bold spacing-below-5"><%=t(".dependent_dob") %></h3>
<p><%=dependent.dob %></p>
</div>
<% if dependent.months_in_home.present? && @show_dependent_months_in_home %>
<div class="spacing-below-5">
<h3 class="text--body text--bold spacing-below-5"><%=t(".dependent_months_in_home") %></h3>
<p><%=dependent.months_in_home %></p>
</div>
<% end %>
<% end %>
</div>

<% content_for :additional_review_header_sections do %>
<% if @income_documents_present %>
<div id="income-info" class="white-group">
<div class="spacing-below-25">
Expand All @@ -68,4 +12,6 @@
</div>
</div>
<% end %>
</div>
<% end %>

<%= render "state_file/questions/shared/abstract_review_header" %>
12 changes: 8 additions & 4 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2838,6 +2838,8 @@ en:
state_credit: Amount earned as member of a federally recognized Indian tribe
subtraction_indian_tribe: Subtraction for income of a member of an Indian tribe
use_tax_applied: Consumer Use Tax Applied
review_header:
unemployment_compensation: Unemployment Compensation
nc_sales_use_tax:
edit:
calculated_use_tax: Enter calculated use tax
Expand Down Expand Up @@ -3285,20 +3287,22 @@ en:
review:
county: County
shared:
review_footer:
download_pdf: You can download a PDF of your full state tax return after you submit.
review_header:
abstract_review_header:
dependent_dob: Their date of birth
dependent_months_in_home: Number of months they lived with you
dependent_name: Your dependent's name
household_info: Household information
income_details: Income Details
nth_dependent_name: Your %{ordinal} dependent's name
spouse_name: Your spouse's name
taxes_owed_header: Your refund or taxes owed
taxes_owed_html: Your refund is $0. This means that you <strong>will not</strong> receive a state refund and you <strong>do not</strong> owe state taxes. You should finish filing your return, since you may be required to file even though you won’t get or receive any money.
title: You're done! Review your state tax return before you submit.
your_name: Your name
review_footer:
download_pdf: You can download a PDF of your full state tax return after you submit.
review_header:
income_details: Income Details
title: You're done! Review your state tax return before you submit.
your_refund: Your refund amount
your_tax_owed: Your taxes owed
spouse_state_id:
Expand Down
12 changes: 8 additions & 4 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2810,6 +2810,8 @@ es:
state_credit: Cantidad ganada como miembro de una tribu indígena reconocida federalmente
subtraction_indian_tribe: Resta de ingresos de un miembro de una tribu india
use_tax_applied: Impuesto de Uso Aplicado
review_header:
unemployment_compensation: Compensación por Desempleo
nc_sales_use_tax:
edit:
calculated_use_tax: Ingresa el impuesto de uso calculado
Expand Down Expand Up @@ -3272,20 +3274,22 @@ es:
review:
county: Condado
shared:
review_footer:
download_pdf: Puedes descargar un PDF de tu declaración de impuestos estatales después de enviarla.
review_header:
abstract_review_header:
dependent_dob: Su fecha de nacimiento
dependent_months_in_home: Número de meses que vivieron contigo
dependent_name: Nombre de tu dependiente
household_info: Información del hogar
income_details: Detalles de ingresos
nth_dependent_name: Nombre de tu %{ordinal} dependiente
spouse_name: Nombre de tu cónyuge
taxes_owed_header: Tu reembolso estimado o tus impuestos estimados a pagar
taxes_owed_html: Tu reembolso es de $0. Esto significa <strong>que no</strong> recibirás un reembolso estatal y <strong>no</strong> debes impuestos estatales. Deberías terminar de presentar tu declaración, ya que es posible que estés obligado/a a presentarla aunque no recibirás dinero.
title: "¡Terminaste! Revisa tu declaración de impuestos estatales antes de enviarla."
your_name: Tu nombre
review_footer:
download_pdf: Puedes descargar un PDF de tu declaración de impuestos estatales después de enviarla.
review_header:
income_details: Detalles de ingresos
title: "¡Terminaste! Revisa tu declaración de impuestos estatales antes de enviarla."
your_refund: Tu reembolso
your_tax_owed: Tus impuestos adeudados
spouse_state_id:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@

it "displayed dependent details" do
get :edit
expect(response.body).to include I18n.t("state_file.questions.shared.review_header.dependent_dob")
expect(response.body).to include I18n.t("state_file.questions.shared.abstract_review_header.dependent_dob")
expect(response.body).to include "Bobby Tables"
expect(response.body).not_to include I18n.t("state_file.questions.shared.review_header.dependent_months_in_home")
expect(response.body).not_to include I18n.t("state_file.questions.shared.abstract_review_header.dependent_months_in_home")
end
end
end
end
end
2 changes: 1 addition & 1 deletion spec/factories/state_file1099_gs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
state_identification_number {'123456789'}
unemployment_compensation_amount { '1' }
federal_income_tax_withheld_amount { '0' }
state_income_tax_withheld_amount { '0' }
state_income_tax_withheld_amount { 0.0 }
recipient_city {'New York'}
recipient_street_address {'123 Recipient St'}
recipient_zip {'11102'}
Expand Down
1 change: 1 addition & 0 deletions spec/factories/state_file_nc_intakes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
end

trait :married_filing_separately do
filing_status { 'married_filing_separately' }
raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('nc_sheldon_mfs') }
end

Expand Down
3 changes: 0 additions & 3 deletions spec/features/state_file/complete_intake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,6 @@
choose I18n.t("general.negative")
click_on I18n.t("general.continue")

expect(page).to have_text "Here are the income forms we transferred from your federal tax return."
click_on I18n.t("general.continue")

expect(page).to have_text I18n.t('state_file.questions.unemployment.edit.title.other', year: filing_year)
choose I18n.t("general.affirmative")
fill_in I18n.t('state_file.questions.unemployment.edit.payer_name'), with: "Business Name"
Expand Down
52 changes: 51 additions & 1 deletion spec/features/state_file/review_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
allow_any_instance_of(Routes::StateFileDomain).to receive(:matches?).and_return(true)
end

StateFile::StateInformationService.active_state_codes.each do |state_code|
StateFile::StateInformationService.active_state_codes.without("nc").each do |state_code|
context "#{state_code.upcase}" do
it "allows user to navigate to income review page, edit an income form, and then navigate back to final review page", required_schema: state_code do
set_up_intake_and_associated_records(state_code)
Expand Down Expand Up @@ -125,6 +125,56 @@
end
end

context "NC" do
it "allows user to navigate to unemployment review page, edit an unemployment 1099g form, and then navigate back to final review page", required_schema: "nc" do
state_code = "nc"
set_up_intake_and_associated_records(state_code)

intake = StateFile::StateInformationService.intake_class(state_code).last

visit "/questions/#{state_code}-review"

# Final review page
expect(page).to have_text I18n.t("state_file.questions.shared.review_header.title")
within "#income-info" do
click_on I18n.t("general.edit")
end

# income-info edit navigates to unemployment index page
expect(page).to have_text(I18n.t('state_file.questions.unemployment.index.1099_label', name: intake.primary.full_name))
click_on I18n.t("general.continue")

# Back on final review page
expect(page).to have_text I18n.t("state_file.questions.shared.review_header.title")
within "#income-info" do
click_on I18n.t("general.edit")
end
click_on I18n.t("general.edit")

# 1099G edit page
expect(page).to have_text strip_html_tags(I18n.t("state_file.questions.unemployment.edit.title", count: intake.filer_count, year: MultiTenantService.statefile.current_tax_year))
fill_in strip_html_tags(I18n.t("state_file.questions.unemployment.edit.payer_name")), with: "beepboop"
click_on I18n.t("general.continue")

# takes them to the 1099G index page first
expect(page).to have_text strip_html_tags(I18n.t("state_file.questions.unemployment.index.lets_review"))

# edit a 1099G (there's only one)
click_on I18n.t("general.edit")
click_on I18n.t("general.continue")

# back on index page
expect(page).to have_text strip_html_tags(I18n.t("state_file.questions.unemployment.index.lets_review"))

# delete a 1099G (there's only one)
recipient_name = intake.state_file1099_gs.last.recipient_name
click_on I18n.t("general.delete")
# redirects to new because there are no 1099Gs left, need to select "no" in order to continue
expect(page).to have_text I18n.t("state_file.questions.unemployment.destroy.removed", name: recipient_name)
choose I18n.t("general.negative")
end
end

def set_up_intake_and_associated_records(state_code)
visit "/"
click_on "Start Test #{state_code.upcase}"
Expand Down
Loading
Loading