diff --git a/app/lib/submission_builder/ty2024/states/md/documents/md502_cr.rb b/app/lib/submission_builder/ty2024/states/md/documents/md502_cr.rb index 42d9a7ca24..8fbb69ed58 100644 --- a/app/lib/submission_builder/ty2024/states/md/documents/md502_cr.rb +++ b/app/lib/submission_builder/ty2024/states/md/documents/md502_cr.rb @@ -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) @@ -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 diff --git a/spec/lib/submission_builder/ty2024/states/md/documents/md502_cr_spec.rb b/spec/lib/submission_builder/ty2024/states/md/documents/md502_cr_spec.rb index e6f9324442..32bce62bc9 100644 --- a/spec/lib/submission_builder/ty2024/states/md/documents/md502_cr_spec.rb +++ b/spec/lib/submission_builder/ty2024/states/md/documents/md502_cr_spec.rb @@ -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