Skip to content

Commit

Permalink
allow resubmit tax return for auto-wait
Browse files Browse the repository at this point in the history
  • Loading branch information
embarnard committed Mar 8, 2024
1 parent 1cc11e0 commit 81825b6
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class ReturnStatusController < AuthenticatedQuestionsController
before_action :redirect_if_no_submission

def edit
@error = submission_error
@title = title
@return_status = return_status
@reject_code = reject_code
Expand All @@ -23,6 +24,12 @@ def prev_path

private

def submission_error
# in the case that its in the notified_of_rejection state we can't just grab the efile errors from the last transition
# or has an efile_error w/auto-wait which will transition it to waiting/file_hold
current_intake.efile_submissions.last&.efile_submission_transitions&.where(to_state: 'rejected')&.last&.efile_errors&.last
end

def title
state_name = States.name_for_key(params[:us_state].upcase)
case return_status
Expand Down
2 changes: 1 addition & 1 deletion app/forms/state_file/tax_refund_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def save

def self.existing_attributes(intake)
attributes = super
attributes.except(:routing_number, :account_number, :routing_number_confirmation, :account_number_confirmation)
attributes.except(:routing_number, :account_number, :routing_number_confirmation, :account_number_confirmation, :bank_name)
end

private
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 @@ -212,7 +212,7 @@ def return_status
case self.efile_submissions.last.current_state
when 'accepted'
'accepted'
when 'rejected'
when 'rejected', 'notified_of_rejection', 'waiting'
'rejected'
else
'pending'
Expand Down
6 changes: 3 additions & 3 deletions app/state_machines/efile_submission_state_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class EfileSubmissionStateMachine
transition from: :queued, to: [:transmitted, :failed]
transition from: :transmitted, to: [:accepted, :rejected, :failed, :ready_for_ack, :transmitted, :notified_of_rejection]
transition from: :ready_for_ack, to: [:accepted, :rejected, :failed, :ready_for_ack, :notified_of_rejection]
transition from: :failed, to: [:resubmitted, :cancelled, :investigating, :waiting, :fraud_hold]
transition from: :failed, to: [:resubmitted, :cancelled, :investigating, :waiting, :fraud_hold, :rejected]
transition from: :rejected, to: [:resubmitted, :cancelled, :investigating, :waiting, :fraud_hold, :notified_of_rejection]
transition from: :notified_of_rejection, to: [:resubmitted, :cancelled, :investigating, :waiting, :fraud_hold]
transition from: :investigating, to: [:resubmitted, :cancelled, :waiting, :fraud_hold]
Expand Down Expand Up @@ -172,12 +172,12 @@ class EfileSubmissionStateMachine
end

after_transition(to: :investigating) do |submission|
submission.source_record.transition_to(:file_hold)
submission.source_record.transition_to(:file_hold) if submission.is_for_federal_filing?
end


after_transition(to: :waiting) do |submission|
submission.source_record.transition_to(:file_hold)
submission.source_record.transition_to(:file_hold) if submission.is_for_federal_filing?
end

after_transition(to: :resubmitted) do |submission, transition|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<% if current_intake.ask_spouse_esign? %>
<%= f.cfa_checkbox(:spouse_esigned, t(".spouse_esign"), options: { checked_value: "yes", unchecked_value: "no" }) %>
<% end %>
<%= f.submit(t(".submit"), class: "button button--primary button--wide") %>
<% submission_btn_text = current_intake.efile_submissions.count > 0 ? t(".resubmit") : t(".submit") %>
<%= f.submit(submission_btn_text, class: "button button--primary button--wide") %>
</div>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@
<%= @mail_voucher_address %>
</strong>
</div>

<%= link_to t('state_file.questions.return_status.edit.download_state_return_pdf'), StateFile::Questions::SubmissionPdfsController.to_path_helper(us_state: params[:us_state], action: :show, id: EfileSubmission.where(data_source: current_intake).first), class: "button button--primary spacing-above-60" %>
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
<p>
<%= t('.more_than_two_days') %>
</p>

<%= link_to t('state_file.questions.return_status.edit.download_state_return_pdf'), StateFile::Questions::SubmissionPdfsController.to_path_helper(us_state: params[:us_state], action: :show, id: EfileSubmission.where(data_source: current_intake).first), class: "button button--primary spacing-above-60" %>
14 changes: 12 additions & 2 deletions app/views/state_file/questions/return_status/_rejected.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@
<% end %>

<section class="spacing-below-15">
<p class="spacing-below-5"><strong><%= t('.whats_next') %></strong></p>
<%= t('.its_unusual') %>
<% if @error&.auto_wait %>
<p class="spacing-below-5"><strong><%= t('.next_steps.can_edit.title') %></strong></p>
<%= t('.next_steps.can_edit.body') %>
<% else %>
<p class="spacing-below-5"><strong><%= t('.next_steps.no_edit.title') %></strong></p>
<%= t('.next_steps.no_edit.body_html') %>
<% end %>
</section>

<section>
<p class="spacing-below-5"><strong><%= t('.have_questions') %></strong></p>
<%= t('.contact_us') %>
</section>

<% if @error&.auto_wait %>
<% edit_return_path = params[:us_state] == 'az' ? az_questions_name_dob_path : ny_questions_name_dob_path %>
<%= link_to t('.edit_return'), edit_return_path, class: "button button--primary spacing-above-60" %>
<% end %>
6 changes: 1 addition & 5 deletions app/views/state_file/questions/return_status/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<% content_for :page_title, @title %>
<% content_for :card do %>
<p>
<%= render @return_status %>
</p>

<%= link_to t('.download_state_return_pdf'), StateFile::Questions::SubmissionPdfsController.to_path_helper(us_state: params[:us_state], action: :show, id: EfileSubmission.where(data_source: current_intake).first), class: "button button--primary" %>
<%= render @return_status %>
<% if show_xml? %>
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<% title = t('.title', state_name: state_name) %>
<% if current_intake.efile_submissions.count > 1 %>
<% title = t('.title_resubmit', state_name: state_name) %>
<% else %>
<% title = t('.title', state_name: state_name) %>
<% end %>
<% content_for :page_title, title %>
<% content_for :card do %>
Expand Down
12 changes: 10 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,7 @@ en:
<p>In addition, I understand and agree that by using a computer system and software to prepare and transmit my tax return electronically, I have consented to the disclosure to NYS of all information pertaining to the transmission of my NYS tax return electronically. If I am paying my New York State personal income taxes owed or receiving a tax refund by electronic funds transfer, I certify that the account holder authorizes the NYS Tax Department and its designated financial agents to initiate an electronic funds transfer from the financial institution account indicated on the 2023 NYS electronic return, and authorizes the financial institution to debit the amount from that account (if tax is owed) or credit the account with a direct deposit (where a refund is due).</p>
<p>As New York does not support International ACH Transactions (IAT), I attest the source for these funds is within the United States. I understand and agree that I may revoke this authorization for payment only by contacting the Tax Department no later than two (2) business days prior to the payment date.</p>
primary_esign: I have read the certification above and agree
resubmit: Resubmit your state return
spouse_esign: My spouse has read the certification above and agrees
submit: Submit your state return
title: Electronically sign your %{state_name} state tax return
Expand Down Expand Up @@ -2429,12 +2430,18 @@ en:
title: You have submitted your 2023 %{state_name} tax return! It is currently waiting to be accepted for processing.
rejected:
contact_us: Contact our team of Support Specialists by clicking chat with us.
edit_return: Edit your state return
have_questions: Have questions?
its_unusual: It's unusual for your state return to be rejected after your federal return was accepted. Our team is looking into the issue to see what we can do to help fix the problem. We'll let you know if you need to take any additional next steps.
next_steps:
can_edit:
body: You can edit and resubmit your state return by clicking the button below.
title: What's next?
no_edit:
body_html: Unfortunately, there has been an issue with filing your state return that cannot be resolved on our tool. <u>Chat with us</u> or email us at help@fileyourstatetaxes.org for guidance on next steps.
title: What can I do next?
reject_code: 'Reject Code:'
reject_desc: 'Reject Description:'
title: Unfortunately, your 2023 %{state_name} state tax return was rejected
whats_next: What's next?
shared:
review_footer:
download_pdf: You can download a PDF of your full state tax return after you submit.
Expand Down Expand Up @@ -2466,6 +2473,7 @@ en:
ny_notifications_signup_html: <a target="_blank" rel="noopener nofollow" href="https://tax.ny.gov/">Sign up with the NYS Tax Department</a> to receive email notifications about your personal tax account.
register_to_vote: Register to vote.
title: Your 2023 %{state_name} state tax return is now submitted!
title_resubmit: Your 2023 %{state_name} state tax return is now resubmitted!
tax_refund:
bank_details:
account_number: Account Number
Expand Down
12 changes: 10 additions & 2 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,7 @@ es:
<p>Además, entiendo y acepto que al utilizar un sistema informático y software para preparar y transmitir mi declaración de impuestos electrónicamente, he consentido a la divulgación a NYS de toda la información relacionada con la transmisión de mi declaración de impuestos de NYS electrónicamente. Si estoy pagando mis impuestos personales del estado de Nueva York adeudados o recibiendo un reembolso de impuestos mediante transferencia electrónica de fondos, certifico que el titular de la cuenta autoriza al Departamento de Impuestos de NYS y a sus agentes financieros designados a iniciar una transferencia electrónica de fondos desde la cuenta de la institución financiera indicada en la declaración electrónica de NYS 2023, y autoriza a la institución financiera a debitar la cantidad de esa cuenta (si se debe impuestos) o acreditar la cuenta con un depósito directo (si se debe un reembolso).</p>
<p>Dado que Nueva York no admite Transacciones ACH Internacionales (IAT), atestiguo que la fuente de estos fondos se encuentra dentro de los Estados Unidos. Entiendo y acepto que puedo revocar esta autorización de pago comunicándome con el Departamento de Impuestos en no más de cinco (5) días hábiles antes de la fecha de pago.</p>
primary_esign: He leído y acepto la certificación anterior
resubmit: Vuelva a enviar su declaración estatal
spouse_esign: Mi cónyuge ha leído y acepta la certificación anterior
submit: Envía tu declaración estatal
title: Firma de manera electrónica tu declaración de impuestos del estado de %{state_name}
Expand Down Expand Up @@ -2431,12 +2432,18 @@ es:
title: "¡Ha enviado su declaración de impuestos de %{state_name} de 2023! Actualmente se encuentra a la espera de ser aceptado para su procesamiento."
rejected:
contact_us: Contacte a nuestro equipo de expertos haciendo clic en "Chatea con nosotros".
edit_return: Edite su declaración estatal
have_questions: "¿Tienes preguntas?"
its_unusual: Es poco común que tu declaración estatal sea rechazada después de que tu declaración federal haya sido aceptada. Nuestro equipo está investigando el problema para ver qué podemos hacer para ayudarte a solucionarlo. Te informaremos si necesitas hacer algo más.
next_steps:
can_edit:
body: Puede editar y volver a enviar su declaración estatal haciendo clic en el botón a continuación.
title: "¿Qué sigue?"
no_edit:
body_html: Desafortunadamente, ha habido un problema con la presentación de su declaración estatal que no se puede resolver con nuestra herramienta. <u>Chatea con nosotros</u> o envíanos un correo electrónico a help@fileyourstatetaxes.org para obtener orientación sobre los próximos pasos.
title: "¿Qué puedo hacer a continuación?"
reject_code: 'Código de Rechazo:'
reject_desc: 'Descripción del Rechazo:'
title: Lamentablemente, tu declaración de impuestos del estado de %{state_name} para el año 2023 fue rechazada
whats_next: "¿Qué sigue?"
shared:
review_footer:
download_pdf: Puedes descargar un PDF de tu declaración de impuestos estatales después de enviarla.
Expand Down Expand Up @@ -2468,6 +2475,7 @@ es:
ny_notifications_signup_html: <a target="_blank" rel="noopener nofollow" href="https://tax.ny.gov/">Regístrate con el Departamento de Impuestos del Estado de Nueva York</a> para recibir notificaciones por correo electrónico sobre tu cuenta de impuestos personales.
register_to_vote: Regístrate para votar.
title: "¡Tu declaración de impuestos del estado de %{state_name} de 2023 ha sido enviada!"
title_resubmit: "¡Su declaración de impuestos estatales de %{state_name} de 2023 ya se volvió a presentar!"
tax_refund:
bank_details:
account_number: Número de cuenta
Expand Down
2 changes: 1 addition & 1 deletion spec/features/state_file/complete_intake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@

expect(page).to have_text I18n.t('state_file.questions.primary_state_id.edit.title')
choose I18n.t('state_file.questions.primary_state_id.state_id.id_type_question.dmv')
fill_in I18n.t('state_file.questions.primary_state_id.state_id.id_details.number'), with: "012345678"
fill_in I18n.t('state_file.questions.primary_state_id.state_id.id_details.number'), with: "012345678"
select_cfa_date "state_file_az_primary_state_id_form_issue_date", Time.now - 4.year
select_cfa_date "state_file_az_primary_state_id_form_expiration_date", Time.now + 4.year
select("Arizona", from: I18n.t('state_file.questions.primary_state_id.state_id.id_details.issue_state'))
Expand Down
100 changes: 100 additions & 0 deletions spec/features/state_file/edit_return_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
require "rails_helper"

RSpec.feature "Editing a rejected intake with an auto-wait error" do
include StateFileIntakeHelper
let(:email_address) { "someone@example.com" }
let(:ssn) { "111223333" }
let(:hashed_ssn) { "hashed_ssn" }
let(:verification_code) { "000004" }
let(:hashed_verification_code) { "hashed_verification_code" }
let(:double_hashed_verification_code) { "double_hashed_verification_code" }

let!(:ny_intake) { create :state_file_ny_intake, email_address: email_address, hashed_ssn: hashed_ssn, primary_first_name: "Jerry" }
let!(:efile_submission) {
create :efile_submission,
:for_state,
:transmitted,
data_source: ny_intake
}
let!(:efile_error) {
create :efile_error,
message: "The IRS Submission ID referenced in the State Submission Manifest must be present in the e-File database.",
expose: true, auto_wait: true, auto_cancel: false,
category: "Database Validation Error",
code: "STATE-901",
severity: "Reject",
source: "irs"
}
let(:raw_response) do
"<Acknowledgement>\n
<SubmissionId>12345678901234567890</SubmissionId>\n
<EFIN>441466</EFIN>\n
<TaxYr>2023</TaxYr>\n
<ExtndGovernmentCd>AZST</ExtndGovernmentCd>\n
<SubmissionTyp>Form140</SubmissionTyp>\n
<ExtndSubmissionCategoryCd>IND</ExtndSubmissionCategoryCd>\n
<ElectronicPostmarkTs>2024-02-27T19:52:33.861+00:00</ElectronicPostmarkTs>\n
<AcceptanceStatusTxt>Denied by IRS</AcceptanceStatusTxt>\n
<ContainedAlertsInd>false</ContainedAlertsInd>\n
<StatusDt>2024-02-27</StatusDt>\n
<IRSSubmissionId>12345678901234567890</IRSSubmissionId>\n
<TIN>400000001</TIN>\n
<SubmissionValidationCompInd>true</SubmissionValidationCompInd>\n
<ValidationErrorList errorCnt=\"1\">\n
<ValidationErrorGrp errorId=\"1\">\n
<DocumentId>NA</DocumentId>\n
<ErrorCategoryCd>Database Validation Error</ErrorCategoryCd>\n
<ErrorMessageTxt>The IRS Submission ID referenced in the State Submission Manifest must be present in the e-File database.</ErrorMessageTxt>\n
<RuleNum>STATE-901</RuleNum>\n
<SeverityCd>Reject</SeverityCd>\n
</ValidationErrorGrp>\n
</ValidationErrorList>\n
</Acknowledgement>"
end

before do
efile_submission.transition_to!(:rejected, raw_response: raw_response)
AfterTransitionTasksForRejectedReturnJob.perform_now(efile_submission, efile_submission.last_transition)
allow_any_instance_of(Routes::StateFileDomain).to receive(:matches?).and_return(true)
allow(SsnHashingService).to receive(:hash).with(ssn).and_return hashed_ssn
allow(VerificationCodeService).to receive(:generate).with(anything).and_return [verification_code, hashed_verification_code]
allow(VerificationCodeService).to receive(:hash_verification_code_with_contact_info).with(email_address, verification_code).and_return(hashed_verification_code)
end

scenario "edit your state return from the return status page with an auto-wait error" do
visit "/ny/login-options"
expect(page).to have_text "Sign in to FileYourStateTaxes"
click_on "Sign in with email"

expect(page).to have_text "Sign in with your email address"
fill_in I18n.t("state_file.intake_logins.new.email_address.label"), with: email_address
perform_enqueued_jobs do
click_on I18n.t("state_file.questions.email_address.edit.action")
end

mail = ActionMailer::Base.deliveries.last
expect(mail.html_part.body.to_s).to include("Your six-digit verification code for FileYourStateTaxes is: <strong> #{verification_code}.</strong> This code will expire after 30 minutes.")

expect(page).to have_text "Enter the code to continue"
fill_in "Enter the 6-digit code", with: verification_code
click_on "Verify code"

expect(page).to have_text "Code verified! Authentication needed to continue."
fill_in "Enter your Social Security number or ITIN. For example, 123-45-6789.", with: ssn
click_on "Continue"

expect(page).to have_text "Unfortunately, your 2023 New York state tax return was rejected"
click_on "Edit your state return"

# goes back to the name-dob page
expect(page).to have_text I18n.t("state_file.questions.name_dob.edit.title1")
expect(find_field('state_file_name_dob_form_primary_first_name').value).to eq 'Jerry'

fill_in "state_file_name_dob_form[primary_first_name]", with: "Titus"
fill_in "state_file_name_dob_form[primary_last_name]", with: "Testerson"
select_cfa_date "state_file_name_dob_form_primary_birth_date", Date.new(1978, 6, 21)
click_on I18n.t("general.continue")

expect(page).to have_text I18n.t("state_file.questions.nyc_residency.edit.title", year: 2023)
end
end

0 comments on commit 81825b6

Please sign in to comment.