From e975d020d426781f34167b61599fd8333b993f39 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 12 Nov 2024 18:40:19 -0800 Subject: [PATCH 01/30] WIP: preliminary implementation with no income --- app/lib/efile/md/md502_calculator.rb | 12 +++ .../md/md_two_income_subtraction_worksheet.rb | 95 +++++++++++++++++++ ...d_two_income_subtraction_worksheet_spec.rb | 26 +++++ 3 files changed, 133 insertions(+) create mode 100644 app/lib/efile/md/md_two_income_subtraction_worksheet.rb create mode 100644 spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb diff --git a/app/lib/efile/md/md502_calculator.rb b/app/lib/efile/md/md502_calculator.rb index 23ba3930bb..6f352e1851 100644 --- a/app/lib/efile/md/md502_calculator.rb +++ b/app/lib/efile/md/md502_calculator.rb @@ -16,6 +16,12 @@ def initialize(year:, intake:, include_source: false) lines: @lines, intake: @intake ) + + @md_two_income_subtraction_worksheet = Efile::Md::MdTwoIncomeSubtractionWorksheet.new( + value_access_tracker: @value_access_tracker, + lines: @lines, + intake: @intake + ) end def calculate @@ -51,6 +57,7 @@ def calculate # MD502SU Subtractions @md502_su.calculate set_line(:MD502_LINE_13, :calculate_line_13) + set_line(:MD502_LINE_14, :calculate_line_14) # Subtractions set_line(:MD502_LINE_10A, :calculate_line_10a) # STUBBED: PLEASE REPLACE, don't forget line_data.yml @@ -427,6 +434,11 @@ def calculate_line_13 @lines[:MD502_SU_LINE_1].value end + def calculate_line_14 + @md_two_income_subtraction_worksheet.calculate + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_7].value + end + def calculate_line_21 # Maryland state income tax taxable_net_income = line_or_zero(:MD502_LINE_20) diff --git a/app/lib/efile/md/md_two_income_subtraction_worksheet.rb b/app/lib/efile/md/md_two_income_subtraction_worksheet.rb new file mode 100644 index 0000000000..fa9dc479f1 --- /dev/null +++ b/app/lib/efile/md/md_two_income_subtraction_worksheet.rb @@ -0,0 +1,95 @@ +module Efile + module Md + class MdTwoIncomeSubtractionWorksheet < ::Efile::TaxCalculator + # https://www.marylandtaxes.gov/forms/worksheets/Two-income-worksheet.pdf + + attr_accessor :lines, :value_access_tracker + + def initialize(value_access_tracker:, lines:, intake:) + @value_access_tracker = value_access_tracker + @lines = lines + @direct_file_data = intake.direct_file_data + @direct_file_json_data = intake.direct_file_json_data + end + + def calculate + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY, -> { calculate_line_1 is_primary_filer: true }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY, -> { calculate_line_2 is_primary_filer: true }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY, -> { calculate_line_3 is_primary_filer: true }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY, -> { calculate_line_4 is_primary_filer: true }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY, -> { calculate_line_5 is_primary_filer: true }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE, -> { calculate_line_1 is_primary_filer: false }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE, -> { calculate_line_2 is_primary_filer: false }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE, -> { calculate_line_3 is_primary_filer: false }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE, -> { calculate_line_4 is_primary_filer: false }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE, -> { calculate_line_5 is_primary_filer: false }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6, :calculate_line_6) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_7, :calculate_line_7) + end + + private + + def calculate_fed_income(is_primary_filer:) + # NOTE: this is only income relevant for this worksheet and current tax scope + + # direct_file_data.w2s.WagesAmt / direct_file_data.w2s.EmployeeSSN + # direct_file_json_data.interest_reports.amount_1099 / direct_file_json_data.interest_reports.recipient_tin + # direct_file_json_data.interest_reports.amount_no_1099 / direct_file_json_data.interest_reports.recipient_tin + # state_file1099_rs.taxable_amount / intake_class.state_file1099_rs.recipient_ssn + # direct_file_json_data.filers.form1099GsTotal / direct_file_json_data.filers.tin OR something else? + is_primary_filer + 0 + end + + def calculate_fed_subtractions(is_primary_filer:) + # subtractions + # STUB: primary_student_loan_interest_ded_amount & spouse_student_loan_interest_ded_amount + # direct_file_json_data.filers.educatorExpenses + # direct_file_json_data.filers.hsaTotalDeductibleAmount + is_primary_filer + 0 + end + + def calculate_line_1(is_primary_filer:) + calculate_fed_income(is_primary_filer: is_primary_filer) - calculate_fed_subtractions(is_primary_filer: is_primary_filer) + end + + def calculate_line_2(is_primary_filer:) + # intake_class.state_file_w2s.box_14_stpickup / intake_class.state_file_w2s.employee_ssn + 0 + end + + def calculate_line_3(is_primary_filer:) + if is_primary_filer + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY].value + else + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE].value + end + end + + def calculate_line_4(is_primary_filer:) + # direct_file_data.total_qualifying_dependent_care_expenses / 2 + # STUB: MD pension exclusion + # STUB: MD retirement exclusion + 0 + end + + def calculate_line_5(is_primary_filer:) + if is_primary_filer + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY].value - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY].value + else + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE].value - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE].value + end + end + + def calculate_line_6 + lower_income = [@lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value, @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE].value].min + [lower_income, 0].max + end + + def calculate_line_7 + [@lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value, 1_200].max + end + end + end +end diff --git a/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb new file mode 100644 index 0000000000..f0dea40d34 --- /dev/null +++ b/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +require 'rails_helper' + +RSpec.describe Efile::Md::MdTwoIncomeSubtractionWorksheet do + before do + instance.calculate + end + + let(:intake) { create(:state_file_md_intake, :with_spouse) } + let(:main_calculator) do + Efile::Md::Md502Calculator.new( + year: MultiTenantService.statefile.current_tax_year, + intake: intake + ) + end + let(:instance) { main_calculator.instance_variable_get(:@md_two_income_subtraction_worksheet) } + + describe "#calculate_fed_income" do + context "no income" do + it "calculates the amount" do + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value).to eq(0) + end + end + end +end From 493387428f11e880d96fc5bdcf1785ea24dfe645 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 12 Nov 2024 19:09:03 -0800 Subject: [PATCH 02/30] WIP: add tests with hardcoded values for spouse and primary --- .../md/md_two_income_subtraction_worksheet.rb | 15 ++-- ...d_two_income_subtraction_worksheet_spec.rb | 76 ++++++++++++++++++- 2 files changed, 79 insertions(+), 12 deletions(-) diff --git a/app/lib/efile/md/md_two_income_subtraction_worksheet.rb b/app/lib/efile/md/md_two_income_subtraction_worksheet.rb index fa9dc479f1..be3a50fcf2 100644 --- a/app/lib/efile/md/md_two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/md_two_income_subtraction_worksheet.rb @@ -27,8 +27,6 @@ def calculate set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_7, :calculate_line_7) end - private - def calculate_fed_income(is_primary_filer:) # NOTE: this is only income relevant for this worksheet and current tax scope @@ -37,26 +35,25 @@ def calculate_fed_income(is_primary_filer:) # direct_file_json_data.interest_reports.amount_no_1099 / direct_file_json_data.interest_reports.recipient_tin # state_file1099_rs.taxable_amount / intake_class.state_file1099_rs.recipient_ssn # direct_file_json_data.filers.form1099GsTotal / direct_file_json_data.filers.tin OR something else? - is_primary_filer - 0 + is_primary_filer ? 100 : 200 end def calculate_fed_subtractions(is_primary_filer:) - # subtractions # STUB: primary_student_loan_interest_ded_amount & spouse_student_loan_interest_ded_amount # direct_file_json_data.filers.educatorExpenses # direct_file_json_data.filers.hsaTotalDeductibleAmount - is_primary_filer - 0 + is_primary_filer ? 10 : 20 end + private + def calculate_line_1(is_primary_filer:) calculate_fed_income(is_primary_filer: is_primary_filer) - calculate_fed_subtractions(is_primary_filer: is_primary_filer) end def calculate_line_2(is_primary_filer:) # intake_class.state_file_w2s.box_14_stpickup / intake_class.state_file_w2s.employee_ssn - 0 + is_primary_filer ? 50 : 60 end def calculate_line_3(is_primary_filer:) @@ -71,7 +68,7 @@ def calculate_line_4(is_primary_filer:) # direct_file_data.total_qualifying_dependent_care_expenses / 2 # STUB: MD pension exclusion # STUB: MD retirement exclusion - 0 + is_primary_filer ? 20 : 40 end def calculate_line_5(is_primary_filer:) diff --git a/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb index f0dea40d34..9fd39c3d09 100644 --- a/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb @@ -17,9 +17,79 @@ describe "#calculate_fed_income" do context "no income" do - it "calculates the amount" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value).to eq(0) + it "calculates the fed income amount for primary and spouse" do + expect(instance.calculate_fed_income(is_primary_filer: true)).to eq(100) + expect(instance.calculate_fed_income(is_primary_filer: false)).to eq(200) + end + end + end + + describe "#calculate_fed_subtractions" do + context "no subtractions" do + it "calculates the fed subtraction amount for primary and spouse" do + expect(instance.calculate_fed_subtractions(is_primary_filer: true)).to eq(10) + expect(instance.calculate_fed_subtractions(is_primary_filer: false)).to eq(20) + end + end + end + + describe "#calculate_line_1" do + context "no income" do + it "subtracts fed subtractions from fed income" do + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value).to eq(90) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value).to eq(180) + end + end + end + + describe "#calculate_line_2" do + context "no income" do + it "calculates the state addition amount for primary and spouse" do + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY].value).to eq(50) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE].value).to eq(60) + end + end + end + + describe "#calculate_line_3" do + context "no income" do + it "adds state additions to current amount" do + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY].value).to eq(140) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE].value).to eq(240) + end + end + end + + describe "#calculate_line_4" do + context "no income" do + it "calculates the state subtraction amount for primary and spouse" do + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY].value).to eq(20) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE].value).to eq(40) + end + end + end + + describe "#calculate_line_5" do + context "no income" do + it "subtracts state subtractions from current amount" do + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value).to eq(120) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE].value).to eq(200) + end + end + end + + describe "#calculate_line_6" do + context "no income" do + it "returns the lower agi of the two filers" do + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6].value).to eq(120) + end + end + end + + describe "#calculate_line_7" do + context "no income" do + it "returns the subtraction amount" do + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6].value).to eq(120) end end end From 86ed380a3618df3000be5bff218b61c67b043d32 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 12 Nov 2024 19:17:53 -0800 Subject: [PATCH 03/30] WIP: implement first pass at data sources for worksheet calculations --- app/lib/efile/md/md502_calculator.rb | 2 +- .../md/md_two_income_subtraction_worksheet.rb | 92 ------------- .../md/two_income_subtraction_worksheet.rb | 126 ++++++++++++++++++ app/models/direct_file_json_data.rb | 2 - ... two_income_subtraction_worksheet_spec.rb} | 54 ++++---- 5 files changed, 154 insertions(+), 122 deletions(-) delete mode 100644 app/lib/efile/md/md_two_income_subtraction_worksheet.rb create mode 100644 app/lib/efile/md/two_income_subtraction_worksheet.rb rename spec/lib/efile/md/{md_two_income_subtraction_worksheet_spec.rb => two_income_subtraction_worksheet_spec.rb} (66%) diff --git a/app/lib/efile/md/md502_calculator.rb b/app/lib/efile/md/md502_calculator.rb index 6f352e1851..d61c3d3ef5 100644 --- a/app/lib/efile/md/md502_calculator.rb +++ b/app/lib/efile/md/md502_calculator.rb @@ -17,7 +17,7 @@ def initialize(year:, intake:, include_source: false) intake: @intake ) - @md_two_income_subtraction_worksheet = Efile::Md::MdTwoIncomeSubtractionWorksheet.new( + @two_income_subtraction_worksheet = Efile::Md::TwoIncomeSubtractionWorksheet.new( value_access_tracker: @value_access_tracker, lines: @lines, intake: @intake diff --git a/app/lib/efile/md/md_two_income_subtraction_worksheet.rb b/app/lib/efile/md/md_two_income_subtraction_worksheet.rb deleted file mode 100644 index be3a50fcf2..0000000000 --- a/app/lib/efile/md/md_two_income_subtraction_worksheet.rb +++ /dev/null @@ -1,92 +0,0 @@ -module Efile - module Md - class MdTwoIncomeSubtractionWorksheet < ::Efile::TaxCalculator - # https://www.marylandtaxes.gov/forms/worksheets/Two-income-worksheet.pdf - - attr_accessor :lines, :value_access_tracker - - def initialize(value_access_tracker:, lines:, intake:) - @value_access_tracker = value_access_tracker - @lines = lines - @direct_file_data = intake.direct_file_data - @direct_file_json_data = intake.direct_file_json_data - end - - def calculate - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY, -> { calculate_line_1 is_primary_filer: true }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY, -> { calculate_line_2 is_primary_filer: true }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY, -> { calculate_line_3 is_primary_filer: true }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY, -> { calculate_line_4 is_primary_filer: true }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY, -> { calculate_line_5 is_primary_filer: true }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE, -> { calculate_line_1 is_primary_filer: false }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE, -> { calculate_line_2 is_primary_filer: false }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE, -> { calculate_line_3 is_primary_filer: false }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE, -> { calculate_line_4 is_primary_filer: false }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE, -> { calculate_line_5 is_primary_filer: false }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6, :calculate_line_6) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_7, :calculate_line_7) - end - - def calculate_fed_income(is_primary_filer:) - # NOTE: this is only income relevant for this worksheet and current tax scope - - # direct_file_data.w2s.WagesAmt / direct_file_data.w2s.EmployeeSSN - # direct_file_json_data.interest_reports.amount_1099 / direct_file_json_data.interest_reports.recipient_tin - # direct_file_json_data.interest_reports.amount_no_1099 / direct_file_json_data.interest_reports.recipient_tin - # state_file1099_rs.taxable_amount / intake_class.state_file1099_rs.recipient_ssn - # direct_file_json_data.filers.form1099GsTotal / direct_file_json_data.filers.tin OR something else? - is_primary_filer ? 100 : 200 - end - - def calculate_fed_subtractions(is_primary_filer:) - # STUB: primary_student_loan_interest_ded_amount & spouse_student_loan_interest_ded_amount - # direct_file_json_data.filers.educatorExpenses - # direct_file_json_data.filers.hsaTotalDeductibleAmount - is_primary_filer ? 10 : 20 - end - - private - - def calculate_line_1(is_primary_filer:) - calculate_fed_income(is_primary_filer: is_primary_filer) - calculate_fed_subtractions(is_primary_filer: is_primary_filer) - end - - def calculate_line_2(is_primary_filer:) - # intake_class.state_file_w2s.box_14_stpickup / intake_class.state_file_w2s.employee_ssn - is_primary_filer ? 50 : 60 - end - - def calculate_line_3(is_primary_filer:) - if is_primary_filer - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY].value - else - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE].value - end - end - - def calculate_line_4(is_primary_filer:) - # direct_file_data.total_qualifying_dependent_care_expenses / 2 - # STUB: MD pension exclusion - # STUB: MD retirement exclusion - is_primary_filer ? 20 : 40 - end - - def calculate_line_5(is_primary_filer:) - if is_primary_filer - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY].value - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY].value - else - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE].value - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE].value - end - end - - def calculate_line_6 - lower_income = [@lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value, @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE].value].min - [lower_income, 0].max - end - - def calculate_line_7 - [@lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value, 1_200].max - end - end - end -end diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb new file mode 100644 index 0000000000..62b8f8fb7c --- /dev/null +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -0,0 +1,126 @@ +module Efile + module Md + class TwoIncomeSubtractionWorksheet < ::Efile::TaxCalculator + # https://www.marylandtaxes.gov/forms/worksheets/Two-income-worksheet.pdf + + attr_accessor :lines, :value_access_tracker + + def initialize(value_access_tracker:, lines:, intake:) + @value_access_tracker = value_access_tracker + @lines = lines + @intake = intake + @direct_file_data = intake.direct_file_data + @direct_file_json_data = intake.direct_file_json_data + end + + def calculate + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY, -> { calculate_line_1 :primary }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY, -> { calculate_line_2 :primary }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY, -> { calculate_line_3 :primary }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY, -> { calculate_line_4 :primary }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY, -> { calculate_line_5 :primary }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE, -> { calculate_line_1 :spouse }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE, -> { calculate_line_2 :spouse }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE, -> { calculate_line_3 :spouse }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE, -> { calculate_line_4 :spouse }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE, -> { calculate_line_5 :spouse }) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6, :calculate_line_6) + set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_7, :calculate_line_7) + end + + def calculate_fed_income(primary_or_spouse) + filer = @intake.send(primary_or_spouse) + + wage_income = @intake.state_file_w2s + .select { |w2| w2.employee_ssn == filer.ssn } + .sum(&:state_income_tax_amount) + interest_income = @direct_file_json_data.interest_reports + .select { |interest_report| interest_report.recipient_tin == filer.ssn } + .sum { |interest_report| + interest_report.amount_1099 + interest_report.amount_no_1099 + } + retirement_income = @intake.state_file1099_rs + .select { |form1099r| form1099r.recipient_ssn == filer.ssn } + .sum(&:taxable_amount) + # TODO: check in about getting this from DF JSON instead + unemployment_income = @intake.state_file1099_gs + .select { |form1099g| form1099g.recipient == primary_or_spouse } + .sum(&:unemployment_compensation_amount) + + wage_income + + interest_income + + retirement_income + + unemployment_income + end + + def calculate_fed_subtractions(primary_or_spouse) + filer_json = @direct_file_json_data.filers + .select { |df_filer_data| + df_filer_data.tin == @intake.send(primary_or_spouse).ssn + } + student_loan_interest = { + primary: 0, # TBD primary_student_loan_interest_ded_amount + spouse: 0, # TBD spouse_student_loan_interest_ded_amount + }[primary_or_spouse] + educator_expenses = 0 # TODO: filer_json.educatorExpenses + hsa_deduction = 0 # TODO: filer_json.hsaTotalDeductibleAmount + + student_loan_interest + + educator_expenses + + hsa_deduction + end + + private + + def calculate_line_1(primary_or_spouse) + calculate_fed_income(primary_or_spouse) - calculate_fed_subtractions(primary_or_spouse) + end + + def calculate_line_2(primary_or_spouse) + @intake.state_file_w2s + .select { |w2| w2.employee_ssn == @intake.send(primary_or_spouse).ssn } + .sum(&:box14_stpickup) + end + + def calculate_line_3(primary_or_spouse) + if primary_or_spouse + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value + + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY].value + else + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value + + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE].value + end + end + + def calculate_line_4(primary_or_spouse) + cdc_expenses = @direct_file_data.total_qualifying_dependent_care_expenses / 2 + pension_exclusion = 0 # TODO: MD pension exclusion + military_retirement_exclusion = 0 # TODO: MD military retirement exclusion + + cdc_expenses + + pension_exclusion + + military_retirement_exclusion + end + + def calculate_line_5(primary_or_spouse) + if primary_or_spouse + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY].value - + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY].value + else + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE].value - + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE].value + end + end + + def calculate_line_6 + lower_income = [@lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value, + @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE].value].min + [lower_income, 0].max + end + + def calculate_line_7 + [@lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value, 1_200].max + end + end + end +end diff --git a/app/models/direct_file_json_data.rb b/app/models/direct_file_json_data.rb index 59d75ad294..f250576fa9 100644 --- a/app/models/direct_file_json_data.rb +++ b/app/models/direct_file_json_data.rb @@ -63,8 +63,6 @@ def interest_reports data["interestReports"]&.map { |interest_report| DfJsonInterestReport.new(interest_report) } || [] end - private - def filers data["filers"]&.map { |filer| DfJsonFiler.new(filer) } || [] end diff --git a/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb similarity index 66% rename from spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb rename to spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index 9fd39c3d09..dda0700f3e 100644 --- a/spec/lib/efile/md/md_two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'rails_helper' -RSpec.describe Efile::Md::MdTwoIncomeSubtractionWorksheet do +RSpec.describe Efile::Md::TwoIncomeSubtractionWorksheet do before do instance.calculate end @@ -13,83 +13,83 @@ intake: intake ) end - let(:instance) { main_calculator.instance_variable_get(:@md_two_income_subtraction_worksheet) } + let(:instance) { main_calculator.instance_variable_get(:@two_income_subtraction_worksheet) } describe "#calculate_fed_income" do - context "no income" do + context "no fed income" do it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(is_primary_filer: true)).to eq(100) - expect(instance.calculate_fed_income(is_primary_filer: false)).to eq(200) + expect(instance.calculate_fed_income(:primary)).to eq(0) + expect(instance.calculate_fed_income(:spouse)).to eq(0) end end end describe "#calculate_fed_subtractions" do - context "no subtractions" do + context "no fed subtractions" do it "calculates the fed subtraction amount for primary and spouse" do - expect(instance.calculate_fed_subtractions(is_primary_filer: true)).to eq(10) - expect(instance.calculate_fed_subtractions(is_primary_filer: false)).to eq(20) + expect(instance.calculate_fed_subtractions(:primary)).to eq(0) + expect(instance.calculate_fed_subtractions(:spouse)).to eq(0) end end end describe "#calculate_line_1" do - context "no income" do + context "no fed income, no subtractions" do it "subtracts fed subtractions from fed income" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value).to eq(90) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value).to eq(180) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value).to eq(0) end end end describe "#calculate_line_2" do - context "no income" do + context "no state additions" do it "calculates the state addition amount for primary and spouse" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY].value).to eq(50) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE].value).to eq(60) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE].value).to eq(0) end end end describe "#calculate_line_3" do - context "no income" do + context "no fed income, no fed subtractions, no state additions" do it "adds state additions to current amount" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY].value).to eq(140) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE].value).to eq(240) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE].value).to eq(0) end end end describe "#calculate_line_4" do - context "no income" do + context "no state subtractions" do it "calculates the state subtraction amount for primary and spouse" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY].value).to eq(20) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE].value).to eq(40) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE].value).to eq(0) end end end describe "#calculate_line_5" do - context "no income" do + context "no fed income, no fed subtractions, no state additions" do it "subtracts state subtractions from current amount" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value).to eq(120) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE].value).to eq(200) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE].value).to eq(0) end end end describe "#calculate_line_6" do - context "no income" do + context "no agi" do it "returns the lower agi of the two filers" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6].value).to eq(120) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6].value).to eq(0) end end end describe "#calculate_line_7" do - context "no income" do + context "no agi" do it "returns the subtraction amount" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6].value).to eq(120) + expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6].value).to eq(0) end end end From 3a1986f4eaa4653e7d9423292e2caf9e2c8b4f77 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 12 Nov 2024 20:50:25 -0800 Subject: [PATCH 04/30] Add TwoIncome calculation to xml & pdf --- app/lib/pdf_filler/md502_pdf.rb | 1 + app/lib/submission_builder/ty2024/states/md/documents/md502.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/lib/pdf_filler/md502_pdf.rb b/app/lib/pdf_filler/md502_pdf.rb index 11a8529a92..b9d0d6f45c 100644 --- a/app/lib/pdf_filler/md502_pdf.rb +++ b/app/lib/pdf_filler/md502_pdf.rb @@ -74,6 +74,7 @@ def hash_for_pdf 'Text Field 11': generate_codes_for_502_su.at(2), 'Text Field 12': generate_codes_for_502_su.at(3), 'Enter 13': @xml_document.at('Form502 Subtractions Other')&.text, + 'Enter 14': @xml_document.at('Form502 Subtractions TwoIncome')&.text, 'Text Box 68': @xml_document.at('Form502 TaxWithheld')&.text, 'Text Box 34': @xml_document.at('Form502 StateTaxComputation EarnedIncomeCredit')&.text, 'Check Box 37': checkbox_value(@xml_document.at('Form502 StateTaxComputation MDEICWithQualChildInd')&.text), diff --git a/app/lib/submission_builder/ty2024/states/md/documents/md502.rb b/app/lib/submission_builder/ty2024/states/md/documents/md502.rb index d33d3b824c..a6fcb93332 100644 --- a/app/lib/submission_builder/ty2024/states/md/documents/md502.rb +++ b/app/lib/submission_builder/ty2024/states/md/documents/md502.rb @@ -117,6 +117,7 @@ def document xml.ChildAndDependentCareExpenses @direct_file_data.total_qualifying_dependent_care_expenses xml.SocialSecurityRailRoadBenefits @direct_file_data.fed_taxable_ssb xml.Other calculated_fields.fetch(:MD502_LINE_13) + xml.TwoIncome calculated_fields.fetch(:MD502_LINE_14) add_element_if_present(xml, "Total", :MD502_LINE_15) add_element_if_present(xml, "StateAdjustedGrossIncome", :MD502_LINE_16) end From 4d07b8f0ca0fff4972427a623287a5f856563e15 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 13 Nov 2024 10:53:17 -0800 Subject: [PATCH 05/30] WIP add labels and minor fixes --- app/lib/efile/line_data.yml | 34 ++++++++++++ app/lib/efile/md/md502_calculator.rb | 5 +- .../md/two_income_subtraction_worksheet.rb | 52 +++++++++---------- .../two_income_subtraction_worksheet_spec.rb | 22 ++++---- 4 files changed, 74 insertions(+), 39 deletions(-) diff --git a/app/lib/efile/line_data.yml b/app/lib/efile/line_data.yml index abe4c5db57..bc76c3f926 100644 --- a/app/lib/efile/line_data.yml +++ b/app/lib/efile/line_data.yml @@ -598,6 +598,40 @@ MD502_LINE_10A: label: 'TBD' MD502_LINE_13: label: 'Subtractions from attached form 502SU' +MD_TWO_INCOME_WK_LINE_1_A: + label: 'ENTER the portion of federal adjusted gross income from line 1 of Form 502 +attributable to each spouse. (a) you' +MD_TWO_INCOME_WK_LINE_2_A: + label: 'ENTER the portion of additions to income from line 6 of Form 502 +attributable to each spouse. (a) you' +MD_TWO_INCOME_WK_LINE_3_A: + label: 'ADD lines 1 and 2. (a) you' +MD_TWO_INCOME_WK_LINE_4_A: + label: 'ENTER the portion of subtractions from income from lines 8 - 13 of Form 502 +attributable to each spouse. (a) you' +MD_TWO_INCOME_WK_LINE_5_A: + label: 'SUBTRACT line 4 from line 3. (a) you' +MD_TWO_INCOME_WK_LINE_1_B: + label: 'ENTER the portion of federal adjusted gross income from line 1 of Form 502 +attributable to each spouse. (b) your spouse' +MD_TWO_INCOME_WK_LINE_2_B: + label: 'ENTER the portion of additions to income from line 6 of Form 502 +attributable to each spouse. (b) your spouse' +MD_TWO_INCOME_WK_LINE_3_B: + label: 'ADD lines 1 and 2. (b) your spouse' +MD_TWO_INCOME_WK_LINE_4_B: + label: 'ENTER the portion of subtractions from income from lines 8 - 13 of Form 502 +attributable to each spouse. (b) your spouse' +MD_TWO_INCOME_WK_LINE_5_B: + label: 'SUBTRACT line 4 from line 3. (b) your spouse' +MD_TWO_INCOME_WK_LINE_6: + label: 'COMPARE the amounts on lines 5 (a) and (b) and enter the smaller amount here +but not less than zero' +MD_TWO_INCOME_WK_LINE_7: + label: 'ENTER $1,200 or the amount on line 6, whichever is less. +ENTER this amount on line 14 of Form 502.' +MD502_LINE_14: + label: 'Two-income subtraction from worksheet in Instruction 13.' MD502_LINE_15: label: 'Total subtractions (Add lines 8 through 14. See instructions.)' MD502_LINE_16: diff --git a/app/lib/efile/md/md502_calculator.rb b/app/lib/efile/md/md502_calculator.rb index d61c3d3ef5..db2e64da1b 100644 --- a/app/lib/efile/md/md502_calculator.rb +++ b/app/lib/efile/md/md502_calculator.rb @@ -57,6 +57,7 @@ def calculate # MD502SU Subtractions @md502_su.calculate set_line(:MD502_LINE_13, :calculate_line_13) + @two_income_subtraction_worksheet.calculate set_line(:MD502_LINE_14, :calculate_line_14) # Subtractions @@ -435,8 +436,8 @@ def calculate_line_13 end def calculate_line_14 - @md_two_income_subtraction_worksheet.calculate - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_7].value + return 0 unless filing_status_mfj? + @lines[:MD_TWO_INCOME_WK_LINE_7].value end def calculate_line_21 diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 62b8f8fb7c..1b015d2616 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -14,18 +14,18 @@ def initialize(value_access_tracker:, lines:, intake:) end def calculate - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY, -> { calculate_line_1 :primary }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY, -> { calculate_line_2 :primary }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY, -> { calculate_line_3 :primary }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY, -> { calculate_line_4 :primary }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY, -> { calculate_line_5 :primary }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE, -> { calculate_line_1 :spouse }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE, -> { calculate_line_2 :spouse }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE, -> { calculate_line_3 :spouse }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE, -> { calculate_line_4 :spouse }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE, -> { calculate_line_5 :spouse }) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6, :calculate_line_6) - set_line(:MD_TWO_INCOME_SUBTRACTION_WK_LINE_7, :calculate_line_7) + set_line(:MD_TWO_INCOME_WK_LINE_1_A, -> { calculate_line_1 :primary }) + set_line(:MD_TWO_INCOME_WK_LINE_2_A, -> { calculate_line_2 :primary }) + set_line(:MD_TWO_INCOME_WK_LINE_3_A, -> { calculate_line_3 :primary }) + set_line(:MD_TWO_INCOME_WK_LINE_4_A, -> { calculate_line_4 :primary }) + set_line(:MD_TWO_INCOME_WK_LINE_5_A, -> { calculate_line_5 :primary }) + set_line(:MD_TWO_INCOME_WK_LINE_1_B, -> { calculate_line_1 :spouse }) + set_line(:MD_TWO_INCOME_WK_LINE_2_B, -> { calculate_line_2 :spouse }) + set_line(:MD_TWO_INCOME_WK_LINE_3_B, -> { calculate_line_3 :spouse }) + set_line(:MD_TWO_INCOME_WK_LINE_4_B, -> { calculate_line_4 :spouse }) + set_line(:MD_TWO_INCOME_WK_LINE_5_B, -> { calculate_line_5 :spouse }) + set_line(:MD_TWO_INCOME_WK_LINE_6, :calculate_line_6) + set_line(:MD_TWO_INCOME_WK_LINE_7, :calculate_line_7) end def calculate_fed_income(primary_or_spouse) @@ -59,8 +59,8 @@ def calculate_fed_subtractions(primary_or_spouse) df_filer_data.tin == @intake.send(primary_or_spouse).ssn } student_loan_interest = { - primary: 0, # TBD primary_student_loan_interest_ded_amount - spouse: 0, # TBD spouse_student_loan_interest_ded_amount + primary: 0, # TODO: primary_student_loan_interest_ded_amount + spouse: 0, # TODO: spouse_student_loan_interest_ded_amount }[primary_or_spouse] educator_expenses = 0 # TODO: filer_json.educatorExpenses hsa_deduction = 0 # TODO: filer_json.hsaTotalDeductibleAmount @@ -79,16 +79,16 @@ def calculate_line_1(primary_or_spouse) def calculate_line_2(primary_or_spouse) @intake.state_file_w2s .select { |w2| w2.employee_ssn == @intake.send(primary_or_spouse).ssn } - .sum(&:box14_stpickup) + .sum { |w2| w2.box14_stpickup || 0 } end def calculate_line_3(primary_or_spouse) if primary_or_spouse - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value + - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY].value + @lines[:MD_TWO_INCOME_WK_LINE_1_A].value + + @lines[:MD_TWO_INCOME_WK_LINE_2_A].value else - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value + - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE].value + @lines[:MD_TWO_INCOME_WK_LINE_1_B].value + + @lines[:MD_TWO_INCOME_WK_LINE_2_B].value end end @@ -104,22 +104,22 @@ def calculate_line_4(primary_or_spouse) def calculate_line_5(primary_or_spouse) if primary_or_spouse - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY].value - - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY].value + @lines[:MD_TWO_INCOME_WK_LINE_3_A].value - + @lines[:MD_TWO_INCOME_WK_LINE_4_A].value else - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE].value - - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE].value + @lines[:MD_TWO_INCOME_WK_LINE_3_B].value - + @lines[:MD_TWO_INCOME_WK_LINE_4_B].value end end def calculate_line_6 - lower_income = [@lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value, - @lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE].value].min + lower_income = [@lines[:MD_TWO_INCOME_WK_LINE_5_A].value, + @lines[:MD_TWO_INCOME_WK_LINE_5_B].value].min [lower_income, 0].max end def calculate_line_7 - [@lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value, 1_200].max + [@lines[:MD_TWO_INCOME_WK_LINE_6].value, 1_200].min end end end diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index dda0700f3e..e1fa6094d1 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -36,8 +36,8 @@ describe "#calculate_line_1" do context "no fed income, no subtractions" do it "subtracts fed subtractions from fed income" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_1_SPOUSE].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_SPOUSE].value).to eq(0) end end end @@ -45,8 +45,8 @@ describe "#calculate_line_2" do context "no state additions" do it "calculates the state addition amount for primary and spouse" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_2_SPOUSE].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_SPOUSE].value).to eq(0) end end end @@ -54,8 +54,8 @@ describe "#calculate_line_3" do context "no fed income, no fed subtractions, no state additions" do it "adds state additions to current amount" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_3_SPOUSE].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_SPOUSE].value).to eq(0) end end end @@ -63,8 +63,8 @@ describe "#calculate_line_4" do context "no state subtractions" do it "calculates the state subtraction amount for primary and spouse" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_4_SPOUSE].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_SPOUSE].value).to eq(0) end end end @@ -72,8 +72,8 @@ describe "#calculate_line_5" do context "no fed income, no fed subtractions, no state additions" do it "subtracts state subtractions from current amount" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_5_SPOUSE].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_PRIMARY].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_SPOUSE].value).to eq(0) end end end @@ -81,7 +81,7 @@ describe "#calculate_line_6" do context "no agi" do it "returns the lower agi of the two filers" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_6].value).to eq(0) end end end From 522da0daefe51ea5c871d135cf340452993bc94d Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Mon, 18 Nov 2024 14:24:46 -0800 Subject: [PATCH 06/30] WIP #calculate_fed_income base case tests passing --- .../md/two_income_subtraction_worksheet.rb | 22 ++-- spec/factories/state_file_md_intakes.rb | 11 ++ .../2023/md/todd_and_spouse_1099_int.json | 47 +++++++ .../fed_return_xmls/2023/md/zeus_many_w2s.xml | 8 +- .../two_income_subtraction_worksheet_spec.rb | 116 ++++++++++++++---- .../ty2024/states/md/md_return_xml_spec.rb | 7 +- spec/models/state_file_w2_spec.rb | 1 + 7 files changed, 171 insertions(+), 41 deletions(-) create mode 100644 spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 1b015d2616..24fd4673cb 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -31,20 +31,20 @@ def calculate def calculate_fed_income(primary_or_spouse) filer = @intake.send(primary_or_spouse) - wage_income = @intake.state_file_w2s - .select { |w2| w2.employee_ssn == filer.ssn } - .sum(&:state_income_tax_amount) + wage_income = @direct_file_data.w2s + .select { |w2| w2.EmployeeSSN == filer.ssn } + .sum(&:WagesAmt) interest_income = @direct_file_json_data.interest_reports - .select { |interest_report| interest_report.recipient_tin == filer.ssn } + .select { |interest_report| interest_report.recipient_tin.delete("-") == filer.ssn } .sum { |interest_report| - interest_report.amount_1099 + interest_report.amount_no_1099 + interest_report.amount_1099.round + interest_report.amount_no_1099.round } retirement_income = @intake.state_file1099_rs .select { |form1099r| form1099r.recipient_ssn == filer.ssn } .sum(&:taxable_amount) # TODO: check in about getting this from DF JSON instead unemployment_income = @intake.state_file1099_gs - .select { |form1099g| form1099g.recipient == primary_or_spouse } + .select { |form1099g| form1099g.recipient.to_sym == primary_or_spouse } .sum(&:unemployment_compensation_amount) wage_income + @@ -59,8 +59,8 @@ def calculate_fed_subtractions(primary_or_spouse) df_filer_data.tin == @intake.send(primary_or_spouse).ssn } student_loan_interest = { - primary: 0, # TODO: primary_student_loan_interest_ded_amount - spouse: 0, # TODO: spouse_student_loan_interest_ded_amount + primary: @intake.primary_student_loan_interest_ded_amount.round, + spouse: @intake.spouse_student_loan_interest_ded_amount.round, }[primary_or_spouse] educator_expenses = 0 # TODO: filer_json.educatorExpenses hsa_deduction = 0 # TODO: filer_json.hsaTotalDeductibleAmount @@ -83,7 +83,7 @@ def calculate_line_2(primary_or_spouse) end def calculate_line_3(primary_or_spouse) - if primary_or_spouse + if primary_or_spouse == :primary @lines[:MD_TWO_INCOME_WK_LINE_1_A].value + @lines[:MD_TWO_INCOME_WK_LINE_2_A].value else @@ -94,6 +94,8 @@ def calculate_line_3(primary_or_spouse) def calculate_line_4(primary_or_spouse) cdc_expenses = @direct_file_data.total_qualifying_dependent_care_expenses / 2 + + # NOTE: This data relies on 1099R followup questions, which have been deprioritized pension_exclusion = 0 # TODO: MD pension exclusion military_retirement_exclusion = 0 # TODO: MD military retirement exclusion @@ -103,7 +105,7 @@ def calculate_line_4(primary_or_spouse) end def calculate_line_5(primary_or_spouse) - if primary_or_spouse + if primary_or_spouse == :primary @lines[:MD_TWO_INCOME_WK_LINE_3_A].value - @lines[:MD_TWO_INCOME_WK_LINE_4_A].value else diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb index 24ef94bab8..298d088190 100644 --- a/spec/factories/state_file_md_intakes.rb +++ b/spec/factories/state_file_md_intakes.rb @@ -178,5 +178,16 @@ raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('md_todd_1099_int') } raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_todd_1099_int') } end + + trait :df_data_1099_int_with_spouse do + raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('md_todd_1099_int') } + raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_todd_and_spouse_1099_int') } + filing_status { 'married_filing_jointly' } + spouse_first_name { "Marty" } + spouse_middle_initial { "B" } + spouse_last_name { "Lando" } + spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 40 } + spouse_ssn { "987654321" } + end end end diff --git a/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json b/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json new file mode 100644 index 0000000000..71676dbea8 --- /dev/null +++ b/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json @@ -0,0 +1,47 @@ +{ + "familyAndHousehold": [], + "filers": [ + { + "firstName": "Todd", + "lastName": "Interest", + "middleInitial": "T", + "tin": "123-45-6789", + "dateOfBirth": "1980-01-01", + "isPrimaryFiler": true + }, + { + "firstName": "Todd", + "lastName": "Spouse", + "middleInitial": "T", + "tin": "987-65-4321", + "dateOfBirth": "1980-01-01", + "isPrimaryFiler": true + } + ], + "interestReports": [ + { + "1099Amount": "1.00", + "has1099": true, + "interestOnGovernmentBonds": "2.00", + "no1099Amount": "3.00", + "payer": "The payer name", + "payerTin": "101-23-4567", + "recipientTin": "123-45-6789", + "taxExemptAndTaxCreditBondCusipNo": "123456789", + "taxExemptInterest": "4.00", + "taxWithheld": "5.00" + }, + { + "1099Amount": "60.00", + "has1099": true, + "interestOnGovernmentBonds": "70.00", + "no1099Amount": "80.00", + "payer": "The payer name", + "payerTin": "101-23-4567", + "recipientTin": "987-65-4321", + "taxExemptAndTaxCreditBondCusipNo": "123456789", + "taxExemptInterest": "90.00", + "taxWithheld": "5.00" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/state_file/fed_return_xmls/2023/md/zeus_many_w2s.xml b/spec/fixtures/state_file/fed_return_xmls/2023/md/zeus_many_w2s.xml index f4232a20c8..5b8fb158b7 100644 --- a/spec/fixtures/state_file/fed_return_xmls/2023/md/zeus_many_w2s.xml +++ b/spec/fixtures/state_file/fed_return_xmls/2023/md/zeus_many_w2s.xml @@ -226,7 +226,7 @@ S - 400000016 + 400000015 001245768 BTB @@ -272,7 +272,7 @@ S - 400000017 + 400000015 001245769 ATLC @@ -318,7 +318,7 @@ S - 400000018 + 600000013 001245770 ATLC @@ -330,7 +330,7 @@ MD 08037 - ZEUS L THUNDER + HERA THUNDER 391 US-206 Unit 73 diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index e1fa6094d1..3eb3770908 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -1,11 +1,6 @@ -# frozen_string_literal: true require 'rails_helper' -RSpec.describe Efile::Md::TwoIncomeSubtractionWorksheet do - before do - instance.calculate - end - +describe Efile::Md::TwoIncomeSubtractionWorksheet do let(:intake) { create(:state_file_md_intake, :with_spouse) } let(:main_calculator) do Efile::Md::Md502Calculator.new( @@ -16,10 +11,52 @@ let(:instance) { main_calculator.instance_variable_get(:@two_income_subtraction_worksheet) } describe "#calculate_fed_income" do - context "no fed income" do + context "primary and spouse have only w2 income" do + let(:intake) { create(:state_file_md_intake, :df_data_many_w2s) } + it "calculates the fed income amount for primary and spouse" do + expect(instance.calculate_fed_income(:primary)).to eq(150_000) + expect(instance.calculate_fed_income(:spouse)).to eq(50_000) + end + end + + context "primary and spouse have only interest income" do + before do + intake.direct_file_data.spouse_ssn = "987654321" + intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) + end + let(:intake) { create(:state_file_md_intake, :df_data_1099_int_with_spouse) } + it "calculates the fed income amount for primary and spouse" do + expect(instance.calculate_fed_income(:primary)).to eq(4) + expect(instance.calculate_fed_income(:spouse)).to eq(140) + end + end + + context "primary and spouse have only retirement income" do + before do + intake.direct_file_data.w2_nodes.each do |w2_node| w2_node.content = nil end + intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) + end + let(:primary_ssn) { intake.primary.ssn } + let(:spouse_ssn) { intake.spouse.ssn } + let!(:primary_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 100) } + let!(:spouse_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: spouse_ssn, taxable_amount: 200) } + + it "calculates the fed income amount for primary and spouse" do + expect(instance.calculate_fed_income(:primary)).to eq(100) + expect(instance.calculate_fed_income(:spouse)).to eq(200) + end + end + + context "primary and spouse have only unemployment income" do + before do + intake.direct_file_data.w2_nodes.each do |w2_node| w2_node.content = nil end + intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) + end + let!(:primary_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 600) } + let!(:spouse_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 400) } it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(:primary)).to eq(0) - expect(instance.calculate_fed_income(:spouse)).to eq(0) + expect(instance.calculate_fed_income(:primary)).to eq(600) + expect(instance.calculate_fed_income(:spouse)).to eq(400) end end end @@ -34,51 +71,80 @@ end describe "#calculate_line_1" do - context "no fed income, no subtractions" do - it "subtracts fed subtractions from fed income" do - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_SPOUSE].value).to eq(0) + before do + instance.calculate + intake.synchronize_df_w2s_to_database + end + + context "primary and spouse have only w2 income" do + let(:intake) { create(:state_file_md_intake, :with_spouse, :df_data_many_w2s) } + it "calculates the fed income amount for primary and spouse" do + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(150_000) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(50_000) end end end describe "#calculate_line_2" do + before do + instance.calculate + end + context "no state additions" do it "calculates the state addition amount for primary and spouse" do - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_SPOUSE].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_A].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_B].value).to eq(0) end end end describe "#calculate_line_3" do + before do + instance.calculate + end + context "no fed income, no fed subtractions, no state additions" do it "adds state additions to current amount" do - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_SPOUSE].value).to eq(0) + # allow_any_instance_of(Efile::Md::TwoIncomeSubtractionWorksheet).to receive(:calculate_line_1).and_return 1 + # allow_any_instance_of(Efile::Md::TwoIncomeSubtractionWorksheet).to receive(:calculate_line_2).and_return 2 + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(9_000) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(0) end end end describe "#calculate_line_4" do + before do + instance.calculate + end + context "no state subtractions" do it "calculates the state subtraction amount for primary and spouse" do - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_SPOUSE].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_A].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_B].value).to eq(0) end end end describe "#calculate_line_5" do + before do + instance.calculate + end + context "no fed income, no fed subtractions, no state additions" do it "subtracts state subtractions from current amount" do - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_PRIMARY].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_SPOUSE].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(9_000) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_B].value).to eq(0) end end end describe "#calculate_line_6" do + before do + instance.calculate + end + context "no agi" do it "returns the lower agi of the two filers" do expect(instance.lines[:MD_TWO_INCOME_WK_LINE_6].value).to eq(0) @@ -87,9 +153,13 @@ end describe "#calculate_line_7" do + before do + instance.calculate + end + context "no agi" do - it "returns the subtraction amount" do - expect(instance.lines[:MD_TWO_INCOME_SUBTRACTION_WK_LINE_6].value).to eq(0) + it "returns the maximum subtraction amount" do + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_7].value).to eq(0) end end end diff --git a/spec/lib/submission_builder/ty2024/states/md/md_return_xml_spec.rb b/spec/lib/submission_builder/ty2024/states/md/md_return_xml_spec.rb index 8a380f431c..195daf18ff 100644 --- a/spec/lib/submission_builder/ty2024/states/md/md_return_xml_spec.rb +++ b/spec/lib/submission_builder/ty2024/states/md/md_return_xml_spec.rb @@ -2,14 +2,13 @@ describe SubmissionBuilder::Ty2024::States::Md::MdReturnXml, required_schema: "md" do describe ".build" do - let(:intake) { create(:state_file_md_intake, filing_status: "single") } + let(:intake) { create(:state_file_md_intake) } let(:submission) { create(:efile_submission, data_source: intake.reload) } let!(:initial_efile_device_info) { create :state_file_efile_device_info, :initial_creation, :filled, intake: intake } let!(:submission_efile_device_info) { create :state_file_efile_device_info, :submission, :filled, intake: intake } - let(:instance) {described_class.new(submission)} + let(:instance) { described_class.new(submission) } let(:build_response) { instance.build } let(:xml) { Nokogiri::XML::Document.parse(build_response.document.to_xml) } - let(:intake) { create(:state_file_md_intake)} it "generates basic components of return" do @@ -64,7 +63,7 @@ end context "502R" do - let(:intake) { create(:state_file_md_intake)} + let(:intake) { create(:state_file_md_intake) } context "when taxable pensions/IRAs/annuities are present" do before do diff --git a/spec/models/state_file_w2_spec.rb b/spec/models/state_file_w2_spec.rb index a36ecc3362..45e31d9506 100644 --- a/spec/models/state_file_w2_spec.rb +++ b/spec/models/state_file_w2_spec.rb @@ -11,6 +11,7 @@ # employee_ssn :string # employer_name :string # employer_state_id_num :string +# federal_wages_amount :decimal(12, 2) # local_income_tax_amount :decimal(12, 2) # local_wages_and_tips_amount :decimal(12, 2) # locality_nm :string From 8cfc8f801188b7a0be49ad14bec7940b0768670b Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Mon, 18 Nov 2024 18:00:19 -0800 Subject: [PATCH 07/30] WIP #calculate_fed_income base case tests passing --- spec/factories/state_file_md_intakes.rb | 1 - .../fed_return_jsons/2023/md/todd_and_spouse_1099_int.json | 2 +- spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb | 5 ++--- spec/models/state_file_w2_spec.rb | 1 - 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb index 298d088190..7b1dcea95d 100644 --- a/spec/factories/state_file_md_intakes.rb +++ b/spec/factories/state_file_md_intakes.rb @@ -187,7 +187,6 @@ spouse_middle_initial { "B" } spouse_last_name { "Lando" } spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 40 } - spouse_ssn { "987654321" } end end end diff --git a/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json b/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json index 71676dbea8..cc6abb49e7 100644 --- a/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json +++ b/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json @@ -15,7 +15,7 @@ "middleInitial": "T", "tin": "987-65-4321", "dateOfBirth": "1980-01-01", - "isPrimaryFiler": true + "isPrimaryFiler": false } ], "interestReports": [ diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index 3eb3770908..98602d0f65 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -11,7 +11,7 @@ let(:instance) { main_calculator.instance_variable_get(:@two_income_subtraction_worksheet) } describe "#calculate_fed_income" do - context "primary and spouse have only w2 income" do + context "primary and spouse have only wage income" do let(:intake) { create(:state_file_md_intake, :df_data_many_w2s) } it "calculates the fed income amount for primary and spouse" do expect(instance.calculate_fed_income(:primary)).to eq(150_000) @@ -21,8 +21,7 @@ context "primary and spouse have only interest income" do before do - intake.direct_file_data.spouse_ssn = "987654321" - intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) + intake.direct_file_data.spouse_ssn = intake.direct_file_json_data.spouse_filer&.tin&.delete("-") end let(:intake) { create(:state_file_md_intake, :df_data_1099_int_with_spouse) } it "calculates the fed income amount for primary and spouse" do diff --git a/spec/models/state_file_w2_spec.rb b/spec/models/state_file_w2_spec.rb index 45e31d9506..a36ecc3362 100644 --- a/spec/models/state_file_w2_spec.rb +++ b/spec/models/state_file_w2_spec.rb @@ -11,7 +11,6 @@ # employee_ssn :string # employer_name :string # employer_state_id_num :string -# federal_wages_amount :decimal(12, 2) # local_income_tax_amount :decimal(12, 2) # local_wages_and_tips_amount :decimal(12, 2) # locality_nm :string From 14c32c8b12884e63d79ad8ae53415af635e9d7e7 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Mon, 18 Nov 2024 21:51:57 -0800 Subject: [PATCH 08/30] WIP test #calculate_fed_subtractions --- .../md/two_income_subtraction_worksheet.rb | 8 +-- app/models/direct_file_json_data.rb | 2 + spec/factories/state_file_md_intakes.rb | 2 + .../2023/md/todd_and_spouse_1099_int.json | 8 ++- .../two_income_subtraction_worksheet_spec.rb | 67 ++++++++++++++++--- 5 files changed, 73 insertions(+), 14 deletions(-) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 24fd4673cb..0fd429cb30 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -55,15 +55,15 @@ def calculate_fed_income(primary_or_spouse) def calculate_fed_subtractions(primary_or_spouse) filer_json = @direct_file_json_data.filers - .select { |df_filer_data| - df_filer_data.tin == @intake.send(primary_or_spouse).ssn + .find { |df_filer_data| + df_filer_data.tin.delete("-") == @intake.send(primary_or_spouse).ssn } student_loan_interest = { primary: @intake.primary_student_loan_interest_ded_amount.round, spouse: @intake.spouse_student_loan_interest_ded_amount.round, }[primary_or_spouse] - educator_expenses = 0 # TODO: filer_json.educatorExpenses - hsa_deduction = 0 # TODO: filer_json.hsaTotalDeductibleAmount + educator_expenses = filer_json.educator_expenses.round + hsa_deduction = filer_json.hsa_total_deductible_amount.round student_loan_interest + educator_expenses + diff --git a/app/models/direct_file_json_data.rb b/app/models/direct_file_json_data.rb index f250576fa9..4a77f2d1a3 100644 --- a/app/models/direct_file_json_data.rb +++ b/app/models/direct_file_json_data.rb @@ -10,6 +10,8 @@ class DfJsonPerson < DfJsonWrapper class DfJsonFiler < DfJsonPerson json_accessor is_primary_filer: { type: :boolean, key: "isPrimaryFiler" } + json_accessor educator_expenses: { type: :money_amount, key: "educatorExpenses" } + json_accessor hsa_total_deductible_amount: { type: :money_amount, key: "hsaTotalDeductibleAmount" } end class DfJsonDependent < DfJsonPerson diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb index 7b1dcea95d..ea3d92198c 100644 --- a/spec/factories/state_file_md_intakes.rb +++ b/spec/factories/state_file_md_intakes.rb @@ -134,6 +134,7 @@ trait :with_spouse do raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml("md_nate_mfj") } + raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_nate_mfj') } filing_status { 'married_filing_jointly' } spouse_first_name { "Marty" } @@ -144,6 +145,7 @@ trait :with_senior_spouse do raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml("md_nate_mfj") } + raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_nate_mfj') } filing_status { 'married_filing_jointly' } spouse_first_name { "Marty" } diff --git a/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json b/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json index cc6abb49e7..ded633451d 100644 --- a/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json +++ b/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json @@ -7,7 +7,9 @@ "middleInitial": "T", "tin": "123-45-6789", "dateOfBirth": "1980-01-01", - "isPrimaryFiler": true + "isPrimaryFiler": true, + "educatorExpenses": "20.00", + "hsaTotalDeductibleAmount": "200.00" }, { "firstName": "Todd", @@ -15,7 +17,9 @@ "middleInitial": "T", "tin": "987-65-4321", "dateOfBirth": "1980-01-01", - "isPrimaryFiler": false + "isPrimaryFiler": false, + "educatorExpenses": "10.00", + "hsaTotalDeductibleAmount": "100.00" } ], "interestReports": [ diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index 98602d0f65..ba66e65f50 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -32,7 +32,9 @@ context "primary and spouse have only retirement income" do before do - intake.direct_file_data.w2_nodes.each do |w2_node| w2_node.content = nil end + intake.direct_file_data.w2_nodes.each do |w2_node| + w2_node.content = nil + end intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) end let(:primary_ssn) { intake.primary.ssn } @@ -48,7 +50,9 @@ context "primary and spouse have only unemployment income" do before do - intake.direct_file_data.w2_nodes.each do |w2_node| w2_node.content = nil end + intake.direct_file_data.w2_nodes.each do |w2_node| + w2_node.content = nil + end intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) end let!(:primary_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 600) } @@ -61,10 +65,58 @@ end describe "#calculate_fed_subtractions" do - context "no fed subtractions" do + let(:intake) { create(:state_file_md_intake, :with_spouse) } + before do + intake.direct_file_data.primary_ssn = intake.direct_file_json_data.primary_filer&.tin&.delete("-") + intake.direct_file_data.spouse_ssn = intake.direct_file_json_data.spouse_filer&.tin&.delete("-") + end + + context "primary and spouse have only student loan interest subtractions" do + it "calculates the fed subtraction amount for primary and spouse" do + intake.update(primary_student_loan_interest_ded_amount: 1.1) + intake.update(spouse_student_loan_interest_ded_amount: 2.2) + expect(instance.calculate_fed_subtractions(:primary)).to eq(1) + expect(instance.calculate_fed_subtractions(:spouse)).to eq(2) + end + end + + context "primary and spouse have only educator expense subtractions" do + before do + intake.direct_file_json_data.primary_filer&.educator_expenses = "10.00" + intake.direct_file_json_data.spouse_filer&.educator_expenses = "20.00" + end + + it "calculates the fed subtraction amount for primary and spouse" do + expect(instance.calculate_fed_subtractions(:primary)).to eq(10) + expect(instance.calculate_fed_subtractions(:spouse)).to eq(20) + end + end + + context "primary and spouse have only health savings account subtractions" do + before do + intake.direct_file_json_data.primary_filer&.hsa_total_deductible_amount = "100.00" + intake.direct_file_json_data.spouse_filer&.hsa_total_deductible_amount = "200.00" + end + + it "calculates the fed subtraction amount for primary and spouse" do + expect(instance.calculate_fed_subtractions(:primary)).to eq(100) + expect(instance.calculate_fed_subtractions(:spouse)).to eq(200) + end + end + + context "primary and spouse have all three kinds of subtractions" do + before do + intake.direct_file_json_data.primary_filer&.educator_expenses = "10.00" + intake.direct_file_json_data.spouse_filer&.educator_expenses = "20.00" + intake.direct_file_json_data.primary_filer&.hsa_total_deductible_amount = "100.00" + intake.direct_file_json_data.spouse_filer&.hsa_total_deductible_amount = "200.00" + end + it "calculates the fed subtraction amount for primary and spouse" do - expect(instance.calculate_fed_subtractions(:primary)).to eq(0) - expect(instance.calculate_fed_subtractions(:spouse)).to eq(0) + intake.update(primary_student_loan_interest_ded_amount: 1) + intake.update(spouse_student_loan_interest_ded_amount: 2) + expect(instance.calculate_fed_subtractions(:primary)).to eq(111) + expect(instance.calculate_fed_subtractions(:spouse)).to eq(222) end end end @@ -76,10 +128,9 @@ end context "primary and spouse have only w2 income" do - let(:intake) { create(:state_file_md_intake, :with_spouse, :df_data_many_w2s) } it "calculates the fed income amount for primary and spouse" do - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(150_000) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(50_000) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(9_000) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(0) end end end From 7299cf1b73292ed0c0d631e81575beff23ccaab5 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Mon, 18 Nov 2024 23:21:24 -0800 Subject: [PATCH 09/30] WIP test #calculate_line_2 --- spec/factories/state_file1099_rs.rb | 8 ++++---- spec/factories/state_file_w2s.rb | 1 + .../md/two_income_subtraction_worksheet_spec.rb | 17 +++++++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/spec/factories/state_file1099_rs.rb b/spec/factories/state_file1099_rs.rb index 63881ceec1..81fa0a6a3b 100644 --- a/spec/factories/state_file1099_rs.rb +++ b/spec/factories/state_file1099_rs.rb @@ -46,10 +46,10 @@ payer_address_line1 { "123 Sesame ST" } payer_address_line2 { "Apt 202" } payer_city_name { "Long Island" } - payer_zip { "12345"} - payer_identification_number { "22345"} - recipient_ssn { "123456789"} - recipient_name { "Dorothy Jane Red"} + payer_zip { "12345" } + payer_identification_number { "22345" } + recipient_ssn { "123456789" } + recipient_name { "Dorothy Jane Red" } gross_distribution_amount { 100.25 } taxable_amount { 50.5 } taxable_amount_not_determined { true } diff --git a/spec/factories/state_file_w2s.rb b/spec/factories/state_file_w2s.rb index e92c74d450..6f6b95983f 100644 --- a/spec/factories/state_file_w2s.rb +++ b/spec/factories/state_file_w2s.rb @@ -30,6 +30,7 @@ factory :state_file_w2 do w2_index { 0 } employee_name { "Jajko" } + employee_ssn { "123456789" } employer_name { "Biszkoptowy Enterprises" } employer_state_id_num { "12345" } state_wages_amount { 1000 } diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index ba66e65f50..33db059771 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -136,16 +136,25 @@ end describe "#calculate_line_2" do - before do - instance.calculate - end - context "no state additions" do it "calculates the state addition amount for primary and spouse" do + instance.calculate expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_A].value).to eq(0) expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_B].value).to eq(0) end end + + context "primary and spouse have STPICKUP" do + let!(:primary_ssn) { intake.primary.ssn } + let!(:spouse_ssn) { intake.spouse.ssn } + let!(:primary_state_file_w2) { create(:state_file_w2, state_file_intake: intake, employee_ssn: primary_ssn, box14_stpickup: 100.0) } + let!(:spouse_state_file_w2) { create(:state_file_w2, state_file_intake: intake, employee_ssn: spouse_ssn, box14_stpickup: 200.0) } + it "calculates the state addition amount for primary and spouse" do + instance.calculate + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_A].value).to eq(100) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_B].value).to eq(200) + end + end end describe "#calculate_line_3" do From 187af362da62a478cf5c8d6b05f93da8f2692265 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 13:36:46 -0800 Subject: [PATCH 10/30] WIP test #calculate_line_4 --- .../md/two_income_subtraction_worksheet.rb | 6 +++--- .../md/two_income_subtraction_worksheet_spec.rb | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 0fd429cb30..0ba90bfc86 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -95,9 +95,9 @@ def calculate_line_3(primary_or_spouse) def calculate_line_4(primary_or_spouse) cdc_expenses = @direct_file_data.total_qualifying_dependent_care_expenses / 2 - # NOTE: This data relies on 1099R followup questions, which have been deprioritized - pension_exclusion = 0 # TODO: MD pension exclusion - military_retirement_exclusion = 0 # TODO: MD military retirement exclusion + # NOTE: Stub alert - this data relies on 1099R followup questions, which have been deprioritized + pension_exclusion = 0 + military_retirement_exclusion = 0 cdc_expenses + pension_exclusion + diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index 33db059771..a8e7f4a5ee 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -174,16 +174,25 @@ end describe "#calculate_line_4" do - before do - instance.calculate - end - context "no state subtractions" do it "calculates the state subtraction amount for primary and spouse" do + instance.calculate expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_A].value).to eq(0) expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_B].value).to eq(0) end end + + context "return has qualifying dependent care expenses subtraction" do + before do + intake.direct_file_data.total_qualifying_dependent_care_expenses = 200 + end + + it "calculates the state subtraction amount for primary and spouse" do + instance.calculate + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_A].value).to eq(100) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_4_B].value).to eq(100) + end + end end describe "#calculate_line_5" do From e355e921420c8f59f592a8b988703f545375d8e6 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 13:47:09 -0800 Subject: [PATCH 11/30] WIP test #calculate_line_2 --- app/lib/efile/md/two_income_subtraction_worksheet.rb | 2 +- spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 0ba90bfc86..f865952be5 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -79,7 +79,7 @@ def calculate_line_1(primary_or_spouse) def calculate_line_2(primary_or_spouse) @intake.state_file_w2s .select { |w2| w2.employee_ssn == @intake.send(primary_or_spouse).ssn } - .sum { |w2| w2.box14_stpickup || 0 } + .sum { |w2| w2.box14_stpickup.round || 0 } end def calculate_line_3(primary_or_spouse) diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index a8e7f4a5ee..edd6dcc575 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -147,8 +147,8 @@ context "primary and spouse have STPICKUP" do let!(:primary_ssn) { intake.primary.ssn } let!(:spouse_ssn) { intake.spouse.ssn } - let!(:primary_state_file_w2) { create(:state_file_w2, state_file_intake: intake, employee_ssn: primary_ssn, box14_stpickup: 100.0) } - let!(:spouse_state_file_w2) { create(:state_file_w2, state_file_intake: intake, employee_ssn: spouse_ssn, box14_stpickup: 200.0) } + let!(:primary_state_file_w2) { create(:state_file_w2, state_file_intake: intake, employee_ssn: primary_ssn, box14_stpickup: 100.1) } + let!(:spouse_state_file_w2) { create(:state_file_w2, state_file_intake: intake, employee_ssn: spouse_ssn, box14_stpickup: 199.9) } it "calculates the state addition amount for primary and spouse" do instance.calculate expect(instance.lines[:MD_TWO_INCOME_WK_LINE_2_A].value).to eq(100) From b4809e1169b769b12d2f82e66d8085e7c60adaf9 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 18:30:10 -0800 Subject: [PATCH 12/30] WIP test math calculations --- .../md/two_income_subtraction_worksheet.rb | 6 +- spec/factories/state_file_md_intakes.rb | 18 +- .../2023/md/minimal_with_spouse.json | 21 ++ .../2023/md/minimal_with_spouse.xml | 88 ++++++ .../two_income_subtraction_worksheet_spec.rb | 299 +++++++++++++++--- 5 files changed, 382 insertions(+), 50 deletions(-) create mode 100644 spec/fixtures/state_file/fed_return_jsons/2023/md/minimal_with_spouse.json create mode 100644 spec/fixtures/state_file/fed_return_xmls/2023/md/minimal_with_spouse.xml diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index f865952be5..d6dad6a296 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -41,11 +41,11 @@ def calculate_fed_income(primary_or_spouse) } retirement_income = @intake.state_file1099_rs .select { |form1099r| form1099r.recipient_ssn == filer.ssn } - .sum(&:taxable_amount) + .sum { |form1099r| form1099r.taxable_amount.round } # TODO: check in about getting this from DF JSON instead unemployment_income = @intake.state_file1099_gs .select { |form1099g| form1099g.recipient.to_sym == primary_or_spouse } - .sum(&:unemployment_compensation_amount) + .sum { |form1099g| form1099g.unemployment_compensation_amount.round } wage_income + interest_income + @@ -121,7 +121,7 @@ def calculate_line_6 end def calculate_line_7 - [@lines[:MD_TWO_INCOME_WK_LINE_6].value, 1_200].min + @lines[:MD_TWO_INCOME_WK_LINE_6].value.clamp(0, 1_200) end end end diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb index ea3d92198c..a7bd9034bb 100644 --- a/spec/factories/state_file_md_intakes.rb +++ b/spec/factories/state_file_md_intakes.rb @@ -133,8 +133,8 @@ end trait :with_spouse do - raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml("md_nate_mfj") } - raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_nate_mfj') } + raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml("md_minimal_with_spouse") } + raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_minimal_with_spouse') } filing_status { 'married_filing_jointly' } spouse_first_name { "Marty" } @@ -144,8 +144,8 @@ end trait :with_senior_spouse do - raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml("md_nate_mfj") } - raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_nate_mfj') } + raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml("md_minimal_with_spouse") } + raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_minimal_with_spouse') } filing_status { 'married_filing_jointly' } spouse_first_name { "Marty" } @@ -190,5 +190,15 @@ spouse_last_name { "Lando" } spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 40 } end + + trait :with_w2s_removed do + after :create do |intake| + intake.direct_file_data.w2_nodes.each do |w2_node| + w2_node.content = nil + end + intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) + intake.synchronize_df_w2s_to_database + end + end end end diff --git a/spec/fixtures/state_file/fed_return_jsons/2023/md/minimal_with_spouse.json b/spec/fixtures/state_file/fed_return_jsons/2023/md/minimal_with_spouse.json new file mode 100644 index 0000000000..7d16ad3dd1 --- /dev/null +++ b/spec/fixtures/state_file/fed_return_jsons/2023/md/minimal_with_spouse.json @@ -0,0 +1,21 @@ +{ + "familyAndHousehold": [], + "filers": [ + { + "firstName": "Beaches", + "middleInitial": "T", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": true, + "tin": "123-45-6789" + }, + { + "firstName": "Pebble", + "middleInitial": "Y", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": false, + "tin": "987-65-4321" + } + ] +} diff --git a/spec/fixtures/state_file/fed_return_xmls/2023/md/minimal_with_spouse.xml b/spec/fixtures/state_file/fed_return_xmls/2023/md/minimal_with_spouse.xml new file mode 100644 index 0000000000..a2a631bf91 --- /dev/null +++ b/spec/fixtures/state_file/fed_return_xmls/2023/md/minimal_with_spouse.xml @@ -0,0 +1,88 @@ + + + + 2023 + 2023-01-01 + 2023-12-31 + 2022.2.100 + 1040 + + 123456789 + 987654321 + BEACHES & PEBBLES<YARN MAT + YARN + YARN + + 15 Cool St + Apt 12B + Monkton + MD + 21111 + + 5551234567 + + + + beaches@bigtoddsyarnmats.com + + + + + + 2 + Pebbles Yarn Mat + false + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + false + mat + towel + NO FINANCIAL PRODUCT + + + \ No newline at end of file diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index edd6dcc575..c09437b58c 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -31,12 +31,7 @@ end context "primary and spouse have only retirement income" do - before do - intake.direct_file_data.w2_nodes.each do |w2_node| - w2_node.content = nil - end - intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) - end + let(:intake) { create(:state_file_md_intake, :with_spouse, :with_w2s_removed) } let(:primary_ssn) { intake.primary.ssn } let(:spouse_ssn) { intake.spouse.ssn } let!(:primary_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 100) } @@ -49,12 +44,7 @@ end context "primary and spouse have only unemployment income" do - before do - intake.direct_file_data.w2_nodes.each do |w2_node| - w2_node.content = nil - end - intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) - end + let(:intake) { create(:state_file_md_intake, :with_spouse, :with_w2s_removed) } let!(:primary_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 600) } let!(:spouse_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 400) } it "calculates the fed income amount for primary and spouse" do @@ -122,14 +112,73 @@ end describe "#calculate_line_1" do - before do - instance.calculate - intake.synchronize_df_w2s_to_database - end + context "calculating federal agi" do + it "calculates a positive fed agi for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_fed_income) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_fed_subtractions) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 10 + when :spouse + 20 + end + end + instance.calculate - context "primary and spouse have only w2 income" do - it "calculates the fed income amount for primary and spouse" do - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(9_000) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(90) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(180) + end + + it "calculates a negative fed agi for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_fed_income) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_fed_subtractions) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 110 + when :spouse + 220 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(-10) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(-20) + end + + it "calculates a 0 fed agi for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_fed_income) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_fed_subtractions) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(0) expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(0) end end @@ -158,16 +207,73 @@ end describe "#calculate_line_3" do - before do - instance.calculate - end + context "calculating federal agi plus state additions" do + it "calculates a positive amount for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_line_1) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_line_2) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 10 + when :spouse + 20 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(110) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(220) + end - context "no fed income, no fed subtractions, no state additions" do - it "adds state additions to current amount" do - # allow_any_instance_of(Efile::Md::TwoIncomeSubtractionWorksheet).to receive(:calculate_line_1).and_return 1 - # allow_any_instance_of(Efile::Md::TwoIncomeSubtractionWorksheet).to receive(:calculate_line_2).and_return 2 + it "calculates a negative amount for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_line_1) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + -100 + when :spouse + -200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_line_2) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 10 + when :spouse + 20 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(-90) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(-180) + end - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(9_000) + it "calculates a 0 for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_line_1) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + -100 + when :spouse + -200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_line_2) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(0) expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(0) end end @@ -196,37 +302,144 @@ end describe "#calculate_line_5" do - before do - instance.calculate - end + context "calculating federal agi plus state additions, minus state subtractions" do + it "calculates a positive amount for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_line_3) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_line_4) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 10 + when :spouse + 20 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(90) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_B].value).to eq(180) + end - context "no fed income, no fed subtractions, no state additions" do - it "subtracts state subtractions from current amount" do - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(9_000) + it "calculates a negative amount for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_line_3) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_line_4) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 110 + when :spouse + 220 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(-10) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_B].value).to eq(-20) + end + + it "calculates a 0 for primary and spouse" do + allow_any_instance_of(described_class).to receive(:calculate_line_3) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + allow_any_instance_of(described_class).to receive(:calculate_line_4) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 100 + when :spouse + 200 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(0) expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_B].value).to eq(0) end end end describe "#calculate_line_6" do - before do - instance.calculate - end + context "returning the lower income" do + it "returns an income greater than 1_200" do + allow_any_instance_of(described_class).to receive(:calculate_line_5) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 1_201 + when :spouse + 1_202 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_6].value).to eq(1_201) + end + + it "returns an income between 1200 and 0" do + allow_any_instance_of(described_class).to receive(:calculate_line_5) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 1_201 + when :spouse + 1_000 + end + end + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_6].value).to eq(1000) + end + + it "returns 0 if the lower income is below 0" do + allow_any_instance_of(described_class).to receive(:calculate_line_5) do |_, primary_or_spouse| + case primary_or_spouse + when :primary + 1_201 + when :spouse + -1 + end + end + instance.calculate - context "no agi" do - it "returns the lower agi of the two filers" do expect(instance.lines[:MD_TWO_INCOME_WK_LINE_6].value).to eq(0) end end end describe "#calculate_line_7" do - before do - instance.calculate - end + context "returning the final subtraction amount" do + it "returns the lower income amount when line 6 is within the limit" do + allow_any_instance_of(described_class).to receive(:calculate_line_6).and_return(1_000) + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_7].value).to eq(1_000) + end + + it "returns the maximum subtraction amount when line 6 is greater than the limit" do + allow_any_instance_of(described_class).to receive(:calculate_line_6).and_return(1_201) + instance.calculate + + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_7].value).to eq(1_200) + end + + it "returns the minimum subtraction amount when line 6 is less than the limit" do + allow_any_instance_of(described_class).to receive(:calculate_line_6).and_return(-1) + instance.calculate - context "no agi" do - it "returns the maximum subtraction amount" do expect(instance.lines[:MD_TWO_INCOME_WK_LINE_7].value).to eq(0) end end From aee0d999e5e0e9b949286041b6dd65a482974d02 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 20:19:25 -0800 Subject: [PATCH 13/30] WIP handle nil and non-MFJ --- app/lib/efile/md/md502_calculator.rb | 12 ++++++------ app/lib/efile/md/two_income_subtraction_worksheet.rb | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/lib/efile/md/md502_calculator.rb b/app/lib/efile/md/md502_calculator.rb index db2e64da1b..b6738ea79c 100644 --- a/app/lib/efile/md/md502_calculator.rb +++ b/app/lib/efile/md/md502_calculator.rb @@ -54,14 +54,14 @@ def calculate set_line(:MD502_LINE_6, :calculate_line_6) set_line(:MD502_LINE_7, :calculate_line_7) - # MD502SU Subtractions - @md502_su.calculate - set_line(:MD502_LINE_13, :calculate_line_13) - @two_income_subtraction_worksheet.calculate - set_line(:MD502_LINE_14, :calculate_line_14) - # Subtractions set_line(:MD502_LINE_10A, :calculate_line_10a) # STUBBED: PLEASE REPLACE, don't forget line_data.yml + @md502_su.calculate + set_line(:MD502_LINE_13, :calculate_line_13) + if filing_status_mfj? + @two_income_subtraction_worksheet.calculate + set_line(:MD502_LINE_14, :calculate_line_14) + end # lines 15 and 16 depend on lines 8-14 set_line(:MD502_LINE_15, :calculate_line_15) set_line(:MD502_LINE_16, :calculate_line_16) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index d6dad6a296..0449195ff5 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -59,11 +59,11 @@ def calculate_fed_subtractions(primary_or_spouse) df_filer_data.tin.delete("-") == @intake.send(primary_or_spouse).ssn } student_loan_interest = { - primary: @intake.primary_student_loan_interest_ded_amount.round, - spouse: @intake.spouse_student_loan_interest_ded_amount.round, + primary: @intake.primary_student_loan_interest_ded_amount&.round, + spouse: @intake.spouse_student_loan_interest_ded_amount&.round, }[primary_or_spouse] - educator_expenses = filer_json.educator_expenses.round - hsa_deduction = filer_json.hsa_total_deductible_amount.round + educator_expenses = filer_json.educator_expenses&.round + hsa_deduction = filer_json.hsa_total_deductible_amount&.round student_loan_interest + educator_expenses + @@ -79,7 +79,7 @@ def calculate_line_1(primary_or_spouse) def calculate_line_2(primary_or_spouse) @intake.state_file_w2s .select { |w2| w2.employee_ssn == @intake.send(primary_or_spouse).ssn } - .sum { |w2| w2.box14_stpickup.round || 0 } + .sum { |w2| w2.box14_stpickup&.round || 0 } end def calculate_line_3(primary_or_spouse) From 4e85dfc55b9e6ca2b10017eb55334b233ecbb833 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 20:53:28 -0800 Subject: [PATCH 14/30] WIP add some missing federal info editor fields --- app/views/state_file/questions/federal_info/_df_w2.html.erb | 1 + app/views/state_file/questions/federal_info/edit.html.erb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/state_file/questions/federal_info/_df_w2.html.erb b/app/views/state_file/questions/federal_info/_df_w2.html.erb index 9dd2abd908..19e420206c 100644 --- a/app/views/state_file/questions/federal_info/_df_w2.html.erb +++ b/app/views/state_file/questions/federal_info/_df_w2.html.erb @@ -4,6 +4,7 @@ <%= render 'node_xml_reveal', xml: f.object.to_pretty_s %> + <%= f.state_file_nested_xml_field :EmployeeSSN %> <%= f.state_file_nested_xml_field :WagesAmt %> <%= f.state_file_nested_xml_field :WithholdingAmt %> <%= f.state_file_nested_xml_field :StateWagesAmt %> diff --git a/app/views/state_file/questions/federal_info/edit.html.erb b/app/views/state_file/questions/federal_info/edit.html.erb index ff3fb14cb2..c7b3d5755e 100644 --- a/app/views/state_file/questions/federal_info/edit.html.erb +++ b/app/views/state_file/questions/federal_info/edit.html.erb @@ -39,6 +39,7 @@ <%= f.state_file_qa_input_field :fed_agi, "Adjusted Gross Income" %> <%= f.state_file_qa_input_field :fed_wages, "Wages, salaries, tips" %> <%= f.state_file_qa_input_field :fed_taxable_income, "Taxable interest" %> + <%= f.state_file_qa_input_field :fed_student_loan_interest, "Subtractable student loan interest" %> <%= f.state_file_qa_input_field :fed_unemployment, "Unemployment compensation" %> <%= f.state_file_qa_input_field :fed_taxable_ssb, "Taxable SS Income" %> <%= f.state_file_qa_input_field :total_exempt_primary_spouse, "Total exempt primary and spouse count" %> From ecef3276eff8b0d78c1aae7ee7d16daae5af295c Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 20:58:56 -0800 Subject: [PATCH 15/30] WIP fix tests --- app/lib/efile/md/md502_calculator.rb | 2 +- app/lib/efile/md/two_income_subtraction_worksheet.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/lib/efile/md/md502_calculator.rb b/app/lib/efile/md/md502_calculator.rb index b6738ea79c..f544610a3f 100644 --- a/app/lib/efile/md/md502_calculator.rb +++ b/app/lib/efile/md/md502_calculator.rb @@ -60,8 +60,8 @@ def calculate set_line(:MD502_LINE_13, :calculate_line_13) if filing_status_mfj? @two_income_subtraction_worksheet.calculate - set_line(:MD502_LINE_14, :calculate_line_14) end + set_line(:MD502_LINE_14, :calculate_line_14) # lines 15 and 16 depend on lines 8-14 set_line(:MD502_LINE_15, :calculate_line_15) set_line(:MD502_LINE_16, :calculate_line_16) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 0449195ff5..a630cb47a3 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -58,6 +58,8 @@ def calculate_fed_subtractions(primary_or_spouse) .find { |df_filer_data| df_filer_data.tin.delete("-") == @intake.send(primary_or_spouse).ssn } + return 0 unless filer_json # TODO: Some MFJ tests are missing spouse JSON - should not happen in prod + student_loan_interest = { primary: @intake.primary_student_loan_interest_ded_amount&.round, spouse: @intake.spouse_student_loan_interest_ded_amount&.round, From b3b57684030c6198158e5095e3f414b79dab8c4d Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 21:32:59 -0800 Subject: [PATCH 16/30] WIP update MFJ/MFS ssns to match new trait --- spec/lib/pdf_filler/md502_pdf_spec.rb | 10 +++++----- .../ty2024/states/md/documents/md502_spec.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/lib/pdf_filler/md502_pdf_spec.rb b/spec/lib/pdf_filler/md502_pdf_spec.rb index dc10ec10f4..6241c1c815 100644 --- a/spec/lib/pdf_filler/md502_pdf_spec.rb +++ b/spec/lib/pdf_filler/md502_pdf_spec.rb @@ -152,8 +152,8 @@ let(:intake) { create(:state_file_md_intake, :with_spouse) } it "sets correct values for mfj filers" do - expect(pdf_fields['Enter social security number']).to eq("400000030") - expect(pdf_fields["Enter spouse's social security number"]).to eq("600000030") + expect(pdf_fields['Enter social security number']).to eq("123456789") + expect(pdf_fields["Enter spouse's social security number"]).to eq("987654321") expect(pdf_fields["Enter your first name"]).to eq("Mary") expect(pdf_fields["Enter your middle initial"]).to eq("A") expect(pdf_fields["Enter your last name"]).to eq("Lando") @@ -174,8 +174,8 @@ let(:intake) { create(:state_file_md_intake, :with_spouse, filing_status: "married_filing_separately") } it "sets correct values for filer and fills in mfs spouse ssn" do - expect(pdf_fields["Enter social security number"]).to eq("400000030") - expect(pdf_fields["Enter spouse's social security number"]).to eq("600000030") + expect(pdf_fields["Enter social security number"]).to eq("123456789") + expect(pdf_fields["Enter spouse's social security number"]).to eq("987654321") expect(pdf_fields["Enter your first name"]).to eq("Mary") expect(pdf_fields["Enter your middle initial"]).to eq("A") expect(pdf_fields["Enter your last name"]).to eq("Lando") @@ -185,7 +185,7 @@ expect(pdf_fields["Check Box - 1"]).to eq "Off" expect(pdf_fields["Check Box - 2"]).to eq "Off" expect(pdf_fields["Check Box - 3"]).to eq "No" - expect(pdf_fields["MARRIED FILING Enter spouse's social security number"]).to eq("600000030") + expect(pdf_fields["MARRIED FILING Enter spouse's social security number"]).to eq("987654321") expect(pdf_fields["Check Box - 4"]).to eq "Off" expect(pdf_fields["Check Box - 5"]).to eq "Off" expect(pdf_fields["6. Check here"]).to eq "Off" diff --git a/spec/lib/submission_builder/ty2024/states/md/documents/md502_spec.rb b/spec/lib/submission_builder/ty2024/states/md/documents/md502_spec.rb index 89d04d3040..7a88d6d097 100644 --- a/spec/lib/submission_builder/ty2024/states/md/documents/md502_spec.rb +++ b/spec/lib/submission_builder/ty2024/states/md/documents/md502_spec.rb @@ -171,7 +171,7 @@ it "correctly fills answers" do expect(xml.document.at('FilingStatus MarriedFilingSeparately').text).to eq "X" - expect(xml.document.at('FilingStatus MarriedFilingSeparately')['spouseSSN']).to eq "600000030" + expect(xml.document.at('FilingStatus MarriedFilingSeparately')['spouseSSN']).to eq "987654321" end end From 18d1df9d1a424d4de9b489cbfbff12015ff5a711 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 22:02:54 -0800 Subject: [PATCH 17/30] WIP nil safety and cosmetics --- .../md/two_income_subtraction_worksheet.rb | 41 ++++++++++--------- spec/factories/state_file_md_intakes.rb | 20 --------- .../two_income_subtraction_worksheet_spec.rb | 7 ++-- 3 files changed, 26 insertions(+), 42 deletions(-) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index a630cb47a3..613761f638 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -32,20 +32,23 @@ def calculate_fed_income(primary_or_spouse) filer = @intake.send(primary_or_spouse) wage_income = @direct_file_data.w2s - .select { |w2| w2.EmployeeSSN == filer.ssn } - .sum(&:WagesAmt) + .select { |w2| w2.EmployeeSSN == filer.ssn } + .sum { |w2| w2.WagesAmt&.round } + interest_income = @direct_file_json_data.interest_reports - .select { |interest_report| interest_report.recipient_tin.delete("-") == filer.ssn } - .sum { |interest_report| - interest_report.amount_1099.round + interest_report.amount_no_1099.round - } + .select { |interest_report| interest_report.recipient_tin.delete("-") == filer.ssn } + .sum { |interest_report| + (interest_report.amount_1099&.round || 0) + (interest_report.amount_no_1099&.round || 0) + } + retirement_income = @intake.state_file1099_rs - .select { |form1099r| form1099r.recipient_ssn == filer.ssn } - .sum { |form1099r| form1099r.taxable_amount.round } + .select { |form1099r| form1099r.recipient_ssn == filer.ssn } + .sum { |form1099r| form1099r.taxable_amount&.round } + # TODO: check in about getting this from DF JSON instead unemployment_income = @intake.state_file1099_gs - .select { |form1099g| form1099g.recipient.to_sym == primary_or_spouse } - .sum { |form1099g| form1099g.unemployment_compensation_amount.round } + .select { |form1099g| form1099g.recipient.to_sym == primary_or_spouse } + .sum { |form1099g| form1099g.unemployment_compensation_amount&.round } wage_income + interest_income + @@ -55,21 +58,21 @@ def calculate_fed_income(primary_or_spouse) def calculate_fed_subtractions(primary_or_spouse) filer_json = @direct_file_json_data.filers - .find { |df_filer_data| - df_filer_data.tin.delete("-") == @intake.send(primary_or_spouse).ssn - } - return 0 unless filer_json # TODO: Some MFJ tests are missing spouse JSON - should not happen in prod + .find { |df_filer_data| + df_filer_data.tin.delete("-") == @intake.send(primary_or_spouse).ssn + } + + # TODO: Some MFJ tests are missing spouse JSON - should not happen in prod + return 0 unless filer_json student_loan_interest = { primary: @intake.primary_student_loan_interest_ded_amount&.round, spouse: @intake.spouse_student_loan_interest_ded_amount&.round, }[primary_or_spouse] - educator_expenses = filer_json.educator_expenses&.round - hsa_deduction = filer_json.hsa_total_deductible_amount&.round student_loan_interest + - educator_expenses + - hsa_deduction + filer_json.educator_expenses&.round + + filer_json.hsa_total_deductible_amount&.round end private @@ -95,7 +98,7 @@ def calculate_line_3(primary_or_spouse) end def calculate_line_4(primary_or_spouse) - cdc_expenses = @direct_file_data.total_qualifying_dependent_care_expenses / 2 + cdc_expenses = (@direct_file_data.total_qualifying_dependent_care_expenses || 0) / 2 # NOTE: Stub alert - this data relies on 1099R followup questions, which have been deprioritized pension_exclusion = 0 diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb index a7bd9034bb..87f74c7d4b 100644 --- a/spec/factories/state_file_md_intakes.rb +++ b/spec/factories/state_file_md_intakes.rb @@ -180,25 +180,5 @@ raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('md_todd_1099_int') } raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_todd_1099_int') } end - - trait :df_data_1099_int_with_spouse do - raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('md_todd_1099_int') } - raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_todd_and_spouse_1099_int') } - filing_status { 'married_filing_jointly' } - spouse_first_name { "Marty" } - spouse_middle_initial { "B" } - spouse_last_name { "Lando" } - spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 40 } - end - - trait :with_w2s_removed do - after :create do |intake| - intake.direct_file_data.w2_nodes.each do |w2_node| - w2_node.content = nil - end - intake.update!(raw_direct_file_data: intake.direct_file_data.to_s) - intake.synchronize_df_w2s_to_database - end - end end end diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index c09437b58c..7b998ccbd3 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -21,9 +21,10 @@ context "primary and spouse have only interest income" do before do + intake.raw_direct_file_data = StateFile::DirectFileApiResponseSampleService.new.read_xml('md_todd_1099_int') + intake.raw_direct_file_intake_data = StateFile::DirectFileApiResponseSampleService.new.read_json('md_todd_and_spouse_1099_int') intake.direct_file_data.spouse_ssn = intake.direct_file_json_data.spouse_filer&.tin&.delete("-") end - let(:intake) { create(:state_file_md_intake, :df_data_1099_int_with_spouse) } it "calculates the fed income amount for primary and spouse" do expect(instance.calculate_fed_income(:primary)).to eq(4) expect(instance.calculate_fed_income(:spouse)).to eq(140) @@ -31,7 +32,7 @@ end context "primary and spouse have only retirement income" do - let(:intake) { create(:state_file_md_intake, :with_spouse, :with_w2s_removed) } + let(:intake) { create(:state_file_md_intake, :with_spouse) } let(:primary_ssn) { intake.primary.ssn } let(:spouse_ssn) { intake.spouse.ssn } let!(:primary_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 100) } @@ -44,7 +45,7 @@ end context "primary and spouse have only unemployment income" do - let(:intake) { create(:state_file_md_intake, :with_spouse, :with_w2s_removed) } + let(:intake) { create(:state_file_md_intake, :with_spouse) } let!(:primary_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 600) } let!(:spouse_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 400) } it "calculates the fed income amount for primary and spouse" do From f182b0e8c65efe09deca4222c9f8659d98e6cfce Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 19 Nov 2024 23:40:00 -0800 Subject: [PATCH 18/30] more tests --- app/models/direct_file_json_data.rb | 6 + .../two_income_subtraction_worksheet_spec.rb | 114 ++++++++++++------ 2 files changed, 83 insertions(+), 37 deletions(-) diff --git a/app/models/direct_file_json_data.rb b/app/models/direct_file_json_data.rb index 4a77f2d1a3..ad1daa6c97 100644 --- a/app/models/direct_file_json_data.rb +++ b/app/models/direct_file_json_data.rb @@ -65,10 +65,16 @@ def interest_reports data["interestReports"]&.map { |interest_report| DfJsonInterestReport.new(interest_report) } || [] end + def interest_reports=(value) + data["interestReports"] = value + end + def filers data["filers"]&.map { |filer| DfJsonFiler.new(filer) } || [] end + private + def dependents data["familyAndHousehold"]&.map { |dependent| DfJsonDependent.new(dependent) } || [] end diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index 7b998ccbd3..bd27b4d9ff 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -11,6 +11,13 @@ let(:instance) { main_calculator.instance_variable_get(:@two_income_subtraction_worksheet) } describe "#calculate_fed_income" do + context "primary and spouse have no income" do + it "calculates the fed income amount for primary and spouse" do + expect(instance.calculate_fed_income(:primary)).to eq(0) + expect(instance.calculate_fed_income(:spouse)).to eq(0) + end + end + context "primary and spouse have only wage income" do let(:intake) { create(:state_file_md_intake, :df_data_many_w2s) } it "calculates the fed income amount for primary and spouse" do @@ -21,13 +28,32 @@ context "primary and spouse have only interest income" do before do - intake.raw_direct_file_data = StateFile::DirectFileApiResponseSampleService.new.read_xml('md_todd_1099_int') - intake.raw_direct_file_intake_data = StateFile::DirectFileApiResponseSampleService.new.read_json('md_todd_and_spouse_1099_int') - intake.direct_file_data.spouse_ssn = intake.direct_file_json_data.spouse_filer&.tin&.delete("-") - end - it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(:primary)).to eq(4) - expect(instance.calculate_fed_income(:spouse)).to eq(140) + primary_ssn = intake.primary.ssn + spouse_ssn = intake.spouse.ssn + # only populating minimum data required for this test + intake.direct_file_json_data.interest_reports = [{}, {}, {}, {}] + intake.direct_file_json_data.interest_reports[0].recipient_tin = primary_ssn + intake.direct_file_json_data.interest_reports[1].recipient_tin = primary_ssn + intake.direct_file_json_data.interest_reports[2].recipient_tin = spouse_ssn + intake.direct_file_json_data.interest_reports[3].recipient_tin = spouse_ssn + end + + it "calculates the fed income amount for primary and spouse from multiple interest reports" do + intake.direct_file_json_data.interest_reports[0].amount_1099 = "10.00" + intake.direct_file_json_data.interest_reports[1].amount_1099 = "20.00" + intake.direct_file_json_data.interest_reports[2].amount_no_1099 = "30.00" + intake.direct_file_json_data.interest_reports[3].amount_no_1099 = "40.00" + expect(instance.calculate_fed_income(:primary)).to eq(30) + expect(instance.calculate_fed_income(:spouse)).to eq(70) + end + + it "handles nil values for interest income" do + intake.direct_file_json_data.interest_reports[0].amount_1099 = nil + intake.direct_file_json_data.interest_reports[1].amount_no_1099 = nil + intake.direct_file_json_data.interest_reports[2].amount_1099 = nil + intake.direct_file_json_data.interest_reports[3].amount_no_1099 = nil + expect(instance.calculate_fed_income(:primary)).to eq(0) + expect(instance.calculate_fed_income(:spouse)).to eq(0) end end @@ -35,33 +61,56 @@ let(:intake) { create(:state_file_md_intake, :with_spouse) } let(:primary_ssn) { intake.primary.ssn } let(:spouse_ssn) { intake.spouse.ssn } - let!(:primary_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 100) } - let!(:spouse_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: spouse_ssn, taxable_amount: 200) } + let!(:primary_state_file1099_r_1) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 10) } + let!(:primary_state_file1099_r_2) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 20) } + let!(:spouse_state_file1099_r_1) { create(:state_file1099_r, intake: intake, recipient_ssn: spouse_ssn, taxable_amount: 30) } + let!(:spouse_state_file1099_r_2) { create(:state_file1099_r, intake: intake, recipient_ssn: spouse_ssn, taxable_amount: 40) } - it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(:primary)).to eq(100) - expect(instance.calculate_fed_income(:spouse)).to eq(200) + it "calculates the fed income amount for primary and spouse from multiple 1099Rs" do + expect(instance.calculate_fed_income(:primary)).to eq(30) + expect(instance.calculate_fed_income(:spouse)).to eq(70) end end context "primary and spouse have only unemployment income" do let(:intake) { create(:state_file_md_intake, :with_spouse) } - let!(:primary_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 600) } - let!(:spouse_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 400) } + let!(:primary_state_file1099_g_1) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 10) } + let!(:primary_state_file1099_g_2) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 20) } + let!(:spouse_state_file1099_g_1) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 30) } + let!(:spouse_state_file1099_g_2) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 40) } + it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(:primary)).to eq(600) - expect(instance.calculate_fed_income(:spouse)).to eq(400) + expect(instance.calculate_fed_income(:primary)).to eq(30) + expect(instance.calculate_fed_income(:spouse)).to eq(70) end end - end - describe "#calculate_fed_subtractions" do - let(:intake) { create(:state_file_md_intake, :with_spouse) } - before do - intake.direct_file_data.primary_ssn = intake.direct_file_json_data.primary_filer&.tin&.delete("-") - intake.direct_file_data.spouse_ssn = intake.direct_file_json_data.spouse_filer&.tin&.delete("-") + context "primary and spouse have all four kinds of income" do + let(:intake) { create(:state_file_md_intake, :df_data_many_w2s) } + let(:primary_ssn) { intake.primary.ssn } + let(:spouse_ssn) { intake.spouse.ssn } + let!(:primary_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 10) } + let!(:spouse_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: spouse_ssn, taxable_amount: 20) } + let!(:primary_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 100) } + let!(:spouse_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 200) } + + before do + # only populating minimum data required for this test + intake.direct_file_json_data.interest_reports = [{}, {}] + intake.direct_file_json_data.interest_reports[0].recipient_tin = primary_ssn + intake.direct_file_json_data.interest_reports[1].recipient_tin = spouse_ssn + intake.direct_file_json_data.interest_reports[0].amount_1099 = "1.00" + intake.direct_file_json_data.interest_reports[1].amount_no_1099 = "2.00" + end + + it "calculates the fed income amount for primary and spouse" do + expect(instance.calculate_fed_income(:primary)).to eq(150_111) + expect(instance.calculate_fed_income(:spouse)).to eq(50_222) + end end + end + describe "#calculate_fed_subtractions" do context "primary and spouse have only student loan interest subtractions" do it "calculates the fed subtraction amount for primary and spouse" do intake.update(primary_student_loan_interest_ded_amount: 1.1) @@ -72,40 +121,31 @@ end context "primary and spouse have only educator expense subtractions" do - before do + it "calculates the fed subtraction amount for primary and spouse" do intake.direct_file_json_data.primary_filer&.educator_expenses = "10.00" intake.direct_file_json_data.spouse_filer&.educator_expenses = "20.00" - end - - it "calculates the fed subtraction amount for primary and spouse" do expect(instance.calculate_fed_subtractions(:primary)).to eq(10) expect(instance.calculate_fed_subtractions(:spouse)).to eq(20) end end context "primary and spouse have only health savings account subtractions" do - before do + it "calculates the fed subtraction amount for primary and spouse" do intake.direct_file_json_data.primary_filer&.hsa_total_deductible_amount = "100.00" intake.direct_file_json_data.spouse_filer&.hsa_total_deductible_amount = "200.00" - end - - it "calculates the fed subtraction amount for primary and spouse" do expect(instance.calculate_fed_subtractions(:primary)).to eq(100) expect(instance.calculate_fed_subtractions(:spouse)).to eq(200) end end context "primary and spouse have all three kinds of subtractions" do - before do + it "calculates the fed subtraction amount for primary and spouse" do + intake.update(primary_student_loan_interest_ded_amount: 1) + intake.update(spouse_student_loan_interest_ded_amount: 2) intake.direct_file_json_data.primary_filer&.educator_expenses = "10.00" intake.direct_file_json_data.spouse_filer&.educator_expenses = "20.00" intake.direct_file_json_data.primary_filer&.hsa_total_deductible_amount = "100.00" intake.direct_file_json_data.spouse_filer&.hsa_total_deductible_amount = "200.00" - end - - it "calculates the fed subtraction amount for primary and spouse" do - intake.update(primary_student_loan_interest_ded_amount: 1) - intake.update(spouse_student_loan_interest_ded_amount: 2) expect(instance.calculate_fed_subtractions(:primary)).to eq(111) expect(instance.calculate_fed_subtractions(:spouse)).to eq(222) end @@ -402,7 +442,7 @@ end instance.calculate - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_6].value).to eq(1000) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_6].value).to eq(1_000) end it "returns 0 if the lower income is below 0" do From cd9fe697c7aa99bb3eebdad8330a59e8a85788e2 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 20 Nov 2024 00:17:29 -0800 Subject: [PATCH 19/30] add line 14 to line 15 calculations --- app/lib/efile/md/md502_calculator.rb | 18 +++++++++--------- spec/lib/efile/md/md502_calculator_spec.rb | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/lib/efile/md/md502_calculator.rb b/app/lib/efile/md/md502_calculator.rb index f544610a3f..6ef26fa22d 100644 --- a/app/lib/efile/md/md502_calculator.rb +++ b/app/lib/efile/md/md502_calculator.rb @@ -327,12 +327,21 @@ def calculate_line_7 def calculate_line_10a; end + def calculate_line_13 + @lines[:MD502_SU_LINE_1].value + end + + def calculate_line_14 + line_or_zero(:MD_TWO_INCOME_WK_LINE_7) + end + def calculate_line_15 [ @direct_file_data.total_qualifying_dependent_care_expenses, # line 9 @direct_file_data.fed_taxable_ssb, # line 11 line_or_zero(:MD502_LINE_10A), line_or_zero(:MD502_LINE_13), + line_or_zero(:MD502_LINE_14), ].sum end @@ -431,15 +440,6 @@ def calculate_line_20 end end - def calculate_line_13 - @lines[:MD502_SU_LINE_1].value - end - - def calculate_line_14 - return 0 unless filing_status_mfj? - @lines[:MD_TWO_INCOME_WK_LINE_7].value - end - def calculate_line_21 # Maryland state income tax taxable_net_income = line_or_zero(:MD502_LINE_20) diff --git a/spec/lib/efile/md/md502_calculator_spec.rb b/spec/lib/efile/md/md502_calculator_spec.rb index 09d9c2a1a4..60e9ead48a 100644 --- a/spec/lib/efile/md/md502_calculator_spec.rb +++ b/spec/lib/efile/md/md502_calculator_spec.rb @@ -824,10 +824,11 @@ intake.direct_file_data.fed_taxable_ssb = 6 allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_10a).and_return 4 allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_13).and_return 8 + allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_14).and_return 10 end it "sums lines 8 - 14" do instance.calculate - expect(instance.lines[:MD502_LINE_15].value).to eq 20 + expect(instance.lines[:MD502_LINE_15].value).to eq 30 end end From ac5b37c4d4f265aa15aaf0da285dd03178f7c696 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 20 Nov 2024 12:12:48 -0800 Subject: [PATCH 20/30] update subtractions to use caluclation methods --- app/lib/efile/md/md502_calculator.rb | 6 ++++-- .../ty2024/states/md/documents/md502.rb | 12 ++++++++---- spec/lib/pdf_filler/md502_pdf_spec.rb | 3 +++ .../ty2024/states/md/documents/md502_spec.rb | 6 ++++++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/lib/efile/md/md502_calculator.rb b/app/lib/efile/md/md502_calculator.rb index 6ef26fa22d..9fe4c26db0 100644 --- a/app/lib/efile/md/md502_calculator.rb +++ b/app/lib/efile/md/md502_calculator.rb @@ -55,7 +55,9 @@ def calculate set_line(:MD502_LINE_7, :calculate_line_7) # Subtractions + set_line(:MD502_LINE_9, @direct_file_data, :total_qualifying_dependent_care_expenses) set_line(:MD502_LINE_10A, :calculate_line_10a) # STUBBED: PLEASE REPLACE, don't forget line_data.yml + set_line(:MD502_LINE_11, @direct_file_data, :fed_taxable_ssb) @md502_su.calculate set_line(:MD502_LINE_13, :calculate_line_13) if filing_status_mfj? @@ -337,9 +339,9 @@ def calculate_line_14 def calculate_line_15 [ - @direct_file_data.total_qualifying_dependent_care_expenses, # line 9 - @direct_file_data.fed_taxable_ssb, # line 11 + line_or_zero(:MD502_LINE_9), line_or_zero(:MD502_LINE_10A), + line_or_zero(:MD502_LINE_11), line_or_zero(:MD502_LINE_13), line_or_zero(:MD502_LINE_14), ].sum diff --git a/app/lib/submission_builder/ty2024/states/md/documents/md502.rb b/app/lib/submission_builder/ty2024/states/md/documents/md502.rb index a6fcb93332..b9a42c4f40 100644 --- a/app/lib/submission_builder/ty2024/states/md/documents/md502.rb +++ b/app/lib/submission_builder/ty2024/states/md/documents/md502.rb @@ -114,10 +114,10 @@ def document xml.FedAGIAndStateAdditions calculated_fields.fetch(:MD502_LINE_7) end xml.Subtractions do - xml.ChildAndDependentCareExpenses @direct_file_data.total_qualifying_dependent_care_expenses - xml.SocialSecurityRailRoadBenefits @direct_file_data.fed_taxable_ssb - xml.Other calculated_fields.fetch(:MD502_LINE_13) - xml.TwoIncome calculated_fields.fetch(:MD502_LINE_14) + add_element_if_present(xml, "ChildAndDependentCareExpenses", :MD502_LINE_9) + add_element_if_present(xml, "SocialSecurityRailRoadBenefits", :MD502_LINE_11) + add_element_if_present(xml, "Other", :MD502_LINE_13) + add_element_if_present(xml, "TwoIncome", :MD502_LINE_14) add_element_if_present(xml, "Total", :MD502_LINE_15) add_element_if_present(xml, "StateAdjustedGrossIncome", :MD502_LINE_16) end @@ -200,4 +200,8 @@ def add_element_if_present(xml, tag, line_id) value = calculated_fields.fetch(line_id) xml.send(tag, value) if value.present? end + + def any_line_present?(line_ids) + line_ids.map { |line_id| calculated_fields.fetch(line_id).present? }.any? + end end diff --git a/spec/lib/pdf_filler/md502_pdf_spec.rb b/spec/lib/pdf_filler/md502_pdf_spec.rb index 6241c1c815..79b4d2e52d 100644 --- a/spec/lib/pdf_filler/md502_pdf_spec.rb +++ b/spec/lib/pdf_filler/md502_pdf_spec.rb @@ -294,14 +294,17 @@ end context "subtractions" do + let(:two_income_subtraction_amount) { 1200 } before do intake.direct_file_data.total_qualifying_dependent_care_expenses = 1200 intake.direct_file_data.fed_taxable_ssb = 240 + allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_14).and_return two_income_subtraction_amount end it "fills out subtractions fields correctly" do expect(pdf_fields["Enter 9"].to_i).to eq 1200 expect(pdf_fields["Enter 11"].to_i).to eq 240 + expect(pdf_fields["Enter 14"].to_i).to eq two_income_subtraction_amount end context "with 502SU Subtractions" do diff --git a/spec/lib/submission_builder/ty2024/states/md/documents/md502_spec.rb b/spec/lib/submission_builder/ty2024/states/md/documents/md502_spec.rb index 7a88d6d097..37407a6784 100644 --- a/spec/lib/submission_builder/ty2024/states/md/documents/md502_spec.rb +++ b/spec/lib/submission_builder/ty2024/states/md/documents/md502_spec.rb @@ -289,11 +289,13 @@ context "subtractions section" do let(:other_subtractions) { 100 } + let(:two_income_subtraction_amount) { 1200 } let(:total_subtractions) { 150 } let(:state_adjusted_income) { 300 } context "when all relevant values are present in the DF XML" do before do allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_13).and_return other_subtractions + allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_14).and_return two_income_subtraction_amount allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_15).and_return total_subtractions allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_16).and_return state_adjusted_income intake.direct_file_data.total_qualifying_dependent_care_expenses = 1200 @@ -312,6 +314,10 @@ expect(xml.at("Form502 Subtractions Other").text.to_i).to eq(other_subtractions) end + it "outputs the Two income Subtraction amount" do + expect(xml.at("Form502 Subtractions TwoIncome").text.to_i).to eq(two_income_subtraction_amount) + end + it "outputs the sum of the Subtractions" do expect(xml.at("Form502 Subtractions Total").text.to_i).to eq(total_subtractions) end From a36b52a81789048cc0c0ed8a50542fde45c019b5 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 20 Nov 2024 15:02:25 -0800 Subject: [PATCH 21/30] code review feedback --- .../md/two_income_subtraction_worksheet.rb | 9 +++---- app/models/direct_file_json_data.rb | 4 --- .../two_income_subtraction_worksheet_spec.rb | 26 +++++++++---------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 613761f638..1ef8463218 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -29,23 +29,22 @@ def calculate end def calculate_fed_income(primary_or_spouse) - filer = @intake.send(primary_or_spouse) + filer_ssn = @intake.send(primary_or_spouse).ssn wage_income = @direct_file_data.w2s - .select { |w2| w2.EmployeeSSN == filer.ssn } + .select { |w2| w2.EmployeeSSN == filer_ssn } .sum { |w2| w2.WagesAmt&.round } interest_income = @direct_file_json_data.interest_reports - .select { |interest_report| interest_report.recipient_tin.delete("-") == filer.ssn } + .select { |interest_report| interest_report.recipient_tin.delete("-") == filer_ssn } .sum { |interest_report| (interest_report.amount_1099&.round || 0) + (interest_report.amount_no_1099&.round || 0) } retirement_income = @intake.state_file1099_rs - .select { |form1099r| form1099r.recipient_ssn == filer.ssn } + .select { |form1099r| form1099r.recipient_ssn == filer_ssn } .sum { |form1099r| form1099r.taxable_amount&.round } - # TODO: check in about getting this from DF JSON instead unemployment_income = @intake.state_file1099_gs .select { |form1099g| form1099g.recipient.to_sym == primary_or_spouse } .sum { |form1099g| form1099g.unemployment_compensation_amount&.round } diff --git a/app/models/direct_file_json_data.rb b/app/models/direct_file_json_data.rb index ad1daa6c97..8f88133b2c 100644 --- a/app/models/direct_file_json_data.rb +++ b/app/models/direct_file_json_data.rb @@ -65,10 +65,6 @@ def interest_reports data["interestReports"]&.map { |interest_report| DfJsonInterestReport.new(interest_report) } || [] end - def interest_reports=(value) - data["interestReports"] = value - end - def filers data["filers"]&.map { |filer| DfJsonFiler.new(filer) } || [] end diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index bd27b4d9ff..6355d5c689 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -21,7 +21,7 @@ context "primary and spouse have only wage income" do let(:intake) { create(:state_file_md_intake, :df_data_many_w2s) } it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(:primary)).to eq(150_000) + expect(instance.calculate_fed_income(:primary)).to eq(50_000 + 50_000 + 50_000) expect(instance.calculate_fed_income(:spouse)).to eq(50_000) end end @@ -31,7 +31,7 @@ primary_ssn = intake.primary.ssn spouse_ssn = intake.spouse.ssn # only populating minimum data required for this test - intake.direct_file_json_data.interest_reports = [{}, {}, {}, {}] + intake.raw_direct_file_intake_data["interestReports"] = [{}, {}, {}, {}] intake.direct_file_json_data.interest_reports[0].recipient_tin = primary_ssn intake.direct_file_json_data.interest_reports[1].recipient_tin = primary_ssn intake.direct_file_json_data.interest_reports[2].recipient_tin = spouse_ssn @@ -43,8 +43,8 @@ intake.direct_file_json_data.interest_reports[1].amount_1099 = "20.00" intake.direct_file_json_data.interest_reports[2].amount_no_1099 = "30.00" intake.direct_file_json_data.interest_reports[3].amount_no_1099 = "40.00" - expect(instance.calculate_fed_income(:primary)).to eq(30) - expect(instance.calculate_fed_income(:spouse)).to eq(70) + expect(instance.calculate_fed_income(:primary)).to eq(10 + 20) + expect(instance.calculate_fed_income(:spouse)).to eq(30 + 40) end it "handles nil values for interest income" do @@ -58,7 +58,6 @@ end context "primary and spouse have only retirement income" do - let(:intake) { create(:state_file_md_intake, :with_spouse) } let(:primary_ssn) { intake.primary.ssn } let(:spouse_ssn) { intake.spouse.ssn } let!(:primary_state_file1099_r_1) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 10) } @@ -67,21 +66,20 @@ let!(:spouse_state_file1099_r_2) { create(:state_file1099_r, intake: intake, recipient_ssn: spouse_ssn, taxable_amount: 40) } it "calculates the fed income amount for primary and spouse from multiple 1099Rs" do - expect(instance.calculate_fed_income(:primary)).to eq(30) - expect(instance.calculate_fed_income(:spouse)).to eq(70) + expect(instance.calculate_fed_income(:primary)).to eq(10 + 20) + expect(instance.calculate_fed_income(:spouse)).to eq(30 + 40) end end context "primary and spouse have only unemployment income" do - let(:intake) { create(:state_file_md_intake, :with_spouse) } let!(:primary_state_file1099_g_1) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 10) } let!(:primary_state_file1099_g_2) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 20) } let!(:spouse_state_file1099_g_1) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 30) } let!(:spouse_state_file1099_g_2) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 40) } it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(:primary)).to eq(30) - expect(instance.calculate_fed_income(:spouse)).to eq(70) + expect(instance.calculate_fed_income(:primary)).to eq(10 + 20) + expect(instance.calculate_fed_income(:spouse)).to eq(30 + 40) end end @@ -104,8 +102,8 @@ end it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(:primary)).to eq(150_111) - expect(instance.calculate_fed_income(:spouse)).to eq(50_222) + expect(instance.calculate_fed_income(:primary)).to eq(50_000 + 50_000 + 50_000 + 100 + 10 + 1) + expect(instance.calculate_fed_income(:spouse)).to eq(50_000 + 200 + 20 + 2) end end end @@ -146,8 +144,8 @@ intake.direct_file_json_data.spouse_filer&.educator_expenses = "20.00" intake.direct_file_json_data.primary_filer&.hsa_total_deductible_amount = "100.00" intake.direct_file_json_data.spouse_filer&.hsa_total_deductible_amount = "200.00" - expect(instance.calculate_fed_subtractions(:primary)).to eq(111) - expect(instance.calculate_fed_subtractions(:spouse)).to eq(222) + expect(instance.calculate_fed_subtractions(:primary)).to eq(100 + 10 + 1) + expect(instance.calculate_fed_subtractions(:spouse)).to eq(200 + 20 + 2) end end end From 82537984344e297300bf9cb7b55359ed3697c0ac Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 20 Nov 2024 15:10:31 -0800 Subject: [PATCH 22/30] add labels --- app/lib/efile/line_data.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/lib/efile/line_data.yml b/app/lib/efile/line_data.yml index bc76c3f926..8b7020fc3e 100644 --- a/app/lib/efile/line_data.yml +++ b/app/lib/efile/line_data.yml @@ -594,8 +594,12 @@ MD502_LINE_D_COUNT_TOTAL: label: 'D Total Exemption Count: add lines A, B and C counts' MD502_LINE_D_AMOUNT_TOTAL: label: 'D Total Exemption Dollar Amount: add lines A, B and C amounts' +MD502_LINE_9: + label: 'Child and dependent care expenses' MD502_LINE_10A: label: 'TBD' +MD502_LINE_11: + label: 'Taxable Social Security and RR benefits (Tier I, II and supplemental) included in line 1' MD502_LINE_13: label: 'Subtractions from attached form 502SU' MD_TWO_INCOME_WK_LINE_1_A: From 272f35028212169bf130f1a7513181dad8092307 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 20 Nov 2024 15:21:00 -0800 Subject: [PATCH 23/30] don't use setter for interest_reports --- spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index 6355d5c689..67a95cc930 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -94,7 +94,7 @@ before do # only populating minimum data required for this test - intake.direct_file_json_data.interest_reports = [{}, {}] + intake.raw_direct_file_intake_data["interestReports"] = [{}, {}] intake.direct_file_json_data.interest_reports[0].recipient_tin = primary_ssn intake.direct_file_json_data.interest_reports[1].recipient_tin = spouse_ssn intake.direct_file_json_data.interest_reports[0].amount_1099 = "1.00" From aa027e705a2a6b73f2682600d208500d0dc7e0bc Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 20 Nov 2024 17:17:30 -0800 Subject: [PATCH 24/30] cleanup --- spec/factories/state_file_w2s.rb | 1 - .../2023/md/todd_and_spouse_1099_int.json | 51 ------------------- 2 files changed, 52 deletions(-) delete mode 100644 spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json diff --git a/spec/factories/state_file_w2s.rb b/spec/factories/state_file_w2s.rb index 6f6b95983f..e92c74d450 100644 --- a/spec/factories/state_file_w2s.rb +++ b/spec/factories/state_file_w2s.rb @@ -30,7 +30,6 @@ factory :state_file_w2 do w2_index { 0 } employee_name { "Jajko" } - employee_ssn { "123456789" } employer_name { "Biszkoptowy Enterprises" } employer_state_id_num { "12345" } state_wages_amount { 1000 } diff --git a/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json b/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json deleted file mode 100644 index ded633451d..0000000000 --- a/spec/fixtures/state_file/fed_return_jsons/2023/md/todd_and_spouse_1099_int.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "familyAndHousehold": [], - "filers": [ - { - "firstName": "Todd", - "lastName": "Interest", - "middleInitial": "T", - "tin": "123-45-6789", - "dateOfBirth": "1980-01-01", - "isPrimaryFiler": true, - "educatorExpenses": "20.00", - "hsaTotalDeductibleAmount": "200.00" - }, - { - "firstName": "Todd", - "lastName": "Spouse", - "middleInitial": "T", - "tin": "987-65-4321", - "dateOfBirth": "1980-01-01", - "isPrimaryFiler": false, - "educatorExpenses": "10.00", - "hsaTotalDeductibleAmount": "100.00" - } - ], - "interestReports": [ - { - "1099Amount": "1.00", - "has1099": true, - "interestOnGovernmentBonds": "2.00", - "no1099Amount": "3.00", - "payer": "The payer name", - "payerTin": "101-23-4567", - "recipientTin": "123-45-6789", - "taxExemptAndTaxCreditBondCusipNo": "123456789", - "taxExemptInterest": "4.00", - "taxWithheld": "5.00" - }, - { - "1099Amount": "60.00", - "has1099": true, - "interestOnGovernmentBonds": "70.00", - "no1099Amount": "80.00", - "payer": "The payer name", - "payerTin": "101-23-4567", - "recipientTin": "987-65-4321", - "taxExemptAndTaxCreditBondCusipNo": "123456789", - "taxExemptInterest": "90.00", - "taxWithheld": "5.00" - } - ] -} \ No newline at end of file From 3ef8915ce421543f8e22965fc25710c8dd2cb164 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 20 Nov 2024 17:27:11 -0800 Subject: [PATCH 25/30] add line 14 test --- spec/lib/efile/md/md502_calculator_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/lib/efile/md/md502_calculator_spec.rb b/spec/lib/efile/md/md502_calculator_spec.rb index 60e9ead48a..fe0a025103 100644 --- a/spec/lib/efile/md/md502_calculator_spec.rb +++ b/spec/lib/efile/md/md502_calculator_spec.rb @@ -818,6 +818,28 @@ end end + describe "#calculate_line_14" do + before do + allow_any_instance_of(Efile::Md::TwoIncomeSubtractionWorksheet).to receive(:calculate_line_7).and_return 1000 + end + + context 'MFJ filing status' do + let(:filing_status) { 'married_filing_jointly' } + it 'returns the amount from the worksheet if MFJ filing status' do + instance.calculate + expect(instance.lines[:MD502_LINE_14].value).to eq 1000 + end + end + + context 'MFS filing status' do + let(:filing_status) { 'married_filing_separately' } + it 'returns the 0 if not MFJ filing status' do + instance.calculate + expect(instance.lines[:MD502_LINE_14].value).to eq 0 + end + end + end + describe "#calculate_line_15" do before do intake.direct_file_data.total_qualifying_dependent_care_expenses = 2 From 2b92f3db476228a4aaf0023ef09c72eb822b517c Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Thu, 21 Nov 2024 17:17:51 -0800 Subject: [PATCH 26/30] code review feedback --- .../md/two_income_subtraction_worksheet.rb | 20 ++++--------- .../ty2024/states/id/id_return_xml.rb | 4 +-- spec/lib/efile/md/md502_calculator_spec.rb | 2 +- .../two_income_subtraction_worksheet_spec.rb | 28 +++++++++---------- 4 files changed, 23 insertions(+), 31 deletions(-) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 1ef8463218..9ad12c4d27 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -87,13 +87,9 @@ def calculate_line_2(primary_or_spouse) end def calculate_line_3(primary_or_spouse) - if primary_or_spouse == :primary - @lines[:MD_TWO_INCOME_WK_LINE_1_A].value + - @lines[:MD_TWO_INCOME_WK_LINE_2_A].value - else - @lines[:MD_TWO_INCOME_WK_LINE_1_B].value + - @lines[:MD_TWO_INCOME_WK_LINE_2_B].value - end + filer = primary_or_spouse == :primary ? "A" : "B" + line_or_zero("MD_TWO_INCOME_WK_LINE_1_#{filer}") + + line_or_zero("MD_TWO_INCOME_WK_LINE_2_#{filer}") end def calculate_line_4(primary_or_spouse) @@ -109,13 +105,9 @@ def calculate_line_4(primary_or_spouse) end def calculate_line_5(primary_or_spouse) - if primary_or_spouse == :primary - @lines[:MD_TWO_INCOME_WK_LINE_3_A].value - - @lines[:MD_TWO_INCOME_WK_LINE_4_A].value - else - @lines[:MD_TWO_INCOME_WK_LINE_3_B].value - - @lines[:MD_TWO_INCOME_WK_LINE_4_B].value - end + filer = primary_or_spouse == :primary ? "A" : "B" + line_or_zero("MD_TWO_INCOME_WK_LINE_3_#{filer}") - + line_or_zero("MD_TWO_INCOME_WK_LINE_4_#{filer}") end def calculate_line_6 diff --git a/app/lib/submission_builder/ty2024/states/id/id_return_xml.rb b/app/lib/submission_builder/ty2024/states/id/id_return_xml.rb index 86f3aedb8a..8ba2f9c001 100644 --- a/app/lib/submission_builder/ty2024/states/id/id_return_xml.rb +++ b/app/lib/submission_builder/ty2024/states/id/id_return_xml.rb @@ -32,12 +32,12 @@ def supported_documents supported_docs = [ { xml: SubmissionBuilder::Ty2024::States::Id::Documents::Id40, - pdf: PdfFiller::Id40Pdf, + pdf: PdfFiller::Id40Pdf, include: true }, { xml: SubmissionBuilder::Ty2024::States::Id::Documents::Id39R, - pdf: PdfFiller::Id39rPdf, + pdf: PdfFiller::Id39rPdf, include: true }, ] diff --git a/spec/lib/efile/md/md502_calculator_spec.rb b/spec/lib/efile/md/md502_calculator_spec.rb index fe0a025103..1fd4733fde 100644 --- a/spec/lib/efile/md/md502_calculator_spec.rb +++ b/spec/lib/efile/md/md502_calculator_spec.rb @@ -850,7 +850,7 @@ end it "sums lines 8 - 14" do instance.calculate - expect(instance.lines[:MD502_LINE_15].value).to eq 30 + expect(instance.lines[:MD502_LINE_15].value).to eq 2 + 4 + 6 + 8 + 10 end end diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index 67a95cc930..ff5b450dfe 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -171,8 +171,8 @@ end instance.calculate - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(90) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(180) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(100 - 10) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(200 - 20) end it "calculates a negative fed agi for primary and spouse" do @@ -194,8 +194,8 @@ end instance.calculate - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(-10) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(-20) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_A].value).to eq(100 - 110) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_1_B].value).to eq(200 - 220) end it "calculates a 0 fed agi for primary and spouse" do @@ -266,8 +266,8 @@ end instance.calculate - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(110) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(220) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(100 + 10) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(200 + 20) end it "calculates a negative amount for primary and spouse" do @@ -289,8 +289,8 @@ end instance.calculate - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(-90) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(-180) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(-100 + 10) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(-200 + 20) end it "calculates a 0 for primary and spouse" do @@ -312,8 +312,8 @@ end instance.calculate - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(0) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(0) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_A].value).to eq(-100 + 100) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_3_B].value).to eq(-200 + 200) end end end @@ -361,8 +361,8 @@ end instance.calculate - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(90) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_B].value).to eq(180) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(100 - 10) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_B].value).to eq(200 - 20) end it "calculates a negative amount for primary and spouse" do @@ -384,8 +384,8 @@ end instance.calculate - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(-10) - expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_B].value).to eq(-20) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_A].value).to eq(100 - 110) + expect(instance.lines[:MD_TWO_INCOME_WK_LINE_5_B].value).to eq(200 - 220) end it "calculates a 0 for primary and spouse" do From 43a352c014bd7e1f79ceec60f9a8efa4ce234337 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Thu, 21 Nov 2024 17:55:45 -0800 Subject: [PATCH 27/30] use json for 1099G info instead --- .../md/two_income_subtraction_worksheet.rb | 27 ++++++++++--------- app/models/direct_file_json_data.rb | 1 + spec/factories/state_file_md_intakes.rb | 1 + .../two_income_subtraction_worksheet_spec.rb | 15 +++++------ 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/app/lib/efile/md/two_income_subtraction_worksheet.rb b/app/lib/efile/md/two_income_subtraction_worksheet.rb index 9ad12c4d27..d748fed910 100644 --- a/app/lib/efile/md/two_income_subtraction_worksheet.rb +++ b/app/lib/efile/md/two_income_subtraction_worksheet.rb @@ -45,9 +45,7 @@ def calculate_fed_income(primary_or_spouse) .select { |form1099r| form1099r.recipient_ssn == filer_ssn } .sum { |form1099r| form1099r.taxable_amount&.round } - unemployment_income = @intake.state_file1099_gs - .select { |form1099g| form1099g.recipient.to_sym == primary_or_spouse } - .sum { |form1099g| form1099g.unemployment_compensation_amount&.round } + unemployment_income = find_filer_json_for(primary_or_spouse)&.form_1099_gs_total&.round || 0 wage_income + interest_income + @@ -56,22 +54,20 @@ def calculate_fed_income(primary_or_spouse) end def calculate_fed_subtractions(primary_or_spouse) - filer_json = @direct_file_json_data.filers - .find { |df_filer_data| - df_filer_data.tin.delete("-") == @intake.send(primary_or_spouse).ssn - } - - # TODO: Some MFJ tests are missing spouse JSON - should not happen in prod - return 0 unless filer_json + filer_json = find_filer_json_for(primary_or_spouse) student_loan_interest = { primary: @intake.primary_student_loan_interest_ded_amount&.round, spouse: @intake.spouse_student_loan_interest_ded_amount&.round, }[primary_or_spouse] + educator_expenses = filer_json&.educator_expenses&.round || 0 + + hsa_total_deductible_amount = filer_json&.hsa_total_deductible_amount&.round || 0 + student_loan_interest + - filer_json.educator_expenses&.round + - filer_json.hsa_total_deductible_amount&.round + educator_expenses + + hsa_total_deductible_amount end private @@ -119,6 +115,13 @@ def calculate_line_6 def calculate_line_7 @lines[:MD_TWO_INCOME_WK_LINE_6].value.clamp(0, 1_200) end + + def find_filer_json_for(primary_or_spouse) + @direct_file_json_data.filers + .find { |df_filer_data| + df_filer_data.tin.delete("-") == @intake.send(primary_or_spouse).ssn + } + end end end end diff --git a/app/models/direct_file_json_data.rb b/app/models/direct_file_json_data.rb index 8f88133b2c..b2198ab7fd 100644 --- a/app/models/direct_file_json_data.rb +++ b/app/models/direct_file_json_data.rb @@ -10,6 +10,7 @@ class DfJsonPerson < DfJsonWrapper class DfJsonFiler < DfJsonPerson json_accessor is_primary_filer: { type: :boolean, key: "isPrimaryFiler" } + json_accessor form_1099_gs_total: { type: :money_amount, key: "form1099GsTotal" } json_accessor educator_expenses: { type: :money_amount, key: "educatorExpenses" } json_accessor hsa_total_deductible_amount: { type: :money_amount, key: "hsaTotalDeductibleAmount" } end diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb index 87f74c7d4b..82a8d9e4b7 100644 --- a/spec/factories/state_file_md_intakes.rb +++ b/spec/factories/state_file_md_intakes.rb @@ -160,6 +160,7 @@ trait :df_data_many_w2s do raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('md_zeus_many_w2s') } + raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_zeus_many_w2s') } end trait :head_of_household do diff --git a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb index ff5b450dfe..277e968950 100644 --- a/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb +++ b/spec/lib/efile/md/two_income_subtraction_worksheet_spec.rb @@ -72,14 +72,11 @@ end context "primary and spouse have only unemployment income" do - let!(:primary_state_file1099_g_1) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 10) } - let!(:primary_state_file1099_g_2) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 20) } - let!(:spouse_state_file1099_g_1) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 30) } - let!(:spouse_state_file1099_g_2) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 40) } - it "calculates the fed income amount for primary and spouse" do - expect(instance.calculate_fed_income(:primary)).to eq(10 + 20) - expect(instance.calculate_fed_income(:spouse)).to eq(30 + 40) + intake.direct_file_json_data.primary_filer&.form_1099_gs_total = "100.00" + intake.direct_file_json_data.spouse_filer&.form_1099_gs_total = "200.00" + expect(instance.calculate_fed_income(:primary)).to eq(100) + expect(instance.calculate_fed_income(:spouse)).to eq(200) end end @@ -89,8 +86,6 @@ let(:spouse_ssn) { intake.spouse.ssn } let!(:primary_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: primary_ssn, taxable_amount: 10) } let!(:spouse_state_file1099_r) { create(:state_file1099_r, intake: intake, recipient_ssn: spouse_ssn, taxable_amount: 20) } - let!(:primary_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :primary, unemployment_compensation_amount: 100) } - let!(:spouse_state_file1099_g) { create(:state_file1099_g, intake: intake, recipient: :spouse, unemployment_compensation_amount: 200) } before do # only populating minimum data required for this test @@ -99,6 +94,8 @@ intake.direct_file_json_data.interest_reports[1].recipient_tin = spouse_ssn intake.direct_file_json_data.interest_reports[0].amount_1099 = "1.00" intake.direct_file_json_data.interest_reports[1].amount_no_1099 = "2.00" + intake.direct_file_json_data.primary_filer&.form_1099_gs_total = "100.00" + intake.direct_file_json_data.spouse_filer&.form_1099_gs_total = "200.00" end it "calculates the fed income amount for primary and spouse" do From 0fa7f68cc753f47bf60f33dd7501539987c523bb Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Tue, 26 Nov 2024 20:33:52 -0800 Subject: [PATCH 28/30] add acceptance testing scenarios --- .../fed_return_jsons/md/scenario_10.json | 25 ++ .../fed_return_jsons/md/scenario_5.json | 24 ++ .../fed_return_jsons/md/scenario_6.json | 91 +++++++ .../fed_return_jsons/md/scenario_9.json | 48 ++++ .../fed_return_xmls/md/scenario_10.xml | 164 +++++++++++++ .../fed_return_xmls/md/scenario_5.xml | 181 ++++++++++++++ .../fed_return_xmls/md/scenario_6.xml | 229 ++++++++++++++++++ .../fed_return_xmls/md/scenario_9.xml | 209 ++++++++++++++++ 8 files changed, 971 insertions(+) create mode 100644 spec/fixtures/state_file/fed_return_jsons/md/scenario_10.json create mode 100644 spec/fixtures/state_file/fed_return_jsons/md/scenario_5.json create mode 100644 spec/fixtures/state_file/fed_return_jsons/md/scenario_6.json create mode 100644 spec/fixtures/state_file/fed_return_jsons/md/scenario_9.json create mode 100644 spec/fixtures/state_file/fed_return_xmls/md/scenario_10.xml create mode 100644 spec/fixtures/state_file/fed_return_xmls/md/scenario_5.xml create mode 100644 spec/fixtures/state_file/fed_return_xmls/md/scenario_6.xml create mode 100644 spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml diff --git a/spec/fixtures/state_file/fed_return_jsons/md/scenario_10.json b/spec/fixtures/state_file/fed_return_jsons/md/scenario_10.json new file mode 100644 index 0000000000..0fdb72a57d --- /dev/null +++ b/spec/fixtures/state_file/fed_return_jsons/md/scenario_10.json @@ -0,0 +1,25 @@ +{ + "familyAndHousehold": [], + "filers": [ + { + "firstName": "Beaches", + "middleInitial": "T", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": true, + "tin": "123-45-6789", + "educatorExpenses": "200.00", + "hsaTotalDeductibleAmount": "200.00" + }, + { + "firstName": "Pebble", + "middleInitial": "Y", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": false, + "tin": "987-65-4321", + "educatorExpenses": "100.00" + } + ], + "interestReports": [] +} diff --git a/spec/fixtures/state_file/fed_return_jsons/md/scenario_5.json b/spec/fixtures/state_file/fed_return_jsons/md/scenario_5.json new file mode 100644 index 0000000000..b02453a59d --- /dev/null +++ b/spec/fixtures/state_file/fed_return_jsons/md/scenario_5.json @@ -0,0 +1,24 @@ +{ + "familyAndHousehold": [], + "filers": [ + { + "firstName": "Beaches", + "middleInitial": "T", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": true, + "tin": "123-45-6789", + "form1099GsTotal": "400.00", + "hsaTotalDeductibleAmount": "5998.00" + }, + { + "firstName": "Pebble", + "middleInitial": "Y", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": false, + "tin": "987-65-4321", + "hsaTotalDeductibleAmount": "1000.00" + } + ] +} diff --git a/spec/fixtures/state_file/fed_return_jsons/md/scenario_6.json b/spec/fixtures/state_file/fed_return_jsons/md/scenario_6.json new file mode 100644 index 0000000000..a9443cf7dd --- /dev/null +++ b/spec/fixtures/state_file/fed_return_jsons/md/scenario_6.json @@ -0,0 +1,91 @@ +{ + "familyAndHousehold": [], + "filers": [ + { + "firstName": "Beaches", + "middleInitial": "T", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": true, + "tin": "123-45-6789", + "educatorExpenses": "100.00" + }, + { + "firstName": "Pebble", + "middleInitial": "Y", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": false, + "tin": "987-65-4321", + "educatorExpenses": "200.00" + } + ], + "interestReports": [ + { + "has1099": true, + "taxExemptAndTaxCreditBondCusipNo": null, + "interestOnGovernmentBonds": "222.00", + "payerTin": "00-4321234", + "recipientTin": "123-45-6789", + "payer": "Vienna Fund", + "no1099Amount": null, + "taxWithheld": "100.00", + "1099Amount": "888.00" + }, + { + "has1099": true, + "taxExemptAndTaxCreditBondCusipNo": null, + "interestOnGovernmentBonds": null, + "payerTin": "00-4321234", + "recipientTin": "123-45-6789", + "payer": "Vienna Fund", + "no1099Amount": null, + "taxWithheld": "100.00", + "1099Amount": "10.00" + }, + { + "has1099": false, + "taxExemptAndTaxCreditBondCusipNo": null, + "interestOnGovernmentBonds": null, + "payerTin": "00-4321234", + "recipientTin": "123-45-6789", + "payer": "Vienna Fund", + "no1099Amount": "10.00", + "taxWithheld": "100.00", + "1099Amount": null + }, + { + "has1099": true, + "taxExemptAndTaxCreditBondCusipNo": null, + "interestOnGovernmentBonds": "100.00", + "payerTin": "00-4321234", + "recipientTin": "987-65-4321", + "payer": "Vienna Fund", + "no1099Amount": null, + "taxWithheld": "100.00", + "1099Amount": "900.00" + }, + { + "has1099": true, + "taxExemptAndTaxCreditBondCusipNo": null, + "interestOnGovernmentBonds": null, + "payerTin": "00-4321234", + "recipientTin": "987-65-4321", + "payer": "Vienna Fund", + "no1099Amount": null, + "taxWithheld": "100.00", + "1099Amount": "1500.00" + }, + { + "has1099": false, + "taxExemptAndTaxCreditBondCusipNo": null, + "interestOnGovernmentBonds": null, + "payerTin": "00-4321234", + "recipientTin": "987-65-4321", + "payer": "Vienna Fund", + "no1099Amount": "50.00", + "taxWithheld": "100.00", + "1099Amount": null + } + ] +} diff --git a/spec/fixtures/state_file/fed_return_jsons/md/scenario_9.json b/spec/fixtures/state_file/fed_return_jsons/md/scenario_9.json new file mode 100644 index 0000000000..d36f9413a9 --- /dev/null +++ b/spec/fixtures/state_file/fed_return_jsons/md/scenario_9.json @@ -0,0 +1,48 @@ +{ + "familyAndHousehold": [], + "filers": [ + { + "firstName": "Beaches", + "middleInitial": "T", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": true, + "tin": "123-45-6789", + "form1099GsTotal": "1200.00", + "hsaTotalDeductibleAmount": "4000.00" + }, + { + "firstName": "Pebble", + "middleInitial": "Y", + "lastName": "Yarn Mat", + "dateOfBirth": "1950-01-01", + "isPrimaryFiler": false, + "tin": "987-65-4321", + "educatorExpenses": "100.00" + } + ], + "interestReports": [ + { + "has1099": true, + "taxExemptAndTaxCreditBondCusipNo": null, + "interestOnGovernmentBonds": "222.00", + "payerTin": "00-4321234", + "recipientTin": "123-45-6789", + "payer": "Vienna Fund", + "no1099Amount": null, + "taxWithheld": "100.00", + "1099Amount": "2555.00" + }, + { + "has1099": true, + "taxExemptAndTaxCreditBondCusipNo": null, + "interestOnGovernmentBonds": "100.00", + "payerTin": "00-4321234", + "recipientTin": "987-65-4321", + "payer": "Vienna Fund", + "no1099Amount": null, + "taxWithheld": "100.00", + "1099Amount": "444.00" + } + ] +} diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_10.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_10.xml new file mode 100644 index 0000000000..3902a8f821 --- /dev/null +++ b/spec/fixtures/state_file/fed_return_xmls/md/scenario_10.xml @@ -0,0 +1,164 @@ + + + + 2023 + 2023-01-01 + 2023-12-31 + 2022.2.100 + 1040 + + 123456789 + 987654321 + BEACHES & PEBBLES<YARN MAT + YARN + YARN + + 15 Cool St + Apt 12B + Monkton + MD + 21111 + + 5551234567 + + + + beaches@bigtoddsyarnmats.com + + + + + + 2 + Pebbles Yarn Mat + false + mat + towel + NO FINANCIAL PRODUCT + + + 123456789 + 001245767 + WSF + + Wharton State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + BEACHES T YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 1000 + 1000 + 50000 + 3100 + 0 + 725 + + 414HSUB + 250 + + + + MD + 98765 + 1 + 1 + + 1 + 1 + Hammonton + + + + S + + + 987654321 + 001245768 + BTB + + Brendan T Byrne State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + PEBBLE Y YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 20000 + 1000 + 50000 + 3100 + 50000 + 725 + + 414HSUB + 250 + + + + MD + 12345 + 1 + 1 + + 1 + 1 + Hammonton + + + + S + + + PAYE + + Payer Name + + + 2030 Pecan Street + Monroe + MD + 05502 + + 000000008 + 2025551212 + 123456789 + Beaches T Yarn Mat + + 2030 Pecan Street + Monroe + MD + 02301 + + 200 + 10123 + 300 + S + + + 700 + + + 2000 + + + \ No newline at end of file diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_5.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_5.xml new file mode 100644 index 0000000000..e3c5ca7cf6 --- /dev/null +++ b/spec/fixtures/state_file/fed_return_xmls/md/scenario_5.xml @@ -0,0 +1,181 @@ + + + + 2023 + 2023-01-01 + 2023-12-31 + 2022.2.100 + 1040 + + 123456789 + 987654321 + BEACHES & PEBBLES<YARN MAT + YARN + YARN + + 15 Cool St + Apt 12B + Monkton + MD + 21111 + + 5551234567 + + + + beaches@bigtoddsyarnmats.com + + + + + + 2 + Pebbles Yarn Mat + mat + towel + NO FINANCIAL PRODUCT + + + PAYE + + Payer Name + + + 2030 Pecan Street + Monroe + MD + 05502 + + 000000008 + 2025551212 + 123456789 + Beaches T Yarn Mat + + 2030 Pecan Street + Monroe + MD + 02301 + + 200 + 200 + 300 + S + + + PAYE + + Payer 2 Name + Line 2 + + 000000009 + 123456789 + Beaches T Yarn Mat + + 20 Override Street + Line Two + Monroe + MD + 70201 + + 200 + 200 + 500 + + + MD + 2000 + + 2000 + How Town + 2000 + + + + N + + + PAYE + + Payer Name + + + 2030 Pecan Street + Monroe + MD + 05502 + + 000000008 + 2025551212 + 987654321 + Pebble Y Yarn Mat + + 2030 Pecan Street + Monroe + MD + 02301 + + 200 + 500 + 300 + S + + + PAYE + + Payer 2 Name + Line 2 + + 000000009 + 987654321 + Pebble Y Yarn Mat + + 20 Override Street + Line Two + Monroe + MD + 70201 + + 4000 + 12000 + 500 + + + MD + 2000 + + 2000 + How Town + 2000 + + + + N + + + PAYE + + Payer Name + + + 2030 Pecan Street + Monroe + MD + 05502 + + 000000008 + 2025551212 + 987654321 + Pebble Y Yarn Mat + + 2030 Pecan Street + Monroe + MD + 02301 + + 200 + 444 + 300 + S + + + \ No newline at end of file diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_6.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_6.xml new file mode 100644 index 0000000000..1e2c4570ab --- /dev/null +++ b/spec/fixtures/state_file/fed_return_xmls/md/scenario_6.xml @@ -0,0 +1,229 @@ + + + + 2023 + 2023-01-01 + 2023-12-31 + 2022.2.100 + 1040 + + 123456789 + 987654321 + BEACHES & PEBBLES<YARN MAT + YARN + YARN + + 15 Cool St + Apt 12B + Monkton + MD + 21111 + + 5551234567 + + + + beaches@bigtoddsyarnmats.com + + + + + + 2 + Pebbles Yarn Mat + mat + towel + NO FINANCIAL PRODUCT + + + 123456789 + 001245767 + WSF + + Wharton State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + BEACHES T YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 2000 + 1000 + 50000 + 3100 + 50000 + 725 + + 414HSUB + 250 + + + + MD + 12345 + 1 + 1 + + 1 + 1 + Hammonton + + + + S + + + 123456789 + 001245768 + BTB + + Brendan T Byrne State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + PEBBLE Y YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 1690 + 1000 + 50000 + 3100 + 50000 + 725 + + 414HSUB + 250 + + + + MD + 12345 + 1 + 1 + + 1 + 1 + Hammonton + + + + S + + + 123456789 + 001245768 + BTB + + Brendan T Byrne State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + PEBBLE Y YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 1000 + 1000 + 50000 + 3100 + 50000 + 725 + + 414HSUB + 250 + + + + MD + 12345 + 1 + 1 + + 1 + 1 + Hammonton + + + + S + + + 987654321 + 001245768 + BTB + + Brendan T Byrne State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + PEBBLE Y YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 45000 + 1000 + 50000 + 3100 + 50000 + 725 + + 414HSUB + 250 + + + + MD + 12345 + 1 + 1 + + 1 + 1 + Hammonton + + + + S + + + 2500 + + + 40000 + + + \ No newline at end of file diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml new file mode 100644 index 0000000000..e4acf90acd --- /dev/null +++ b/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml @@ -0,0 +1,209 @@ + + + + 2023 + 2023-01-01 + 2023-12-31 + 2022.2.100 + 1040 + + 123456789 + 987654321 + BEACHES & PEBBLES<YARN MAT + YARN + YARN + + 15 Cool St + Apt 12B + Monkton + MD + 21111 + + 5551234567 + + + + beaches@bigtoddsyarnmats.com + + + + + + 2 + Pebbles Yarn Mat + mat + towel + NO FINANCIAL PRODUCT + + + 123456789 + 001245767 + WSF + + Wharton State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + BEACHES T YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 5000 + 1000 + 0 + 0 + 0 + 725 + + 414HSUB + 250 + + + + MD + 98765 + 0 + 500 + + 0 + 250 + Hammonton + + + + S + + + 987654321 + 001245768 + BTB + + Brendan T Byrne State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + PEBBLE Y YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 20000 + 1000 + 50000 + 3100 + 50000 + 725 + + 414HSUB + 250 + + + + MD + 12345 + 1 + 1 + + 1 + 1 + Hammonton + + + + S + + + 987654321 + 001245768 + BTB + + Brendan T Byrne State Forest + + + 31 Batsto Road + Hammonton + MD + 08037 + + PEBBLE Y YARN MAT + + 391 US-206 + Unit 73 + Hammonton + MD + 08037 + + 18000 + 1000 + 50000 + 3100 + 50000 + 725 + + 414HSUB + 250 + + + + MD + 12345 + 1 + 1 + + 1 + 1 + Hammonton + + + + S + + + PAYE + + Payer Name + + + 2030 Pecan Street + Monroe + MD + 05502 + + 000000008 + 2025551212 + 123456789 + Beaches T Yarn Mat + + 2030 Pecan Street + Monroe + MD + 02301 + + 200 + 10123 + 300 + S + + + 10000 + + + 200 + + + \ No newline at end of file From 1be6233ab877199f50e844dca41702e36eca059e Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 27 Nov 2024 10:59:51 -0800 Subject: [PATCH 29/30] fix scenario 9 w2 --- .../fixtures/state_file/fed_return_xmls/md/scenario_9.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml index e4acf90acd..4961566f25 100644 --- a/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml +++ b/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml @@ -70,11 +70,11 @@ MD 98765 - 0 - 500 + 1 + 1 - 0 - 250 + 1 + 1 Hammonton From 1f854ae443ff76ad4ef2fb0b30de1fde4c88c6e5 Mon Sep 17 00:00:00 2001 From: Martha Pidcock Date: Wed, 27 Nov 2024 13:50:23 -0800 Subject: [PATCH 30/30] Remove acceptance testing scenarios --- .../fed_return_jsons/md/scenario_10.json | 25 -- .../fed_return_jsons/md/scenario_5.json | 24 -- .../fed_return_jsons/md/scenario_6.json | 91 ------- .../fed_return_jsons/md/scenario_9.json | 48 ---- .../fed_return_xmls/md/scenario_10.xml | 164 ------------- .../fed_return_xmls/md/scenario_5.xml | 181 -------------- .../fed_return_xmls/md/scenario_6.xml | 229 ------------------ .../fed_return_xmls/md/scenario_9.xml | 209 ---------------- 8 files changed, 971 deletions(-) delete mode 100644 spec/fixtures/state_file/fed_return_jsons/md/scenario_10.json delete mode 100644 spec/fixtures/state_file/fed_return_jsons/md/scenario_5.json delete mode 100644 spec/fixtures/state_file/fed_return_jsons/md/scenario_6.json delete mode 100644 spec/fixtures/state_file/fed_return_jsons/md/scenario_9.json delete mode 100644 spec/fixtures/state_file/fed_return_xmls/md/scenario_10.xml delete mode 100644 spec/fixtures/state_file/fed_return_xmls/md/scenario_5.xml delete mode 100644 spec/fixtures/state_file/fed_return_xmls/md/scenario_6.xml delete mode 100644 spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml diff --git a/spec/fixtures/state_file/fed_return_jsons/md/scenario_10.json b/spec/fixtures/state_file/fed_return_jsons/md/scenario_10.json deleted file mode 100644 index 0fdb72a57d..0000000000 --- a/spec/fixtures/state_file/fed_return_jsons/md/scenario_10.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "familyAndHousehold": [], - "filers": [ - { - "firstName": "Beaches", - "middleInitial": "T", - "lastName": "Yarn Mat", - "dateOfBirth": "1950-01-01", - "isPrimaryFiler": true, - "tin": "123-45-6789", - "educatorExpenses": "200.00", - "hsaTotalDeductibleAmount": "200.00" - }, - { - "firstName": "Pebble", - "middleInitial": "Y", - "lastName": "Yarn Mat", - "dateOfBirth": "1950-01-01", - "isPrimaryFiler": false, - "tin": "987-65-4321", - "educatorExpenses": "100.00" - } - ], - "interestReports": [] -} diff --git a/spec/fixtures/state_file/fed_return_jsons/md/scenario_5.json b/spec/fixtures/state_file/fed_return_jsons/md/scenario_5.json deleted file mode 100644 index b02453a59d..0000000000 --- a/spec/fixtures/state_file/fed_return_jsons/md/scenario_5.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "familyAndHousehold": [], - "filers": [ - { - "firstName": "Beaches", - "middleInitial": "T", - "lastName": "Yarn Mat", - "dateOfBirth": "1950-01-01", - "isPrimaryFiler": true, - "tin": "123-45-6789", - "form1099GsTotal": "400.00", - "hsaTotalDeductibleAmount": "5998.00" - }, - { - "firstName": "Pebble", - "middleInitial": "Y", - "lastName": "Yarn Mat", - "dateOfBirth": "1950-01-01", - "isPrimaryFiler": false, - "tin": "987-65-4321", - "hsaTotalDeductibleAmount": "1000.00" - } - ] -} diff --git a/spec/fixtures/state_file/fed_return_jsons/md/scenario_6.json b/spec/fixtures/state_file/fed_return_jsons/md/scenario_6.json deleted file mode 100644 index a9443cf7dd..0000000000 --- a/spec/fixtures/state_file/fed_return_jsons/md/scenario_6.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "familyAndHousehold": [], - "filers": [ - { - "firstName": "Beaches", - "middleInitial": "T", - "lastName": "Yarn Mat", - "dateOfBirth": "1950-01-01", - "isPrimaryFiler": true, - "tin": "123-45-6789", - "educatorExpenses": "100.00" - }, - { - "firstName": "Pebble", - "middleInitial": "Y", - "lastName": "Yarn Mat", - "dateOfBirth": "1950-01-01", - "isPrimaryFiler": false, - "tin": "987-65-4321", - "educatorExpenses": "200.00" - } - ], - "interestReports": [ - { - "has1099": true, - "taxExemptAndTaxCreditBondCusipNo": null, - "interestOnGovernmentBonds": "222.00", - "payerTin": "00-4321234", - "recipientTin": "123-45-6789", - "payer": "Vienna Fund", - "no1099Amount": null, - "taxWithheld": "100.00", - "1099Amount": "888.00" - }, - { - "has1099": true, - "taxExemptAndTaxCreditBondCusipNo": null, - "interestOnGovernmentBonds": null, - "payerTin": "00-4321234", - "recipientTin": "123-45-6789", - "payer": "Vienna Fund", - "no1099Amount": null, - "taxWithheld": "100.00", - "1099Amount": "10.00" - }, - { - "has1099": false, - "taxExemptAndTaxCreditBondCusipNo": null, - "interestOnGovernmentBonds": null, - "payerTin": "00-4321234", - "recipientTin": "123-45-6789", - "payer": "Vienna Fund", - "no1099Amount": "10.00", - "taxWithheld": "100.00", - "1099Amount": null - }, - { - "has1099": true, - "taxExemptAndTaxCreditBondCusipNo": null, - "interestOnGovernmentBonds": "100.00", - "payerTin": "00-4321234", - "recipientTin": "987-65-4321", - "payer": "Vienna Fund", - "no1099Amount": null, - "taxWithheld": "100.00", - "1099Amount": "900.00" - }, - { - "has1099": true, - "taxExemptAndTaxCreditBondCusipNo": null, - "interestOnGovernmentBonds": null, - "payerTin": "00-4321234", - "recipientTin": "987-65-4321", - "payer": "Vienna Fund", - "no1099Amount": null, - "taxWithheld": "100.00", - "1099Amount": "1500.00" - }, - { - "has1099": false, - "taxExemptAndTaxCreditBondCusipNo": null, - "interestOnGovernmentBonds": null, - "payerTin": "00-4321234", - "recipientTin": "987-65-4321", - "payer": "Vienna Fund", - "no1099Amount": "50.00", - "taxWithheld": "100.00", - "1099Amount": null - } - ] -} diff --git a/spec/fixtures/state_file/fed_return_jsons/md/scenario_9.json b/spec/fixtures/state_file/fed_return_jsons/md/scenario_9.json deleted file mode 100644 index d36f9413a9..0000000000 --- a/spec/fixtures/state_file/fed_return_jsons/md/scenario_9.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "familyAndHousehold": [], - "filers": [ - { - "firstName": "Beaches", - "middleInitial": "T", - "lastName": "Yarn Mat", - "dateOfBirth": "1950-01-01", - "isPrimaryFiler": true, - "tin": "123-45-6789", - "form1099GsTotal": "1200.00", - "hsaTotalDeductibleAmount": "4000.00" - }, - { - "firstName": "Pebble", - "middleInitial": "Y", - "lastName": "Yarn Mat", - "dateOfBirth": "1950-01-01", - "isPrimaryFiler": false, - "tin": "987-65-4321", - "educatorExpenses": "100.00" - } - ], - "interestReports": [ - { - "has1099": true, - "taxExemptAndTaxCreditBondCusipNo": null, - "interestOnGovernmentBonds": "222.00", - "payerTin": "00-4321234", - "recipientTin": "123-45-6789", - "payer": "Vienna Fund", - "no1099Amount": null, - "taxWithheld": "100.00", - "1099Amount": "2555.00" - }, - { - "has1099": true, - "taxExemptAndTaxCreditBondCusipNo": null, - "interestOnGovernmentBonds": "100.00", - "payerTin": "00-4321234", - "recipientTin": "987-65-4321", - "payer": "Vienna Fund", - "no1099Amount": null, - "taxWithheld": "100.00", - "1099Amount": "444.00" - } - ] -} diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_10.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_10.xml deleted file mode 100644 index 3902a8f821..0000000000 --- a/spec/fixtures/state_file/fed_return_xmls/md/scenario_10.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - 2023 - 2023-01-01 - 2023-12-31 - 2022.2.100 - 1040 - - 123456789 - 987654321 - BEACHES & PEBBLES<YARN MAT - YARN - YARN - - 15 Cool St - Apt 12B - Monkton - MD - 21111 - - 5551234567 - - - - beaches@bigtoddsyarnmats.com - - - - - - 2 - Pebbles Yarn Mat - false - mat - towel - NO FINANCIAL PRODUCT - - - 123456789 - 001245767 - WSF - - Wharton State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - BEACHES T YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 1000 - 1000 - 50000 - 3100 - 0 - 725 - - 414HSUB - 250 - - - - MD - 98765 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - 987654321 - 001245768 - BTB - - Brendan T Byrne State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - PEBBLE Y YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 20000 - 1000 - 50000 - 3100 - 50000 - 725 - - 414HSUB - 250 - - - - MD - 12345 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - PAYE - - Payer Name - - - 2030 Pecan Street - Monroe - MD - 05502 - - 000000008 - 2025551212 - 123456789 - Beaches T Yarn Mat - - 2030 Pecan Street - Monroe - MD - 02301 - - 200 - 10123 - 300 - S - - - 700 - - - 2000 - - - \ No newline at end of file diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_5.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_5.xml deleted file mode 100644 index e3c5ca7cf6..0000000000 --- a/spec/fixtures/state_file/fed_return_xmls/md/scenario_5.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - 2023 - 2023-01-01 - 2023-12-31 - 2022.2.100 - 1040 - - 123456789 - 987654321 - BEACHES & PEBBLES<YARN MAT - YARN - YARN - - 15 Cool St - Apt 12B - Monkton - MD - 21111 - - 5551234567 - - - - beaches@bigtoddsyarnmats.com - - - - - - 2 - Pebbles Yarn Mat - mat - towel - NO FINANCIAL PRODUCT - - - PAYE - - Payer Name - - - 2030 Pecan Street - Monroe - MD - 05502 - - 000000008 - 2025551212 - 123456789 - Beaches T Yarn Mat - - 2030 Pecan Street - Monroe - MD - 02301 - - 200 - 200 - 300 - S - - - PAYE - - Payer 2 Name - Line 2 - - 000000009 - 123456789 - Beaches T Yarn Mat - - 20 Override Street - Line Two - Monroe - MD - 70201 - - 200 - 200 - 500 - - - MD - 2000 - - 2000 - How Town - 2000 - - - - N - - - PAYE - - Payer Name - - - 2030 Pecan Street - Monroe - MD - 05502 - - 000000008 - 2025551212 - 987654321 - Pebble Y Yarn Mat - - 2030 Pecan Street - Monroe - MD - 02301 - - 200 - 500 - 300 - S - - - PAYE - - Payer 2 Name - Line 2 - - 000000009 - 987654321 - Pebble Y Yarn Mat - - 20 Override Street - Line Two - Monroe - MD - 70201 - - 4000 - 12000 - 500 - - - MD - 2000 - - 2000 - How Town - 2000 - - - - N - - - PAYE - - Payer Name - - - 2030 Pecan Street - Monroe - MD - 05502 - - 000000008 - 2025551212 - 987654321 - Pebble Y Yarn Mat - - 2030 Pecan Street - Monroe - MD - 02301 - - 200 - 444 - 300 - S - - - \ No newline at end of file diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_6.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_6.xml deleted file mode 100644 index 1e2c4570ab..0000000000 --- a/spec/fixtures/state_file/fed_return_xmls/md/scenario_6.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - 2023 - 2023-01-01 - 2023-12-31 - 2022.2.100 - 1040 - - 123456789 - 987654321 - BEACHES & PEBBLES<YARN MAT - YARN - YARN - - 15 Cool St - Apt 12B - Monkton - MD - 21111 - - 5551234567 - - - - beaches@bigtoddsyarnmats.com - - - - - - 2 - Pebbles Yarn Mat - mat - towel - NO FINANCIAL PRODUCT - - - 123456789 - 001245767 - WSF - - Wharton State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - BEACHES T YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 2000 - 1000 - 50000 - 3100 - 50000 - 725 - - 414HSUB - 250 - - - - MD - 12345 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - 123456789 - 001245768 - BTB - - Brendan T Byrne State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - PEBBLE Y YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 1690 - 1000 - 50000 - 3100 - 50000 - 725 - - 414HSUB - 250 - - - - MD - 12345 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - 123456789 - 001245768 - BTB - - Brendan T Byrne State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - PEBBLE Y YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 1000 - 1000 - 50000 - 3100 - 50000 - 725 - - 414HSUB - 250 - - - - MD - 12345 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - 987654321 - 001245768 - BTB - - Brendan T Byrne State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - PEBBLE Y YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 45000 - 1000 - 50000 - 3100 - 50000 - 725 - - 414HSUB - 250 - - - - MD - 12345 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - 2500 - - - 40000 - - - \ No newline at end of file diff --git a/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml b/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml deleted file mode 100644 index 4961566f25..0000000000 --- a/spec/fixtures/state_file/fed_return_xmls/md/scenario_9.xml +++ /dev/null @@ -1,209 +0,0 @@ - - - - 2023 - 2023-01-01 - 2023-12-31 - 2022.2.100 - 1040 - - 123456789 - 987654321 - BEACHES & PEBBLES<YARN MAT - YARN - YARN - - 15 Cool St - Apt 12B - Monkton - MD - 21111 - - 5551234567 - - - - beaches@bigtoddsyarnmats.com - - - - - - 2 - Pebbles Yarn Mat - mat - towel - NO FINANCIAL PRODUCT - - - 123456789 - 001245767 - WSF - - Wharton State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - BEACHES T YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 5000 - 1000 - 0 - 0 - 0 - 725 - - 414HSUB - 250 - - - - MD - 98765 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - 987654321 - 001245768 - BTB - - Brendan T Byrne State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - PEBBLE Y YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 20000 - 1000 - 50000 - 3100 - 50000 - 725 - - 414HSUB - 250 - - - - MD - 12345 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - 987654321 - 001245768 - BTB - - Brendan T Byrne State Forest - - - 31 Batsto Road - Hammonton - MD - 08037 - - PEBBLE Y YARN MAT - - 391 US-206 - Unit 73 - Hammonton - MD - 08037 - - 18000 - 1000 - 50000 - 3100 - 50000 - 725 - - 414HSUB - 250 - - - - MD - 12345 - 1 - 1 - - 1 - 1 - Hammonton - - - - S - - - PAYE - - Payer Name - - - 2030 Pecan Street - Monroe - MD - 05502 - - 000000008 - 2025551212 - 123456789 - Beaches T Yarn Mat - - 2030 Pecan Street - Monroe - MD - 02301 - - 200 - 10123 - 300 - S - - - 10000 - - - 200 - - - \ No newline at end of file