From 43e5712f8f3d9d29f54ee1e9fffb144ac074d1f0 Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Wed, 29 Jan 2025 16:35:59 -0600 Subject: [PATCH 01/10] FYST 1724 NC and MD NRA status --- app/services/state_file/state_information_service.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/services/state_file/state_information_service.rb b/app/services/state_file/state_information_service.rb index 13d65d48b6..7c24a00fdd 100644 --- a/app/services/state_file/state_information_service.rb +++ b/app/services/state_file/state_information_service.rb @@ -5,6 +5,7 @@ class StateInformationService GETTER_METHODS = [ :intake_class, :calculator_class, + :check_nri_status, :filing_years, :mail_voucher_address, :navigation_class, @@ -70,6 +71,7 @@ def state_intake_class_names az: { intake_class: StateFileAzIntake, calculator_class: Efile::Az::Az140Calculator, + check_nri_status: false, filing_years: [2024, 2023], mail_voucher_address: "Arizona Department of Revenue
" \ "PO Box 29085
" \ @@ -97,6 +99,7 @@ def state_intake_class_names id: { intake_class: StateFileIdIntake, calculator_class: Efile::Id::Id40Calculator, + check_nri_status: false, filing_years: [2024], mail_voucher_address: "Idaho State Tax Commission
" \ "PO Box 83784
" \ @@ -124,6 +127,7 @@ def state_intake_class_names md: { intake_class: StateFileMdIntake, calculator_class: Efile::Md::Md502Calculator, + check_nri_status: true, filing_years: [2024], mail_voucher_address: "Comptroller of Maryland
" \ "Payment Processing
" \ @@ -152,6 +156,7 @@ def state_intake_class_names nc: { intake_class: StateFileNcIntake, calculator_class: Efile::Nc::D400Calculator, + check_nri_status: true, filing_years: [2024], mail_voucher_address: "North Carolina Department of Revenue
" \ "PO Box 25000
" \ @@ -179,6 +184,7 @@ def state_intake_class_names nj: { intake_class: StateFileNjIntake, calculator_class: Efile::Nj::Nj1040Calculator, + check_nri_status: false, filing_years: [2024], navigation_class: Navigation::StateFileNjQuestionNavigation, review_controller_class: StateFile::Questions::NjReviewController, @@ -207,6 +213,7 @@ def state_intake_class_names ny: { intake_class: StateFileNyIntake, calculator_class: Efile::Ny::It201, + check_nri_status: false, filing_years: [2023], mail_voucher_address: "NYS Personal Income Tax
" \ "Processing Center
" \ From 1c8ca40aa52a63d16cc402889242a8990265c175 Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 10:16:33 -0600 Subject: [PATCH 02/10] Check nra status for mfs for nj nc and md --- spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json | 0 spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json create mode 100644 spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml diff --git a/spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json b/spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml b/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml new file mode 100644 index 0000000000..e69de29bb2 From 197b2d9ea96b8804c4405cec270eb1b4db3800fd Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 10:17:56 -0600 Subject: [PATCH 03/10] Check nra status for mfs for nj nc and md --- app/lib/submission_builder/return_header.rb | 8 +- .../ty2024/states/nc/documents/d400.rb | 4 +- app/models/direct_file_data.rb | 1 + app/models/state_file_base_intake.rb | 4 + app/models/state_file_md_intake.rb | 4 + app/models/state_file_nc_intake.rb | 4 + app/models/state_file_nj_intake.rb | 4 + .../state_file/state_information_service.rb | 7 -- spec/factories/state_file_md_intakes.rb | 8 ++ .../fed_return_jsons/md/drum_nra.json | 37 ++++++ .../fed_return_xmls/md/drum_nra.xml | 110 ++++++++++++++++++ .../ty2022/states/return_header_spec.rb | 13 +++ .../ty2024/states/nc/documents/d400_spec.rb | 10 ++ 13 files changed, 204 insertions(+), 10 deletions(-) diff --git a/app/lib/submission_builder/return_header.rb b/app/lib/submission_builder/return_header.rb index c8499a9b59..47572eccbf 100644 --- a/app/lib/submission_builder/return_header.rb +++ b/app/lib/submission_builder/return_header.rb @@ -43,7 +43,7 @@ def document xml.DateSigned date_type_for_timezone(@submission.data_source.primary_esigned_at)&.strftime("%F") if @submission.data_source.primary_esigned_yes? xml.USPhone @submission.data_source.direct_file_data.phone_number if @submission.data_source.direct_file_data.phone_number.present? end - if @submission.data_source&.spouse&.ssn.present? && @submission.data_source&.spouse&.first_name.present? && !@intake.filing_status_mfs? + if @submission.data_source&.spouse&.ssn.present? && @submission.data_source&.spouse&.first_name.present? && (!@intake.filing_status_mfs? || @intake.check_nra_status?) xml.Secondary do xml.TaxpayerName do xml.FirstName sanitize_for_xml(@submission.data_source.spouse.first_name, 16) if @submission.data_source.spouse.first_name.present? @@ -51,7 +51,11 @@ def document xml.LastName sanitize_for_xml(@submission.data_source.spouse.last_name, 32) if @submission.data_source.spouse.last_name.present? xml.NameSuffix @submission.data_source.spouse.suffix.upcase if @submission.data_source.spouse.suffix.present? end - xml.TaxpayerSSN @submission.data_source.spouse.ssn if @submission.data_source.spouse.ssn.present? + if @intake.check_nra_status? && @intake.direct_file_data.non_resident_alien == "NRA" && @intake.filing_status_mfs? + xml.NRALiteralCd "NRA" + else + xml.TaxpayerSSN @submission.data_source.spouse.ssn if @submission.data_source.spouse.ssn.present? + end xml.DateOfBirth date_type(@submission.data_source.spouse.birth_date) if @submission.data_source.spouse.birth_date.present? xml.TaxpayerPIN @submission.data_source.spouse_signature_pin if @submission.data_source.ask_for_signature_pin? && @submission.data_source.ask_spouse_esign? xml.DateSigned date_type_for_timezone(@submission.data_source.spouse_esigned_at)&.strftime("%F") if @submission.data_source.spouse_esigned_yes? && @submission.data_source.ask_spouse_esign? diff --git a/app/lib/submission_builder/ty2024/states/nc/documents/d400.rb b/app/lib/submission_builder/ty2024/states/nc/documents/d400.rb index 5bf22bd4b5..e80345274b 100644 --- a/app/lib/submission_builder/ty2024/states/nc/documents/d400.rb +++ b/app/lib/submission_builder/ty2024/states/nc/documents/d400.rb @@ -33,7 +33,9 @@ def document xml.MiddleInitial sanitize_for_xml(@submission.data_source.spouse.middle_initial, 1) if @submission.data_source.spouse.middle_initial.present? xml.LastName sanitize_for_xml(@submission.data_source.spouse.last_name, 32) if @submission.data_source.spouse.last_name.present? end - xml.MFSSpouseSSN @submission.data_source.direct_file_data.spouse_ssn + unless @submission.data_source.direct_file_data.non_resident_alien == "NRA" + xml.MFSSpouseSSN @submission.data_source.direct_file_data.spouse_ssn + end end if @submission.data_source.filing_status_qw? && @submission.data_source.spouse_death_year.present? xml.QWYearSpouseDied @submission.data_source.spouse_death_year diff --git a/app/models/direct_file_data.rb b/app/models/direct_file_data.rb index 55002bdeb5..66748089e8 100644 --- a/app/models/direct_file_data.rb +++ b/app/models/direct_file_data.rb @@ -672,6 +672,7 @@ def non_resident_alien end def non_resident_alien=(value) + create_or_destroy_df_xml_node(__method__, true, 'NRALiteralCd') write_df_xml_value(__method__, value) end diff --git a/app/models/state_file_base_intake.rb b/app/models/state_file_base_intake.rb index 0b21cfd6ef..b55fde0dc0 100644 --- a/app/models/state_file_base_intake.rb +++ b/app/models/state_file_base_intake.rb @@ -252,6 +252,10 @@ def city_name_length_20? false end + def check_nra_status? + false + end + def ask_spouse_esign? filing_status_mfj? && !spouse_deceased? end diff --git a/app/models/state_file_md_intake.rb b/app/models/state_file_md_intake.rb index 512099579f..9156bca7f0 100644 --- a/app/models/state_file_md_intake.rb +++ b/app/models/state_file_md_intake.rb @@ -219,6 +219,10 @@ def city_name_length_20? true end + def check_nra_status? + true + end + def allows_refund_amount_in_xml? false end diff --git a/app/models/state_file_nc_intake.rb b/app/models/state_file_nc_intake.rb index b2519b4f9d..d4c9901b6a 100644 --- a/app/models/state_file_nc_intake.rb +++ b/app/models/state_file_nc_intake.rb @@ -155,4 +155,8 @@ def requires_additional_withdrawal_information? def allows_w2_editing? false end + + def check_nra_status? + true + end end diff --git a/app/models/state_file_nj_intake.rb b/app/models/state_file_nj_intake.rb index c3d90a087c..f211eff1d9 100644 --- a/app/models/state_file_nj_intake.rb +++ b/app/models/state_file_nj_intake.rb @@ -201,6 +201,10 @@ def ask_for_signature_pin? false end + def check_nra_status? + true + end + def medical_expenses_threshold nj_gross_income = calculator.lines[:NJ1040_LINE_29].value (nj_gross_income * 0.02).floor diff --git a/app/services/state_file/state_information_service.rb b/app/services/state_file/state_information_service.rb index 7c24a00fdd..13d65d48b6 100644 --- a/app/services/state_file/state_information_service.rb +++ b/app/services/state_file/state_information_service.rb @@ -5,7 +5,6 @@ class StateInformationService GETTER_METHODS = [ :intake_class, :calculator_class, - :check_nri_status, :filing_years, :mail_voucher_address, :navigation_class, @@ -71,7 +70,6 @@ def state_intake_class_names az: { intake_class: StateFileAzIntake, calculator_class: Efile::Az::Az140Calculator, - check_nri_status: false, filing_years: [2024, 2023], mail_voucher_address: "Arizona Department of Revenue
" \ "PO Box 29085
" \ @@ -99,7 +97,6 @@ def state_intake_class_names id: { intake_class: StateFileIdIntake, calculator_class: Efile::Id::Id40Calculator, - check_nri_status: false, filing_years: [2024], mail_voucher_address: "Idaho State Tax Commission
" \ "PO Box 83784
" \ @@ -127,7 +124,6 @@ def state_intake_class_names md: { intake_class: StateFileMdIntake, calculator_class: Efile::Md::Md502Calculator, - check_nri_status: true, filing_years: [2024], mail_voucher_address: "Comptroller of Maryland
" \ "Payment Processing
" \ @@ -156,7 +152,6 @@ def state_intake_class_names nc: { intake_class: StateFileNcIntake, calculator_class: Efile::Nc::D400Calculator, - check_nri_status: true, filing_years: [2024], mail_voucher_address: "North Carolina Department of Revenue
" \ "PO Box 25000
" \ @@ -184,7 +179,6 @@ def state_intake_class_names nj: { intake_class: StateFileNjIntake, calculator_class: Efile::Nj::Nj1040Calculator, - check_nri_status: false, filing_years: [2024], navigation_class: Navigation::StateFileNjQuestionNavigation, review_controller_class: StateFile::Questions::NjReviewController, @@ -213,7 +207,6 @@ def state_intake_class_names ny: { intake_class: StateFileNyIntake, calculator_class: Efile::Ny::It201, - check_nri_status: false, filing_years: [2023], mail_voucher_address: "NYS Personal Income Tax
" \ "Processing Center
" \ diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb index 709a8b996b..a754fb1b20 100644 --- a/spec/factories/state_file_md_intakes.rb +++ b/spec/factories/state_file_md_intakes.rb @@ -245,5 +245,13 @@ after(:create, &:synchronize_df_dependents_to_database) end + + trait :mfs_with_nra_spouse do + filing_status { 'married_filing_separately' } + raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('md_drum_nra') } + raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_drum_nra') } + + after(:create, &:synchronize_filers_to_database) + end end end diff --git a/spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json b/spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json index e69de29bb2..96d87e6324 100644 --- a/spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json +++ b/spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json @@ -0,0 +1,37 @@ +{ + "familyAndHousehold": [], + "filers": [ + { + "lastName": "Maracas", + "firstName": "Mary", + "middleInitial": null, + "tin": "400-00-7208", + "dateOfBirth": null, + "suffix": null, + "isPrimaryFiler": false, + "ssnNotValidForEmployment": null + }, + { + "lastName": "Drum", + "firstName": "Dory", + "middleInitial": null, + "tin": "400-00-7207", + "dateOfBirth": "1980-08-10", + "suffix": null, + "isPrimaryFiler": true, + "ssnNotValidForEmployment": null + } + ], + "interestReports": [ + { + "has1099": true, + "taxExemptAndTaxCreditBondCusipNo": null, + "payerTin": null, + "payer": "Drum Corp Investing", + "recipientTin": "400-00-7207", + "taxWithheld": "0.00", + "1099Amount": "10000.00", + "no1099Amount": null + } + ] +} diff --git a/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml b/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml index e69de29bb2..01e38dac5e 100644 --- a/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml +++ b/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml @@ -0,0 +1,110 @@ + + + + 2024 + 2024-01-01 + 2024-12-31 + 676c5f98 + 1040 + + 400007207 + 400007208 + DORY<DRUM + DRUM + MARA + + 10 Tambourine Place + Brunswick + MD + 21716 + + 3015556666 + + + + test-user+40000720-712b-48f0-940c-f4b6b435e196@directfile.test + + + + + + 3 + NRA + Mary Maracas + false + 1 + 0 + 0 + 1 + 110000 + 110000 + 10000 + 120000 + 120000 + 14600 + 14600 + 105400 + 18339 + 18339 + 18339 + 18339 + 10000 + 10000 + 10000 + 8339 + false + Percussionist + NO FINANCIAL PRODUCT + + + + + Drum Corp Investing + + 10000 + + 10000 + 10000 + 10000 + false + false + + + 400007207 + 018887766 + SNAR + + Snare Store + + + 1 Timpani Street + Brunswick + MD + 21716 + + Dory Drum + + 10 Tambourine Place + Brunswick + MD + 21716 + + 110000 + 10000 + 110000 + 8000 + 110000 + 6000 + + + MD + 2224444 + 110000 + 10 + + + + S + + + diff --git a/spec/lib/submission_builder/ty2022/states/return_header_spec.rb b/spec/lib/submission_builder/ty2022/states/return_header_spec.rb index 186204fa0a..1c3ec72090 100644 --- a/spec/lib/submission_builder/ty2022/states/return_header_spec.rb +++ b/spec/lib/submission_builder/ty2022/states/return_header_spec.rb @@ -393,9 +393,22 @@ context "AZ intake" do let(:intake) { create(:state_file_az_intake,) } + let(:submission) { create(:efile_submission, data_source: intake) } + let(:doc) { SubmissionBuilder::ReturnHeader.new(submission).document } it "does not include disaster relief xml" do expect(doc.at('DisasterReliefTxt')).not_to be_present end end end + + context "NC or MD filer with MFS status and NRA spouse" do + let(:intake) { create(:state_file_md_intake, :mfs_with_nra_spouse) } + let(:submission) { create(:efile_submission, data_source: intake) } + let(:doc) { SubmissionBuilder::ReturnHeader.new(submission).document } + + it "it does not fill out spouse ssn and fills in NRALiteralCd" do + expect(doc.at('Filer Secondary TaxpayerSSN')).not_to be_present + expect(doc.at('Filer Secondary NRALiteralCd').content).to eq "NRA" + end + end end diff --git a/spec/lib/submission_builder/ty2024/states/nc/documents/d400_spec.rb b/spec/lib/submission_builder/ty2024/states/nc/documents/d400_spec.rb index a685a081d2..da1a46e4ef 100644 --- a/spec/lib/submission_builder/ty2024/states/nc/documents/d400_spec.rb +++ b/spec/lib/submission_builder/ty2024/states/nc/documents/d400_spec.rb @@ -147,6 +147,16 @@ expect(xml.document.at('MFSSpouseName LastName')&.text).to eq "Spouse" expect(xml.document.at('MFSSpouseSSN')&.text).to eq "111100030" end + + context "filer has spouse with NRA status" do + before do + intake.direct_file_data.non_resident_alien = "NRA" + end + + it 'does not fill out spouse ssn' do + expect(xml.document.at('MFSSpouseSSN')).to be_nil + end + end end context "hoh filers" do From 18ccc62510f730dced30553a225102f77cd1dc1f Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 10:19:37 -0600 Subject: [PATCH 04/10] simplify condition on return header --- app/lib/submission_builder/return_header.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/submission_builder/return_header.rb b/app/lib/submission_builder/return_header.rb index 47572eccbf..5561a7145e 100644 --- a/app/lib/submission_builder/return_header.rb +++ b/app/lib/submission_builder/return_header.rb @@ -51,7 +51,7 @@ def document xml.LastName sanitize_for_xml(@submission.data_source.spouse.last_name, 32) if @submission.data_source.spouse.last_name.present? xml.NameSuffix @submission.data_source.spouse.suffix.upcase if @submission.data_source.spouse.suffix.present? end - if @intake.check_nra_status? && @intake.direct_file_data.non_resident_alien == "NRA" && @intake.filing_status_mfs? + if @intake.direct_file_data.non_resident_alien == "NRA" xml.NRALiteralCd "NRA" else xml.TaxpayerSSN @submission.data_source.spouse.ssn if @submission.data_source.spouse.ssn.present? From 4cf443d892837682008f72d0274eac4bb63dd8dd Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 10:58:19 -0600 Subject: [PATCH 05/10] fix mfs condition --- app/lib/submission_builder/return_header.rb | 7 ++++--- .../submission_builder/ty2022/states/return_header_spec.rb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/lib/submission_builder/return_header.rb b/app/lib/submission_builder/return_header.rb index 5561a7145e..31ffd9676b 100644 --- a/app/lib/submission_builder/return_header.rb +++ b/app/lib/submission_builder/return_header.rb @@ -43,7 +43,8 @@ def document xml.DateSigned date_type_for_timezone(@submission.data_source.primary_esigned_at)&.strftime("%F") if @submission.data_source.primary_esigned_yes? xml.USPhone @submission.data_source.direct_file_data.phone_number if @submission.data_source.direct_file_data.phone_number.present? end - if @submission.data_source&.spouse&.ssn.present? && @submission.data_source&.spouse&.first_name.present? && (!@intake.filing_status_mfs? || @intake.check_nra_status?) + has_nra_spouse = @intake.check_nra_status? && @intake.direct_file_data.non_resident_alien == "NRA" && @intake.filing_status_mfs? + if @submission.data_source&.spouse&.ssn.present? && @submission.data_source&.spouse&.first_name.present? && (!@intake.filing_status_mfs? || has_nra_spouse) xml.Secondary do xml.TaxpayerName do xml.FirstName sanitize_for_xml(@submission.data_source.spouse.first_name, 16) if @submission.data_source.spouse.first_name.present? @@ -53,8 +54,8 @@ def document end if @intake.direct_file_data.non_resident_alien == "NRA" xml.NRALiteralCd "NRA" - else - xml.TaxpayerSSN @submission.data_source.spouse.ssn if @submission.data_source.spouse.ssn.present? + elsif @submission.data_source.spouse.ssn.present? + xml.TaxpayerSSN @submission.data_source.spouse.ssn end xml.DateOfBirth date_type(@submission.data_source.spouse.birth_date) if @submission.data_source.spouse.birth_date.present? xml.TaxpayerPIN @submission.data_source.spouse_signature_pin if @submission.data_source.ask_for_signature_pin? && @submission.data_source.ask_spouse_esign? diff --git a/spec/lib/submission_builder/ty2022/states/return_header_spec.rb b/spec/lib/submission_builder/ty2022/states/return_header_spec.rb index 1c3ec72090..15b89746cc 100644 --- a/spec/lib/submission_builder/ty2022/states/return_header_spec.rb +++ b/spec/lib/submission_builder/ty2022/states/return_header_spec.rb @@ -401,7 +401,7 @@ end end - context "NC or MD filer with MFS status and NRA spouse" do + context "filer with MFS status NRA spouse if condition is to be checked" do let(:intake) { create(:state_file_md_intake, :mfs_with_nra_spouse) } let(:submission) { create(:efile_submission, data_source: intake) } let(:doc) { SubmissionBuilder::ReturnHeader.new(submission).document } From 141c0a517db585ee9e9d7839d3384fe91197e9ae Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 11:00:22 -0600 Subject: [PATCH 06/10] fix condition to be more consistent: --- app/lib/submission_builder/return_header.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/submission_builder/return_header.rb b/app/lib/submission_builder/return_header.rb index 31ffd9676b..882460217d 100644 --- a/app/lib/submission_builder/return_header.rb +++ b/app/lib/submission_builder/return_header.rb @@ -52,7 +52,7 @@ def document xml.LastName sanitize_for_xml(@submission.data_source.spouse.last_name, 32) if @submission.data_source.spouse.last_name.present? xml.NameSuffix @submission.data_source.spouse.suffix.upcase if @submission.data_source.spouse.suffix.present? end - if @intake.direct_file_data.non_resident_alien == "NRA" + if has_nra_spouse xml.NRALiteralCd "NRA" elsif @submission.data_source.spouse.ssn.present? xml.TaxpayerSSN @submission.data_source.spouse.ssn From 74ef6b14c69b08d77020029fecb0e44e7eb620a2 Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 12:12:50 -0600 Subject: [PATCH 07/10] Fix comment --- app/lib/submission_builder/return_header.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/submission_builder/return_header.rb b/app/lib/submission_builder/return_header.rb index 882460217d..30c82102a7 100644 --- a/app/lib/submission_builder/return_header.rb +++ b/app/lib/submission_builder/return_header.rb @@ -44,7 +44,7 @@ def document xml.USPhone @submission.data_source.direct_file_data.phone_number if @submission.data_source.direct_file_data.phone_number.present? end has_nra_spouse = @intake.check_nra_status? && @intake.direct_file_data.non_resident_alien == "NRA" && @intake.filing_status_mfs? - if @submission.data_source&.spouse&.ssn.present? && @submission.data_source&.spouse&.first_name.present? && (!@intake.filing_status_mfs? || has_nra_spouse) + if @submission.data_source.spouse&.ssn.present? && @submission.data_source.spouse&.first_name.present? && (!@intake.filing_status_mfs? || has_nra_spouse) xml.Secondary do xml.TaxpayerName do xml.FirstName sanitize_for_xml(@submission.data_source.spouse.first_name, 16) if @submission.data_source.spouse.first_name.present? From 5b4b256e407df995d7ad464ff56ef0177ae02de9 Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 12:29:48 -0600 Subject: [PATCH 08/10] fix conditions --- app/lib/submission_builder/return_header.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/lib/submission_builder/return_header.rb b/app/lib/submission_builder/return_header.rb index 30c82102a7..30f567f868 100644 --- a/app/lib/submission_builder/return_header.rb +++ b/app/lib/submission_builder/return_header.rb @@ -44,7 +44,8 @@ def document xml.USPhone @submission.data_source.direct_file_data.phone_number if @submission.data_source.direct_file_data.phone_number.present? end has_nra_spouse = @intake.check_nra_status? && @intake.direct_file_data.non_resident_alien == "NRA" && @intake.filing_status_mfs? - if @submission.data_source.spouse&.ssn.present? && @submission.data_source.spouse&.first_name.present? && (!@intake.filing_status_mfs? || has_nra_spouse) + spouse_with_ssn = @submission.data_source.spouse&.ssn.present? && @submission.data_source.spouse&.first_name.present? && !@intake.filing_status_mfs? + if spouse_with_ssn || has_nra_spouse xml.Secondary do xml.TaxpayerName do xml.FirstName sanitize_for_xml(@submission.data_source.spouse.first_name, 16) if @submission.data_source.spouse.first_name.present? @@ -54,7 +55,7 @@ def document end if has_nra_spouse xml.NRALiteralCd "NRA" - elsif @submission.data_source.spouse.ssn.present? + elsif @submission.data_source.spouse&.ssn&.present? xml.TaxpayerSSN @submission.data_source.spouse.ssn end xml.DateOfBirth date_type(@submission.data_source.spouse.birth_date) if @submission.data_source.spouse.birth_date.present? From 185e2aa523cbbb21750b681634aa419903d57e6f Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 14:33:59 -0600 Subject: [PATCH 09/10] Remove ssn for spouse --- spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml b/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml index 01e38dac5e..c2ccc665e7 100644 --- a/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml +++ b/spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml @@ -8,7 +8,6 @@ 1040 400007207 - 400007208 DORY<DRUM DRUM MARA From 58fb6663986023b052d19d99f6d9f626b301bf37 Mon Sep 17 00:00:00 2001 From: Tahsina Islam Date: Thu, 30 Jan 2025 14:58:48 -0600 Subject: [PATCH 10/10] Take out condition for MD and add nc persona --- app/models/state_file_md_intake.rb | 4 - spec/factories/state_file_md_intakes.rb | 8 -- spec/factories/state_file_nc_intakes.rb | 8 ++ .../fed_return_jsons/nc/wylie_mfs_nra.json | 26 +++++ .../fed_return_xmls/nc/wylie_mfs_nra.xml | 101 ++++++++++++++++++ .../ty2022/states/return_header_spec.rb | 2 +- 6 files changed, 136 insertions(+), 13 deletions(-) create mode 100644 spec/fixtures/state_file/fed_return_jsons/nc/wylie_mfs_nra.json create mode 100644 spec/fixtures/state_file/fed_return_xmls/nc/wylie_mfs_nra.xml diff --git a/app/models/state_file_md_intake.rb b/app/models/state_file_md_intake.rb index 9156bca7f0..512099579f 100644 --- a/app/models/state_file_md_intake.rb +++ b/app/models/state_file_md_intake.rb @@ -219,10 +219,6 @@ def city_name_length_20? true end - def check_nra_status? - true - end - def allows_refund_amount_in_xml? false end diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb index a754fb1b20..709a8b996b 100644 --- a/spec/factories/state_file_md_intakes.rb +++ b/spec/factories/state_file_md_intakes.rb @@ -245,13 +245,5 @@ after(:create, &:synchronize_df_dependents_to_database) end - - trait :mfs_with_nra_spouse do - filing_status { 'married_filing_separately' } - raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('md_drum_nra') } - raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('md_drum_nra') } - - after(:create, &:synchronize_filers_to_database) - end end end diff --git a/spec/factories/state_file_nc_intakes.rb b/spec/factories/state_file_nc_intakes.rb index 34bb9abe8e..7a486793bd 100644 --- a/spec/factories/state_file_nc_intakes.rb +++ b/spec/factories/state_file_nc_intakes.rb @@ -175,5 +175,13 @@ trait :with_filers_synced do after(:create, &:synchronize_filers_to_database) end + + trait :mfs_with_nra_spouse do + filing_status { 'married_filing_separately' } + raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('nc_wylie_mfs_nra') } + raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('nc_wylie_mfs_nra') } + + after(:create, &:synchronize_filers_to_database) + end end end diff --git a/spec/fixtures/state_file/fed_return_jsons/nc/wylie_mfs_nra.json b/spec/fixtures/state_file/fed_return_jsons/nc/wylie_mfs_nra.json new file mode 100644 index 0000000000..cfbd927432 --- /dev/null +++ b/spec/fixtures/state_file/fed_return_jsons/nc/wylie_mfs_nra.json @@ -0,0 +1,26 @@ +{ + "familyAndHousehold": [], + "filers": [ + { + "lastName": "Coyote", + "firstName": "Wylie", + "middleInitial": "E", + "tin": "145-00-4901", + "dateOfBirth": "1985-05-21", + "suffix": null, + "isPrimaryFiler": true, + "ssnNotValidForEmployment": null + }, + { + "lastName": "Coyote", + "firstName": "Wilma", + "middleInitial": "D", + "tin": "145-00-4921", + "dateOfBirth": null, + "suffix": null, + "isPrimaryFiler": false, + "ssnNotValidForEmployment": null + } + ], + "interestReports": [] +} \ No newline at end of file diff --git a/spec/fixtures/state_file/fed_return_xmls/nc/wylie_mfs_nra.xml b/spec/fixtures/state_file/fed_return_xmls/nc/wylie_mfs_nra.xml new file mode 100644 index 0000000000..e2cbd024e6 --- /dev/null +++ b/spec/fixtures/state_file/fed_return_xmls/nc/wylie_mfs_nra.xml @@ -0,0 +1,101 @@ + + + + 2024 + 2024-01-01 + 2024-12-31 + eb055500 + 1040 + + 145004901 + WYLIE E<COYOTE + COYO + COYO + + 111 Alston Avenue + Durham + NC + 27517 + + 2125564902 + + + + test-user+14500490-1940-48c9-97e3-f70febc5988a@directfile.test + + + + + + 3 + NRA + Wilma D Coyote + false + 1 + 0 + 0 + 1 + 44888 + 44888 + 44888 + 44888 + 14600 + 14600 + 30288 + 3401 + 3401 + 3401 + 3401 + 3951 + 3951 + 3951 + 550 + 550 + 021000322 + 1 + 234523452345 + 0 + false + Researcher + NO FINANCIAL PRODUCT + + + Wylie E Coyote + 145004901 + 003 + + + 145004901 + 000300088 + DUKE + + Duke University Hospital + + + 2301 Erwin Road + Durham + NC + 27710 + + Wylie E Coyote + + 111 Alston Avenue + Durham + NC + 27517 + + 44888 + 3951 + + + NC + NC 21-0003000 + 44888 + 2884 + + + + S + + + \ No newline at end of file diff --git a/spec/lib/submission_builder/ty2022/states/return_header_spec.rb b/spec/lib/submission_builder/ty2022/states/return_header_spec.rb index 15b89746cc..86bfa1306f 100644 --- a/spec/lib/submission_builder/ty2022/states/return_header_spec.rb +++ b/spec/lib/submission_builder/ty2022/states/return_header_spec.rb @@ -402,7 +402,7 @@ end context "filer with MFS status NRA spouse if condition is to be checked" do - let(:intake) { create(:state_file_md_intake, :mfs_with_nra_spouse) } + let(:intake) { create(:state_file_nc_intake, :mfs_with_nra_spouse) } let(:submission) { create(:efile_submission, data_source: intake) } let(:doc) { SubmissionBuilder::ReturnHeader.new(submission).document }