diff --git a/app/lib/efile/az/az140_calculator.rb b/app/lib/efile/az/az140_calculator.rb index efc57d7d81..d9a5393f7c 100644 --- a/app/lib/efile/az/az140_calculator.rb +++ b/app/lib/efile/az/az140_calculator.rb @@ -34,6 +34,8 @@ def calculate set_line(:AZ140_LINE_14, :calculate_line_14) set_line(:AZ140_LINE_19, :calculate_line_19) set_line(:AZ140_LINE_28, @direct_file_data, :interest_reported_amount) + set_line(:AZ140_LINE_29A, :calculate_line_29A) + set_line(:AZ140_LINE_29B, :calculate_line_29B) set_line(:AZ140_LINE_30, @direct_file_data, :fed_taxable_ssb) set_line(:AZ140_LINE_31, :calculate_line_31) set_line(:AZ140_LINE_32, :calculate_line_32) @@ -94,6 +96,23 @@ def calculate_line_19 line_or_zero(:AZ140_LINE_14) end + def calculate_line_29A + # total subtraction amount for pensions up to the maximum of $2,500 each for primary and spouse + pension_amount = 0 + if @intake.primary_received_pension_yes? + pension_amount += [@intake.primary_received_pension_amount.round, 2_500].min + end + if filing_status_mfj? && @intake.spouse_received_pension_yes? + pension_amount += [@intake.spouse_received_pension_amount.round, 2_500].min + end + pension_amount + end + + def calculate_line_29B + # total subtraction amount for uniformed services + @intake.received_military_retirement_payment_yes? ? @intake.received_military_retirement_payment_amount.round : 0 + end + def calculate_line_31 @intake.tribal_member_yes? ? @intake.tribal_wages : 0 end @@ -103,7 +122,8 @@ def calculate_line_32 end def calculate_line_35 - subtractions = 0 + # Subtotal after additions and subtractions + subtractions = line_or_zero(:AZ140_LINE_29A) + line_or_zero(:AZ140_LINE_29B) (30..32).each do |line_num| subtractions += line_or_zero("AZ140_LINE_#{line_num}") end @@ -213,7 +233,7 @@ def calculate_line_50 wrksht_2_line_5 = 120 end - #wrksheet 2 + # worksheet 2 wrksht_2_line_3 = @dependent_count + wrksht_2_line_2 wrksht_2_line_4 = wrksht_2_line_3 * 40 [wrksht_2_line_4, wrksht_2_line_5].min @@ -224,17 +244,15 @@ def calculate_line_52 [line_52_value, 0].max end + # TODO: test combination of multiple forms (w2, 1099G, 1099R) in the spec for this calculator def calculate_line_53 - # zzz - total_state_taxes_withheld = @direct_file_data.total_state_tax_withheld - state_file_1099gs = @intake.state_file1099_gs - state_file_1099gs.each do |state_file_1099g| - total_state_taxes_withheld += state_file_1099g.state_income_tax_withheld - end - total_state_taxes_withheld + # AZ income tax withheld + # sum of tax withheld from all income documents: W-2, 1099-R, 1099-G, 1099-INT + @direct_file_data.total_w2_state_tax_withheld + + @intake.state_file1099_gs.sum(&:state_income_tax_withheld) + + @direct_file_data.total_1099r_state_tax_withheld end - def calculate_line_56 if @intake.disqualified_from_excise_credit_df? || @intake.disqualified_from_excise_credit_fyst? 0 diff --git a/app/lib/efile/line_data.yml b/app/lib/efile/line_data.yml index c828c16c7e..95e15a1d73 100644 --- a/app/lib/efile/line_data.yml +++ b/app/lib/efile/line_data.yml @@ -13,9 +13,13 @@ AZ140_LINE_12: AZ140_LINE_14: label: '14 Modified federal adjusted gross income. Subtract line 13 from line 12.' AZ140_LINE_19: - label: '19 Subtotal: Add lines 14 through 18 and enter the total .' + label: '19 Subtotal: Add lines 14 through 18 and enter the total.' AZ140_LINE_28: label: '28 Interest on US obligations such as Savings Bonds and Treasury Bills included in the AZ Column' +AZ140_LINE_29A: + label: '29A total subtraction amount for pensions up to the maximum of $2,500 each for primary and spouse.' +AZ140_LINE_29B: + label: "29B Total subtraction amount for benefits, annuities, and pensions for retired/retainer pay of uniformed services" AZ140_LINE_30: label: '30 U.S. Social Security or Railroad Retirement Act benefits included as income on your federal return (taxable amount)' AZ140_LINE_31: diff --git a/app/lib/efile/ny/it201.rb b/app/lib/efile/ny/it201.rb index 800cd8692d..27d512b016 100644 --- a/app/lib/efile/ny/it201.rb +++ b/app/lib/efile/ny/it201.rb @@ -326,16 +326,14 @@ def calculate_line_69a end def calculate_line_72 - total_state_taxes_withheld = @direct_file_data.total_state_tax_withheld - state_file_1099gs = @intake.state_file1099_gs - state_file_1099gs.each do |state_file_1099g| - total_state_taxes_withheld += state_file_1099g.state_income_tax_withheld - end - total_state_taxes_withheld + # NY income tax withheld + # sum of tax withheld from all income documents + @direct_file_data.total_w2_state_tax_withheld + + @intake.state_file1099_gs.sum(&:state_income_tax_withheld) end def calculate_line_73 - @direct_file_data.total_local_tax_withheld + @direct_file_data.total_w2_local_tax_withheld end def calculate_line_76 diff --git a/app/lib/pdf_filler/az140_pdf.rb b/app/lib/pdf_filler/az140_pdf.rb index 213c7e858f..2cb8d34f6c 100644 --- a/app/lib/pdf_filler/az140_pdf.rb +++ b/app/lib/pdf_filler/az140_pdf.rb @@ -82,10 +82,12 @@ def hash_for_pdf end answers.merge!({ - "19" => @xml_document.at('AzAdjSubtotal')&.text, "12" => @xml_document.at('FedAdjGrossIncome')&.text, "14" => @xml_document.at('ModFedAdjGrossInc')&.text, + "19" => @xml_document.at('AzAdjSubtotal')&.text, "28" => @xml_document.at("Subtractions IntUSObligations")&.text, + "29a" => @xml_document.at('ExecFedStateLocGovPen')&.text, + "29b" => @xml_document.at('SubExclBenAnnPen')&.text, "30" => @xml_document.at('USSSRailRoadBnft')&.text, "31" => @xml_document.at('WageAmIndian')&.text, "32" => @xml_document.at('CompNtnlGrdArmdFrcs')&.text, diff --git a/app/lib/submission_builder/ty2022/states/az/az_return_xml.rb b/app/lib/submission_builder/ty2022/states/az/az_return_xml.rb index 3679ea7635..e086aa6386 100644 --- a/app/lib/submission_builder/ty2022/states/az/az_return_xml.rb +++ b/app/lib/submission_builder/ty2022/states/az/az_return_xml.rb @@ -108,6 +108,8 @@ def documents_wrapper xml.AzAdjSubtotal calculated_fields.fetch(:AZ140_LINE_19) xml.Subtractions do add_non_zero_value(xml, :IntUSObligations, :AZ140_LINE_28) + xml.ExecFedStateLocGovPen calculated_fields.fetch(:AZ140_LINE_29A) + xml.SubExclBenAnnPen calculated_fields.fetch(:AZ140_LINE_29B) xml.USSSRailRoadBnft calculated_fields.fetch(:AZ140_LINE_30) xml.WageAmIndian calculated_fields.fetch(:AZ140_LINE_31) xml.CompNtnlGrdArmdFrcs calculated_fields.fetch(:AZ140_LINE_32) diff --git a/app/models/df_1099r_accessor.rb b/app/models/df_1099r_accessor.rb index 398a9db169..81584365d4 100644 --- a/app/models/df_1099r_accessor.rb +++ b/app/models/df_1099r_accessor.rb @@ -2,10 +2,11 @@ class Df1099rAccessor < DfXmlAccessor SELECTORS = { PayerNameControlTxt: "PayerNameControlTxt", PayerName: "PayerName BusinessNameLine1Txt", - AddressLine1Txt: "PayerUSAddress AddressLine1Txt", - CityNm: "PayerUSAddress CityNm", - StateAbbreviationCd: "PayerUSAddress StateAbbreviationCd", - ZIPCd: "PayerUSAddress ZIPCd", + PayerAddressLine1Txt: "PayerUSAddress AddressLine1Txt", + PayerAddressLine2Txt: "PayerUSAddress AddressLine2Txt", + PayerCityNm: "PayerUSAddress CityNm", + PayerStateAbbreviationCd: "PayerUSAddress StateAbbreviationCd", + PayerZIPCd: "PayerUSAddress ZIPCd", PayerEIN: "PayerEIN", PhoneNum: "PhoneNum", GrossDistributionAmt: "GrossDistributionAmt", @@ -13,6 +14,10 @@ class Df1099rAccessor < DfXmlAccessor FederalIncomeTaxWithheldAmt: "FederalIncomeTaxWithheldAmt", F1099RDistributionCd: "F1099RDistributionCd", StandardOrNonStandardCd: "StandardOrNonStandardCd", + StateTaxWithheldAmt: "F1099RStateLocalTaxGrp F1099RStateTaxGrp StateTaxWithheldAmt", + StateAbbreviationCd: "F1099RStateLocalTaxGrp F1099RStateTaxGrp StateAbbreviationCd", + PayerStateIdNumber: "F1099RStateLocalTaxGrp F1099RStateTaxGrp PayerStateIdNumber", + StateDistributionAmt: "F1099RStateLocalTaxGrp F1099RStateTaxGrp StateDistributionAmt", } def self.selectors diff --git a/app/models/direct_file_data.rb b/app/models/direct_file_data.rb index 226058a3b9..c4642b6331 100644 --- a/app/models/direct_file_data.rb +++ b/app/models/direct_file_data.rb @@ -260,22 +260,16 @@ def fed_total_adjustments=(value) write_df_xml_value(__method__, value) end - def total_state_tax_withheld - total = 0 - parsed_xml.css('IRSW2').map do |w2| - amt = w2.at('StateIncomeTaxAmt')&.text.to_i - total += amt - end - total + def total_1099r_state_tax_withheld + form1099rs.sum(&:StateTaxWithheldAmt) end - def total_local_tax_withheld - total = 0 - parsed_xml.css('IRSW2').map do |w2| - amt = w2.at('LocalIncomeTaxAmt')&.text.to_i - total += amt - end - total + def total_w2_state_tax_withheld + w2s.sum(&:StateIncomeTaxAmt) + end + + def total_w2_local_tax_withheld + w2s.sum(&:LocalIncomeTaxAmt) end def fed_ctc_claimed @@ -758,57 +752,57 @@ def attributes class Df1099R < Df1099rAccessor; end def attributes - [ - :tax_return_year, - :filing_status, - :primary_ssn, - :primary_occupation, - :spouse_ssn, - :spouse_occupation, - :mailing_city, - :mailing_street, - :mailing_apartment, - :mailing_zip, - :cell_phone_number, - :tax_payer_email, - :total_state_tax_withheld, - :fed_tax_amt, - :fed_agi, - :fed_wages, - :fed_wages_salaries_tips, - :fed_taxable_income, - :fed_total_adjustments, - :fed_taxable_ssb, - :fed_ssb, - :fed_eic, - :fed_refund_amt, - :fed_ctc, - :fed_qualify_child, - :fed_puerto_rico_income_exclusion_amount, - :total_exempt_primary_spouse, - :fed_irs_1040_nr, - :fed_unemployment, - :fed_housing_deduction_amount, - :fed_gross_income_exclusion_amount, - :fed_total_income_exclusion_amount, - :fed_foreign_tax_credit_amount, - :fed_credit_for_child_and_dependent_care_amount, - :fed_education_credit_amount, - :fed_retirement_savings_contribution_credit_amount, - :fed_energy_efficiency_home_improvement_credit_amount, - :fed_credit_for_elderly_or_disabled_amount, - :fed_clean_vehicle_personal_use_credit_amount, - :fed_total_reporting_year_tax_increase_or_decrease_amount, - :fed_previous_owned_clean_vehicle_credit_amount, - :fed_calculated_difference_amount, - :fed_nontaxable_combat_pay_amount, - :fed_total_earned_income_amount, - :fed_residential_clean_energy_credit_amount, - :fed_mortgage_interest_credit_amount, - :fed_adoption_credit_amount, - :fed_dc_homebuyer_credit_amount, - :fed_adjustments_claimed, - :fed_taxable_pensions + %i[ + tax_return_year + filing_status + primary_ssn + primary_occupation + spouse_ssn + spouse_occupation + mailing_city + mailing_street + mailing_apartment + mailing_zip + cell_phone_number + tax_payer_email + total_w2_state_tax_withheld + fed_tax_amt + fed_agi + fed_wages + fed_wages_salaries_tips + fed_taxable_income + fed_total_adjustments + fed_taxable_ssb + fed_ssb + fed_eic + fed_refund_amt + fed_ctc + fed_qualify_child + fed_puerto_rico_income_exclusion_amount + total_exempt_primary_spouse + fed_irs_1040_nr + fed_unemployment + fed_housing_deduction_amount + fed_gross_income_exclusion_amount + fed_total_income_exclusion_amount + fed_foreign_tax_credit_amount + fed_credit_for_child_and_dependent_care_amount + fed_education_credit_amount + fed_retirement_savings_contribution_credit_amount + fed_energy_efficiency_home_improvement_credit_amount + fed_credit_for_elderly_or_disabled_amount + fed_clean_vehicle_personal_use_credit_amount + fed_total_reporting_year_tax_increase_or_decrease_amount + fed_previous_owned_clean_vehicle_credit_amount + fed_calculated_difference_amount + fed_nontaxable_combat_pay_amount + fed_total_earned_income_amount + fed_residential_clean_energy_credit_amount + fed_mortgage_interest_credit_amount + fed_adoption_credit_amount + fed_dc_homebuyer_credit_amount + fed_adjustments_claimed + fed_taxable_pensions ].each_with_object({}) do |field, hsh| hsh[field] = send(field) end diff --git a/app/views/state_file/questions/federal_info/_df_1099r.html.erb b/app/views/state_file/questions/federal_info/_df_1099r.html.erb index 957aeecf34..6c0a3aac07 100644 --- a/app/views/state_file/questions/federal_info/_df_1099r.html.erb +++ b/app/views/state_file/questions/federal_info/_df_1099r.html.erb @@ -6,16 +6,20 @@ <%= f.state_file_nested_xml_field :PayerNameControlTxt %> <%= f.state_file_nested_xml_field :PayerName %> - <%= f.state_file_nested_xml_field :AddressLine1Txt %> - <%= f.state_file_nested_xml_field :CityNm %> - <%= f.state_file_nested_xml_field :StateAbbreviationCd %> - <%= f.state_file_nested_xml_field :ZIPCd %> + <%= f.state_file_nested_xml_field :PayerAddressLine1Txt %> + <%= f.state_file_nested_xml_field :PayerCityNm %> + <%= f.state_file_nested_xml_field :PayerStateAbbreviationCd %> + <%= f.state_file_nested_xml_field :PayerZIPCd %> <%= f.state_file_nested_xml_field :PayerEIN %> <%= f.state_file_nested_xml_field :PhoneNum %> <%= f.state_file_nested_xml_field :GrossDistributionAmt %> <%= f.state_file_nested_xml_field :TaxableAmt %> <%= f.state_file_nested_xml_field :FederalIncomeTaxWithheldAmt %> <%= f.state_file_nested_xml_field :F1099RDistributionCd %> + <%= f.state_file_nested_xml_field :StateTaxWithheldAmt %> + <%= f.state_file_nested_xml_field :StateAbbreviationCd %> + <%= f.state_file_nested_xml_field :PayerStateIdNumber %> + <%= f.state_file_nested_xml_field :StateDistributionAmt %>
<%= f.hidden_field :_destroy %> 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 4f4dea581b..ae9768c751 100644 --- a/app/views/state_file/questions/federal_info/edit.html.erb +++ b/app/views/state_file/questions/federal_info/edit.html.erb @@ -92,11 +92,6 @@ -
-

TODO ZONE: where do these things go?

- <%= f.state_file_qa_input_field :total_state_tax_withheld, "Total state tax withheld" %> -
- <%= f.continue %> <% end %> <% end %> diff --git a/spec/features/state_file/editing_df_xml_spec.rb b/spec/features/state_file/editing_df_xml_spec.rb index 966bf0f207..fc5221867d 100644 --- a/spec/features/state_file/editing_df_xml_spec.rb +++ b/spec/features/state_file/editing_df_xml_spec.rb @@ -74,16 +74,20 @@ fill_in "PayerName", with: "Rose Apothecary" fill_in "PayerNameControlTxt", with: "ROSEAPC" - fill_in "AddressLine1Txt", with: "123 Schit Street" - fill_in "CityNm", with: "Schitts Creek" - fill_in "StateAbbreviationCd", with: "AZ" - fill_in "ZIPCd", with: "43212" + fill_in "PayerAddressLine1Txt", with: "123 Schit Street" + fill_in "PayerCityNm", with: "Schitts Creek" + fill_in "PayerStateAbbreviationCd", with: "AZ" + fill_in "PayerZIPCd", with: "43212" fill_in "PayerEIN", with: "000000003" fill_in "PhoneNum", with: "3025551223" fill_in "GrossDistributionAmt", with: 3000 fill_in "TaxableAmt", with: 200 fill_in "FederalIncomeTaxWithheldAmt", with: 150 fill_in "F1099RDistributionCd", with: "8" + fill_in "StateTaxWithheldAmt", with: 20 + fill_in "StateAbbreviationCd", with: "NC" + fill_in "PayerStateIdNumber", with: "987654321" + fill_in "StateDistributionAmt", with: 200 click_on "Continue" @@ -103,15 +107,19 @@ expect(StateFileAzIntake.last.direct_file_data.fed_taxable_pensions).to eq 200 expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PayerName).to eq "Rose Apothecary" expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PayerNameControlTxt).to eq "ROSEAPC" - expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].AddressLine1Txt).to eq "123 Schit Street" - expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].CityNm).to eq "Schitts Creek" - expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].StateAbbreviationCd).to eq "AZ" - expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].ZIPCd).to eq "43212" + expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PayerAddressLine1Txt).to eq "123 Schit Street" + expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PayerCityNm).to eq "Schitts Creek" + expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PayerStateAbbreviationCd).to eq "AZ" + expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PayerZIPCd).to eq "43212" expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PayerEIN).to eq "000000003" expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PhoneNum).to eq "3025551223" expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].GrossDistributionAmt).to eq 3000 expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].TaxableAmt).to eq 200 expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].FederalIncomeTaxWithheldAmt).to eq 150 expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].F1099RDistributionCd).to eq "8" + expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].StateTaxWithheldAmt).to eq 20 + expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].StateAbbreviationCd).to eq "NC" + expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].PayerStateIdNumber).to eq "987654321" + expect(StateFileAzIntake.last.direct_file_data.form1099rs[0].StateDistributionAmt).to eq 200 end end diff --git a/spec/fixtures/state_file/fed_return_xmls/2023/az/alexis_hoh_w2_and_1099.xml b/spec/fixtures/state_file/fed_return_xmls/2023/az/alexis_hoh_w2_and_1099.xml index 4cb9cee60f..fb45133be1 100644 --- a/spec/fixtures/state_file/fed_return_xmls/2023/az/alexis_hoh_w2_and_1099.xml +++ b/spec/fixtures/state_file/fed_return_xmls/2023/az/alexis_hoh_w2_and_1099.xml @@ -214,6 +214,14 @@ 10000 3000 9 + + + 10 + AZ + 123456789 + 100 + + S diff --git a/spec/fixtures/state_file/fed_return_xmls/2023/az/richard_retirement_1099r.xml b/spec/fixtures/state_file/fed_return_xmls/2023/az/richard_retirement_1099r.xml index 92351e6b72..fa12d57d82 100644 --- a/spec/fixtures/state_file/fed_return_xmls/2023/az/richard_retirement_1099r.xml +++ b/spec/fixtures/state_file/fed_return_xmls/2023/az/richard_retirement_1099r.xml @@ -110,6 +110,14 @@ 1000 300 7 + + + 11 + NC + 111111111 + 111 + + S @@ -129,6 +137,14 @@ 500 200 6 + + + 22 + NC + 222222222 + 222 + + N diff --git a/spec/fixtures/state_file/persona_approved_outputs/2023/az/johnny_return.pdf b/spec/fixtures/state_file/persona_approved_outputs/2023/az/johnny_return.pdf index 86e49b42fb..ce6bf55cc7 100644 Binary files a/spec/fixtures/state_file/persona_approved_outputs/2023/az/johnny_return.pdf and b/spec/fixtures/state_file/persona_approved_outputs/2023/az/johnny_return.pdf differ diff --git a/spec/fixtures/state_file/persona_approved_outputs/2023/az/leslie_return.pdf b/spec/fixtures/state_file/persona_approved_outputs/2023/az/leslie_return.pdf index 032285e034..76d74ed426 100644 Binary files a/spec/fixtures/state_file/persona_approved_outputs/2023/az/leslie_return.pdf and b/spec/fixtures/state_file/persona_approved_outputs/2023/az/leslie_return.pdf differ diff --git a/spec/fixtures/state_file/persona_approved_outputs/2023/az/martha_return.pdf b/spec/fixtures/state_file/persona_approved_outputs/2023/az/martha_return.pdf index 96edf0e24a..85f00e2df8 100644 Binary files a/spec/fixtures/state_file/persona_approved_outputs/2023/az/martha_return.pdf and b/spec/fixtures/state_file/persona_approved_outputs/2023/az/martha_return.pdf differ diff --git a/spec/fixtures/state_file/persona_approved_outputs/2023/az/rory_return.pdf b/spec/fixtures/state_file/persona_approved_outputs/2023/az/rory_return.pdf index 239373fe3d..34d5b1fcca 100644 Binary files a/spec/fixtures/state_file/persona_approved_outputs/2023/az/rory_return.pdf and b/spec/fixtures/state_file/persona_approved_outputs/2023/az/rory_return.pdf differ diff --git a/spec/lib/efile/az/az140_calculator_spec.rb b/spec/lib/efile/az/az140_calculator_spec.rb index 37b0e4ae2f..ee6cc2882f 100644 --- a/spec/lib/efile/az/az140_calculator_spec.rb +++ b/spec/lib/efile/az/az140_calculator_spec.rb @@ -9,6 +9,26 @@ ) end + describe 'Line 53: AZ Income Tax Withheld' do + let(:intake) { + # alexis has $500 state tax withheld on a w2 & $10 state tax withheld on a 1099r + create(:state_file_az_intake, + raw_direct_file_data: StateFile::XmlReturnSampleService.new.read('az_alexis_hoh_w2_and_1099')) + } + let(:state_file1099_g) { + create(:state_file1099_g, intake: intake, state_income_tax_withheld: 100) + } + + before do + intake.state_file1099_gs.append(state_file1099_g) + end + + it 'sums the AZ tax withheld from w2s, 1099gs and 1099rs' do + instance.calculate + expect(instance.lines[:AZ140_LINE_53].value).to eq(610) + end + end + describe "Line 56: Increased Excise Tax Credit" do before do allow(intake).to receive(:disqualified_from_excise_credit_fyst?).and_return false diff --git a/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb b/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb index 88b3b31043..f1f6d69570 100644 --- a/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb +++ b/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb @@ -13,7 +13,7 @@ it "generates xml" do xml = Nokogiri::XML::Document.parse(described_class.build(submission).document.to_xml) expect(xml.at("FilingStatus").text).to eq('MarriedJoint') - expect(xml.document.root.namespaces).to include({"xmlns:efile"=>"http://www.irs.gov/efile", "xmlns"=>"http://www.irs.gov/efile"}) + expect(xml.document.root.namespaces).to include({ "xmlns:efile" => "http://www.irs.gov/efile", "xmlns" => "http://www.irs.gov/efile" }) expect(xml.document.at('AuthenticationHeader').to_s).to include('xmlns="http://www.irs.gov/efile"') expect(xml.document.at('ReturnHeaderState').to_s).to include('xmlns="http://www.irs.gov/efile"') end @@ -98,7 +98,7 @@ employer_state_id_num: "00123", state_income_tax_amt: "700", state_wages_amt: "2000", - ) + ) } it "prioritises state_file_w2s over w2s from the direct file xml, correctly updates & creates & deletes nodes" do @@ -115,7 +115,7 @@ end context "when there is a refund with banking info" do - let(:intake) { create(:state_file_az_refund_intake, was_incarcerated: "no", ssn_no_employment: "no", household_excise_credit_claimed: "no")} + let(:intake) { create(:state_file_az_refund_intake, was_incarcerated: "no", ssn_no_employment: "no", household_excise_credit_claimed: "no") } it "generates FinancialTransaction xml with correct RefundAmt" do xml = Nokogiri::XML::Document.parse(described_class.build(submission).document.to_xml) expect(xml.at("FinancialTransaction")).to be_present @@ -124,7 +124,7 @@ end context "when there is a payment owed with banking info" do - let(:intake) { create(:state_file_az_owed_intake)} + let(:intake) { create(:state_file_az_owed_intake) } it "generates FinancialTransaction xml with correct Amount" do xml = Nokogiri::XML::Document.parse(described_class.build(submission).document.to_xml) expect(xml.at("FinancialTransaction")).to be_present @@ -199,5 +199,28 @@ expect(xml.css("Subtractions IntUSObligations").text).to eq "100" end end + + context "when 1099-rs are present" do + let(:intake) do + create(:state_file_az_intake, + raw_direct_file_data: StateFile::XmlReturnSampleService.new.read('az_richard_retirement_1099r'), + filing_status: "married_filing_jointly", + primary_received_pension: "yes", + primary_received_pension_amount: 2000.6, + spouse_received_pension: "yes", + spouse_received_pension_amount: 2600, + received_military_retirement_payment: "yes", + received_military_retirement_payment_amount: 1000.1 + ) + end + + it "it calculates the total subtraction amounts" do + xml = Nokogiri::XML::Document.parse(described_class.build(submission).document.to_xml) + expect(xml.css('ExecFedStateLocGovPen').text).to eq "4501" + expect(xml.css('SubExclBenAnnPen').text).to eq "1000" + expect(xml.css('TotalSubtractions').text).to eq "114499" + expect(xml.css('AzIncTaxWithheld').text).to eq "33" + end + end end end \ No newline at end of file diff --git a/spec/models/direct_file_data_spec.rb b/spec/models/direct_file_data_spec.rb index 327b9785f7..0c0bc0f8ef 100644 --- a/spec/models/direct_file_data_spec.rb +++ b/spec/models/direct_file_data_spec.rb @@ -595,31 +595,31 @@ end end - describe "#AddressLine1Txt" do + describe "#PayerAddressLine1Txt" do it "returns the value" do - expect(first_1099r.AddressLine1Txt).to eq "2030 Pecan Street" - expect(second_1099r.AddressLine1Txt).to eq "2031 Pecan Street" + expect(first_1099r.PayerAddressLine1Txt).to eq "2030 Pecan Street" + expect(second_1099r.PayerAddressLine1Txt).to eq "2031 Pecan Street" end end - describe "#CityNm" do + describe "#PayerCityNm" do it "returns the value" do - expect(first_1099r.CityNm).to eq "Monroe" - expect(second_1099r.CityNm).to eq "Nonroe" + expect(first_1099r.PayerCityNm).to eq "Monroe" + expect(second_1099r.PayerCityNm).to eq "Nonroe" end end - describe "#StateAbbreviationCd" do + describe "#PayerStateAbbreviationCd" do it "returns the value" do - expect(first_1099r.StateAbbreviationCd).to eq "MA" - expect(second_1099r.StateAbbreviationCd).to eq "NA" + expect(first_1099r.PayerStateAbbreviationCd).to eq "MA" + expect(second_1099r.PayerStateAbbreviationCd).to eq "NA" end end - describe "#ZIPCd" do + describe "#PayerZIPCd" do it "returns the value" do - expect(first_1099r.ZIPCd).to eq "05502" - expect(second_1099r.ZIPCd).to eq "05503" + expect(first_1099r.PayerZIPCd).to eq "05502" + expect(second_1099r.PayerZIPCd).to eq "05503" end end @@ -671,5 +671,30 @@ expect(second_1099r.StandardOrNonStandardCd).to eq "N" end end + + describe "#StateTaxWithheldAmt" do + it "returns the value" do + expect(first_1099r.StateTaxWithheldAmt).to eq 11 + expect(second_1099r.StateTaxWithheldAmt).to eq 22 + end + end + describe "#StateAbbreviationCd" do + it "returns the value" do + expect(first_1099r.StateAbbreviationCd).to eq "NC" + expect(second_1099r.StateAbbreviationCd).to eq "NC" + end + end + describe "#PayerStateIdNumber" do + it "returns the value" do + expect(first_1099r.PayerStateIdNumber).to eq "111111111" + expect(second_1099r.PayerStateIdNumber).to eq "222222222" + end + end + describe "#StateDistributionAmt" do + it "returns the value" do + expect(first_1099r.StateDistributionAmt).to eq 111 + expect(second_1099r.StateDistributionAmt).to eq 222 + end + end end end