From 48faf3273890572fd79576b2d5fcb065cd9247b3 Mon Sep 17 00:00:00 2001 From: em barnard-shao <49880002+embarnard@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:26:17 -0400 Subject: [PATCH] Add 1099r pdf, xml and tax calculations (#4707) Co-authored-by: Mike Rotondo Co-authored-by: Martha Pidcock --- app/lib/efile/az/az140_calculator.rb | 38 ++++-- app/lib/efile/line_data.yml | 6 +- app/lib/efile/ny/it201.rb | 12 +- app/lib/pdf_filler/az140_pdf.rb | 4 +- .../ty2022/states/az/az_return_xml.rb | 2 + app/models/df_1099r_accessor.rb | 13 +- app/models/direct_file_data.rb | 124 +++++++++--------- .../questions/federal_info/_df_1099r.html.erb | 12 +- .../questions/federal_info/edit.html.erb | 5 - .../state_file/editing_df_xml_spec.rb | 24 ++-- .../2023/az/alexis_hoh_w2_and_1099.xml | 8 ++ .../2023/az/richard_retirement_1099r.xml | 16 +++ .../2023/az/johnny_return.pdf | Bin 757110 -> 765713 bytes .../2023/az/leslie_return.pdf | Bin 741386 -> 749976 bytes .../2023/az/martha_return.pdf | Bin 748979 -> 757574 bytes .../2023/az/rory_return.pdf | Bin 739199 -> 747788 bytes spec/lib/efile/az/az140_calculator_spec.rb | 20 +++ .../ty2022/states/az/az_return_xml_spec.rb | 31 ++++- spec/models/direct_file_data_spec.rb | 49 +++++-- 19 files changed, 243 insertions(+), 121 deletions(-) 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 86e49b42fbf0263b65dce070349006559569dc6c..ce6bf55cc7bf7d85339a7308a1fde9f70e3b6845 100644 GIT binary patch delta 4988 zcmds5&2HO95Jr>!(sfbvR^+l(5yUP^?k@jH$OAO4iS zoxC--URAP}@aHV(KxH@gDQyXR4`5 zmZ2g_4T%!@?2qqmemute!)E-V&+wCu-)1pxY{-_oi5r|$4uUYoUu}@hQfZw9K6h22 z23S4sw3#4rr!Br)a5@PHC@Y;FU(RdAgitk!C`i+E$x^04Sk}QR_nWV9ACgGt{yXJy zn#e4VXcIeoknZik3;j;ehV8CXb3!j8AWcpqtc5`g?0c*dB1KD%W_llU|F)gD6EB1j~Bue zq0VC0cVm}Rcq#4SUAN5!Xv$5FunO#M*j}*7%ObT|jhGvE!oYE3w&B<^k=3)GZmoUd z;Di%K8-2eOABl(Vv5OQ*mgG%b5B;1tv8YT{2#1P9y+g>IO}rb0{?KF5+3&a3=wdjz zf`7n*cKjSF#x!P!__Y3DT6tMyrP3e<7kleM@$RVadPgiqP1f!NTZO-W{jGpH{#N0M zRwwm-l|Ap=JB`@>>BEM1dgNJt;ciJNj>h(=*Y821(5Tl92KH#H;6foY8}^)x3uwee z;-jrXnKRJS`Yx)55kr7M4 zenyBJcAMca-YOJ0(rl%X_4+fQU?3$?O5Ql^;gQ?NR3dnl7M$-2El>gmC@CwId~c@H zA4c6IAm78R%X%z`2cSnYy>aU0%*T3traSjC=VY&kXDI;PBAkt#6eHtRSK=iq5=*3{ zL1kN3Y)uo1VG~ls=Om{oO7Q1K!l)63-O~B0&MBu7^8_c#Q1qSFi$xFQ232kNOGo&XE+eM#CCLj%U!+_bBz zRKn3SA`t}tUm$}>mZc*qOO}3sc?ZWkGemLP0ht=EyK&SRoqhJ#jZeqWs}I6qQoeFD4TdV`XsV&Za01piC#Vr=+rcNpuy)8qg_3agt<1*A$hm-@d*5 HsJ8wuBiApd delta 31 mcmbPuPw(3-y@nRX7N!>F7M2#)7Pc1l7LFFq7OpMaWxW8wSql9C 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 032285e034d07d48f58a087e6daaf7661dc2e634..76d74ed426c88864948ba15e42caac4f7f863c79 100644 GIT binary patch delta 4963 zcmds5J#X7a7)IlMg@u5kTc=)C1hIjVcgIhWpczP}ganBa#}=BPMh1#JDY7L}p(tDN zq5{>_Kj4mCyBFxtp<~x}?$V$?pnsr4-=ipra^%FZouvoZKE7Yid+)t>@N?h&Ab$V1 z_|4><$+gMaytm9t$nsK%jPSxq$<%CY0i;n)j}KC-GQQ3Lq7^S zVH>8~Zq1GSnE+{gl|1WO6ejjv8_HdYkfNr0GOfKfoqz4QO;F72A3tdBL$M*EyL$|K zM$*zaFmSEIy20S&$8Xne{QU19!taIgqO4%3FA^^Maa4=q9{1<#*uiy{c!8IATvAFU z+g_Uu&@_j1x3)mtjoM2wjYZ6@n0ZMj3SBQ@>#ijeSv~pfFX0mxrW6-X!Ga2HuXNVCb{>Wc`IemzTq{%-ZB03){(4q|lNv zZ@0(wd($SHt;}%-38dI72==W}-}4Vxf|{(|2{()X{PJrNb%M>}Bdt#A{Vn#ibNe`E zyT|t%{_%lt2E|*BV2{SusMqg7q0p$;4F}d}v*~5u2S;HQ4f#2KBf}EtGr-;S9pOFD8NZs=@j^LpZ+lJrV9#u%(|?{ z!ejt`bmlkCvYh8wug`rKS>}@L_3*p|;A_L)SZOmd-gORdQIVJ;B@HTDvSMkbNDPY* z8=tbAmMFzv1c~BC6m^}`U7d5zEEWY$ouTPFt>?=b$PKDmRI}37pJ$M>-|IWBGaPmTt63_^{3Z}pkNToaR6{gN zh9{O}s_4xzF-<@4(<(1JzZCdRI7qzEXS2XTt7#J5)J2s9aK$KUAbKhs8n0OYUWJb4LaS)Kp71pXVK9 z)*!wR{u`rQ2>(?mInn_{ce8i|l!8;bapDE*XHa{eAi{w_=Q zI5ou$`0wut2xn}a$Di`2jBqaK6FdQ+N_`6n&jbqmP%ljrgZy+9GvSdC3YErK$UPtk z@PHubilizkk|o1HjX(g>j~e?zwIMtds`V{lRWZ`{h>YW{EXLWj_~3t5j8V*51*jv1 zU-N-<4ahPA1%K+vREA2G5^#M!P*@P)L1moNX;A*TE~WqaG$i;LdQQiU3{}(kiwhq- z7XQm-B_Q8?ShzzO_oxqa@Foiftiwt=~w8D)W)d#i0e@DVC761SM delta 31 mcmbR7Shs6|ZbJ)W3sVbo3rh=Y3tJ0&3r7oQ3)dEIt^feGP6_w` 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 96edf0e24adb80552b3c29ec15c56e30a0a63ae6..85f00e2df8b945d1192889cb8003e3a7446dd026 100644 GIT binary patch delta 4974 zcmds5%Wm676h-U4!or*Gx@jjWg4jUGnci=>`KnaH z<#kX!K~$C1OyZQ6@I%&lfxx=a0^#m5_^POiUKPnc%Z5=5|sAovV8_bKhRa28J zLq(Jt5+(8oX_^iKL=_?tUEaZ)gJ%4)$MEyEzsq9WSduMw88^7790XyEzgZ&7rP3k` ze4e#JWdJyte+tU;pJY4BKhZ&IN&e)j8#vy3weaQWtSp-sWJy(;EAzB+lft28>})`N zR|7Bf+rcg@*PWUZdJ_TC_%3-LYGDu;9~GhUl@KXf(w?*p+4@`8X@X*6zxA}a4|Ru# z&gK!cj~Zzp9;(ece*gIHj|=yH`Qabo&&AQKtk7pZ1CzRXQCJJ3F8AmA*uZrbyS^K{ zd>|4iyzcI@K1%aRx>W^rC)}Nj$< zzK*J4#E>OX(IbQ+!;*AE^GVD28bOH^Oms}CNG)5YHq}w~6iNcDijm*4H=J6AH-gud z!d@KrY>W>N52Zsz3Zq?2Ez810#_XzR8ZZjOj zD}@3_nm*aiy1gk-(3g^3O5P~!;-TBaR3i8+FX-Tgi#|5JEfCTopa7CW(7{1Vd&efm-89O4XQ%>?PT<)8RRT^jBNjD zknFr(DooxsmkeZXPYzhA9kXF9_S``y6se}6r9=QGQokhyEEYTA@!xNRJEP?y@8`@h z7tr_Y7JOCQxa9VFowk>J54d#^&r~^ksB*n-!)I~8d%fnA27|V5n@y8gN~mZ6y=-83ylO{zTad@Ar-(2w1~W0Sy|W+}d=6H!$xOEeXgiLR*{A{;~F z>l#yB#hAp+`DSs8m>(KvG&@D<8BN4+NZ|{CljF}n1&L~UsBUvHIRr_}*_Lk;;zX=@ zkU9JlmN$8wM>#*z&G0Xaax?s!qg)36U7}3!Pl4R5{?oYgi&H4`>ipXc@UMW9N1R{3 z75`RH<}vec8U8y)NfFNidF%f3$zE!G7RvdK*TugY%60K?3*}<`caH-2=YU+d{^#uI z9F%jcL3}OzE2CTs|00we=>Vd;QaA)k!6|RXNiy;a>sLNRyqBvteriSZo9JPnXufACLd<5*g9}Xgq^?@oTB$IPYVD~Al@;(lt%d5GeSqPo^?d(=ve6^9Kc>qHrlQ)mhYld79`F`md)U4b@WgoQ~TV8eAO# z(Vo~(WTt*frs&YDc{^QK(s-jJk7jWCS)3Y_6) zVl8Ne{4KqSSaY_EhOV1dMX^>by;jk*a@8?qTCT`tdDYaZESHM9vq~yu-7qT}QOlNP vm_#<^YNe)D6}VtIX8^hhmi delta 31 mcmX>$PjB;W-G&y%7N!>F7M2#)7Pc1l7LFFq7OpMan{xrc3kwVY 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 239373fe3daf07a602cc3d2cb989edaa3beee1d1..34d5b1fcca2379ab48c96ff58dec78845a051107 100644 GIT binary patch delta 4971 zcmds5y>Ht_6i1S_X;~NuIuz)3Q4z#0O5Pnmb%d-y7OloelsLA~1T{QR*E{acgF9I-y7c?zd!z9EdBW5=!=ocbVN|p++Qk{aHRr&YDi@U$hPnUSear~ zF5}83s2(AzlT-&1r?QOi^UiZb32L;!ti1xhI<7TvV~FbyN+mGbL|Pi^2~zPE_mUmG zXei9m5v7(wiF*9~-i=!$ygg_pFM1q54g5AwaAR3z?h0-QQ6&tc1b?|qR?6ii9{M6x zm01w=WYWbHNhHn0Y9VP+q>!AM^yp$)Yegv4P>6;M!&I0yDT1-xv(j(ACVglkndk3R zZciJT^%1RLXA9cB9(s`l7KI6D?(?+>Xgn~0S4){CQB6nDkGi-F`^QH8WgHufu zFZcXbav<-!&t0S`s-mvodgSNK38O02si_m0=ywUZyMj04$RBt-KEC$5L>J2uSx(D& z$isHBhcsHWW_$Lm{%~^8vdYTkegY|Wm!#6YVbAprc!HX|9fYfezkdFufC7KD@YJZ2 zdaug&g8N4?-#&WO@Qw~V<`?djrP6R@54*iCGzty7ov?2YR|_tjTW-Tzh;ac8g-LR- zTBryGdRE^=)hOnODOC0dY=OlT(=vS0vOY)9A`KH0Qz}zttJJ0@nm&cH1glc)x9lya zHpLsk>uO;yNqRQMhlhvCp{7J}8&k#@CMs4{87$=fi!gDAa@hZL5+w`d@V*xZJ+Vhf z1a_OzAXzOG1k&u8R@Uv!fWp3#R;hTSsEdbg4^xHUv%Fw`&+q~#P=J$mrjzf@e0qbp zlNRKAn0I)Whe;p&Xy!MXW;x5TUZ45Sv&<#g?c!Mrz_$c@W2c9ai&Iw?M^q+Erldht zTh(o1$i%VJb|P;e_ItxA4+ep6t4-f% zd7deAoio{O>4sdiMxF=nq-klil=Lyb1dA0i+;s0lpH^P4lD5vo=kT@|myiBA7s8vjBlr*SjM1@SM5lA)dcUBG{9 zD0$pPkOlm_*(KMDD6bB7IsA*FTn_(rC^_N*gm<-Y2(&^_-zhJdl3*ZUIqJT)77cfZ z0whf#pCOAV45&L*6=v=NX^gvqnIVd&45(<}x|_to@c8y0*FPBnHSb4**yDX*iZhA{ z)PBM$fi1$nf8I7vcJQWC!wvWka2JFbYZvh+9BRrp=M)M?0cfpWMbg(21&(MICwW17 zCW^WAR0^fF#z@Ky5+oQTNT#Ofz^_%svQWd9fc&GzzO>$uo=EHUs&r;E#9U&^^YYEO zKre3o&zdoed20#!Na4@yL8f771_Ff``Ak)o#()%})Ch$_WsPz=jlp>mkIeL6!~wy2f^Nn$tX@K_A0wu2)$ z%{p-6ttd*wYBGP=2wRbO6XS+0yy5JWs97;96-zTz$c`Eg(>0YEMW)u6Ra-aBatTHW z4rS&VwTe}}rZclbP0K72R;#Y5RlVwzcj5T+=g6XjSsIKrfGNaD+GI<&U=Fc#=g#`$ G+S0$V0xkFe delta 31 mcmeCVr2D^5x1oixg{g(Pg{6hHg{_6Xg`"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