Skip to content

Commit

Permalink
FYST-195 No longer skipping data review step (#4650)
Browse files Browse the repository at this point in the history
* No longer skipping data review step
* Removed XML validation as we don't have an appropriate schema
  • Loading branch information
tofarr authored Aug 1, 2024
1 parent 55371b3 commit e7a0280
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
7 changes: 7 additions & 0 deletions app/assets/stylesheets/_state-file.scss
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,13 @@ $state-colors: (
}
}

.federal-info-outer {
.dev-button {
margin: 0.5rem auto;
display: block;
}
}

.state-file-submissions {
.pagination-wrapper {
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def edit
ip_address: ip_for_irs,
intake: current_intake,
)
redirect_to next_path
end

private
Expand Down
19 changes: 1 addition & 18 deletions app/forms/state_file/federal_info_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ class FederalInfoForm < QuestionsForm
:total_state_tax_withheld,
:total_exempt_primary_spouse

set_attributes_for :form, :skip_schema_validation

validate :direct_file_data_must_be_imported
validate :dependent_detail_ssns_must_be_unique
validate :qualifying_child_information_ssns_must_be_in_dependent_detail
validate :schema_compliant

def self.nested_attribute_names
{
Expand Down Expand Up @@ -60,19 +57,6 @@ def qualifying_child_information_ssns_must_be_in_dependent_detail
end
end

def schema_compliant
return true if skip_schema_validation

schema_file = SchemaFileLoader.load_file("irs", "unpacked", "2023v5.0", "IndividualIncomeTax", "Ind1040", "Return1040.xsd")
xsd = Nokogiri::XML::Schema(File.open(schema_file))
xml = Nokogiri::XML(intake.direct_file_data.to_s)
xml_errors = xsd.validate(xml)

xml_errors.each do |error|
errors.add(:base, error.to_s)
end
end

def dependent_details
@intake.direct_file_data.dependent_detail_nodes.map do |node|
DfDependentDetailForm.new(node)
Expand Down Expand Up @@ -151,8 +135,7 @@ def save
raw_direct_file_data: intake.direct_file_data.to_s
)
)
# this page is broken right now on schema validation, if we ever fix this we should make sure we are also hashing ssn if primary_ssn changed on the df data
# @intake.update(hashed_ssn: SsnHashingService.hash(intake.direct_file_data.primary_ssn))
@intake.update(hashed_ssn: SsnHashingService.hash(intake.direct_file_data.primary_ssn))
@intake.synchronize_df_dependents_to_database
end

Expand Down
4 changes: 4 additions & 0 deletions app/models/direct_file_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def tax_return_year
df_xml_value(__method__)&.to_i
end

def tax_return_year=(value)
write_df_xml_value(__method__, value)
end

def filing_status
df_xml_value(__method__)&.to_i
end
Expand Down
1 change: 0 additions & 1 deletion app/views/state_file/questions/federal_info/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,5 @@
</div>

<%= f.continue %>
<%= f.submit("Continue skipping schema validation", class: "button button--danger button--wide", name: "state_file_federal_info_form[skip_schema_validation]") %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
expect(efile_info.ip_address.to_s).to eq "72.34.67.178"
expect(efile_info.device_id).to eq nil
expect(efile_info.intake).to eq intake
expect(response).to redirect_to("/en/questions/name-dob")
expect(response).to render_template :edit
end
end

Expand Down
6 changes: 6 additions & 0 deletions spec/features/state_file/complete_intake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

step_through_df_data_transfer

expect(page).to have_text I18n.t("state_file.questions.data_review.edit.title")
click_on I18n.t("general.continue")

# name dob page
expect(page).to have_text I18n.t("state_file.questions.name_dob.edit.title1")
expect(page).to have_text I18n.t("state_file.questions.name_dob.edit.title2")
Expand Down Expand Up @@ -164,6 +167,9 @@

step_through_df_data_transfer("Transfer Old sample")

expect(page).to have_text I18n.t("state_file.questions.data_review.edit.title")
click_on I18n.t("general.continue")

expect(page).to have_text I18n.t("state_file.questions.name_dob.edit.title1")
expect(page).to have_text I18n.t("state_file.questions.name_dob.edit.title2")
expect(page).to have_text "Your responses are saved. If you need a break, you can come back and log in to your account at fileyourstatetaxes.org."
Expand Down
2 changes: 2 additions & 0 deletions spec/features/state_file/editing_df_xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

xml_before = StateFileNyIntake.last.raw_direct_file_data.strip

expect(page).to have_text I18n.t('state_file.questions.data_review.edit.title')
click_on I18n.t("general.continue")
expect(page).to have_text I18n.t('state_file.questions.name_dob.edit.title1')

xml_after = StateFileNyIntake.last.raw_direct_file_data.strip
Expand Down

0 comments on commit e7a0280

Please sign in to comment.