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

FYST-1741 Completely undo deduction method based suppression on MD 502CR XML / PDF #5498

Merged
merged 2 commits into from
Feb 3, 2025
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
32 changes: 12 additions & 20 deletions app/lib/submission_builder/ty2024/states/md/documents/md502_cr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@ class Md502Cr < SubmissionBuilder::Document

def document
build_xml_doc("Form502CR", documentId: "Form502CR") do |xml|
if deduction_method_is_standard || calculated_fields.fetch(:MD502CR_PART_CC_LINE_7)&.positive?
xml.ChildAndDependentCare do |child_dependent_care|
add_non_zero_value(child_dependent_care, :FederalAdjustedGrossIncome, :MD502_LINE_1)
add_non_zero_value(child_dependent_care, :FederalChildCareCredit, :MD502CR_PART_B_LINE_2)
add_non_zero_float_value(child_dependent_care, :DecimalAmount, :MD502CR_PART_B_LINE_3)
add_non_zero_value(child_dependent_care, :Credit, :MD502CR_PART_B_LINE_4)
end
xml.ChildAndDependentCare do |child_dependent_care|
add_non_zero_value(child_dependent_care, :FederalAdjustedGrossIncome, :MD502_LINE_1)
add_non_zero_value(child_dependent_care, :FederalChildCareCredit, :MD502CR_PART_B_LINE_2)
add_non_zero_float_value(child_dependent_care, :DecimalAmount, :MD502CR_PART_B_LINE_3)
add_non_zero_value(child_dependent_care, :Credit, :MD502CR_PART_B_LINE_4)
end
if deduction_method_is_standard
xml.Senior do |senior|
add_non_zero_value(senior, :Credit, :MD502CR_PART_M_LINE_1)
end
xml.Summary do
add_non_zero_value(xml, :ChildAndDependentCareCr, :MD502CR_PART_AA_LINE_2)
add_non_zero_value(xml, :SeniorCr, :MD502CR_PART_AA_LINE_13)
add_non_zero_value(xml, :TotalCredits, :MD502CR_PART_AA_LINE_14)
end
xml.Senior do |senior|
add_non_zero_value(senior, :Credit, :MD502CR_PART_M_LINE_1)
end
xml.Summary do
add_non_zero_value(xml, :ChildAndDependentCareCr, :MD502CR_PART_AA_LINE_2)
add_non_zero_value(xml, :SeniorCr, :MD502CR_PART_AA_LINE_13)
add_non_zero_value(xml, :TotalCredits, :MD502CR_PART_AA_LINE_14)
end
xml.Refundable do
add_non_zero_value(xml, :ChildAndDependentCareCr, :MD502CR_PART_CC_LINE_7)
Expand All @@ -38,10 +34,6 @@ def document

private

def deduction_method_is_standard
calculated_fields.fetch(:MD502_DEDUCTION_METHOD) == "S"
end

def intake
@submission.data_source
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,21 @@

context "when deduction method is N" do
before do
intake.direct_file_data.fed_credit_for_child_and_dependent_care_amount = 10
allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_deduction_method).and_return("N")
end

it "does not output parts B, M or AA but still outputs part CC" do
expect(xml.at("Form502CR ChildAndDependentCare")).to be_nil
expect(xml.at("Form502CR Senior")).to be_nil
expect(xml.at("Form502CR Summary")).to be_nil
it "does output parts B, M, AA, and part CC" do
expect(xml.at("Form502CR ChildAndDependentCare FederalAdjustedGrossIncome").text.to_i).to eq(100)
expect(xml.at("Form502CR ChildAndDependentCare FederalChildCareCredit").text.to_i).to eq(10)
expect(xml.at("Form502CR ChildAndDependentCare DecimalAmount").text.to_d).to eq(0.32)
expect(xml.at("Form502CR ChildAndDependentCare Credit").text.to_i).to eq(3)
expect(xml.at("Form502CR Senior Credit").text.to_i).to eq(1_000)
expect(xml.at("Form502CR Summary ChildAndDependentCareCr").text.to_i).to eq(3)
expect(xml.at("Form502CR Summary SeniorCr").text.to_i).to eq(1_000)
expect(xml.at("Form502CR Summary TotalCredits").text.to_i).to eq(1003)
expect(xml.at("Form502CR Refundable")).not_to be_nil
end

context "has positive MD502CR_PART_CC_LINE_7 value" do
before do
intake.direct_file_data.fed_credit_for_child_and_dependent_care_amount = 10
allow_any_instance_of(Efile::Md::Md502crCalculator).to receive(:calculate_part_cc_line_7).and_return 100
end

it "does output parts B but not M or AA but still outputs part CC" do
expect(xml.at("Form502CR ChildAndDependentCare FederalAdjustedGrossIncome").text.to_i).to eq(100)
expect(xml.at("Form502CR ChildAndDependentCare FederalChildCareCredit").text.to_i).to eq(10)
expect(xml.at("Form502CR ChildAndDependentCare DecimalAmount").text.to_d).to eq(0.32)
expect(xml.at("Form502CR ChildAndDependentCare Credit").text.to_i).to eq(3)
expect(xml.at("Form502CR Senior")).to be_nil
expect(xml.at("Form502CR Summary")).to be_nil
expect(xml.at("Form502CR Refundable")).not_to be_nil
end
end
end
end
end
Expand Down
Loading