Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FYST 1724 NC and NJ to include NRA status in state xml if present on df xml #5486

10 changes: 8 additions & 2 deletions app/lib/submission_builder/return_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,21 @@ 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? && [email protected]_status_mfs?
has_nra_spouse = @intake.check_nra_status? && @intake.direct_file_data.non_resident_alien == "NRA" && @intake.filing_status_mfs?
spouse_with_ssn = @submission.data_source.spouse&.ssn.present? && @submission.data_source.spouse&.first_name.present? && [email protected]_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?
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?
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 has_nra_spouse
xml.NRALiteralCd "NRA"
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?
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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/direct_file_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions app/models/state_file_base_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/models/state_file_md_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/models/state_file_nc_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,8 @@ def requires_additional_withdrawal_information?
def allows_w2_editing?
false
end

def check_nra_status?
true
end
end
4 changes: 4 additions & 0 deletions app/models/state_file_nj_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions spec/factories/state_file_md_intakes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
37 changes: 37 additions & 0 deletions spec/fixtures/state_file/fed_return_jsons/md/drum_nra.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this persona was added after a conversation with tiffany to test on demo

110 changes: 110 additions & 0 deletions spec/fixtures/state_file/fed_return_xmls/md/drum_nra.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Return xmlns="http://www.irs.gov/efile" xmlns:efile="http://www.irs.gov/efile" returnVersion="2024v4.0">
<ReturnHeader binaryAttachmentCnt="0">
<TaxYr>2024</TaxYr>
<TaxPeriodBeginDt>2024-01-01</TaxPeriodBeginDt>
<TaxPeriodEndDt>2024-12-31</TaxPeriodEndDt>
<SoftwareVersionNum>676c5f98</SoftwareVersionNum>
<ReturnTypeCd>1040</ReturnTypeCd>
<Filer>
<PrimarySSN>400007207</PrimarySSN>
<SpouseSSN>400007208</SpouseSSN>
<NameLine1Txt>DORY&lt;DRUM</NameLine1Txt>
<PrimaryNameControlTxt>DRUM</PrimaryNameControlTxt>
<SpouseNameControlTxt>MARA</SpouseNameControlTxt>
<USAddress>
<AddressLine1Txt>10 Tambourine Place</AddressLine1Txt>
<CityNm>Brunswick</CityNm>
<StateAbbreviationCd>MD</StateAbbreviationCd>
<ZIPCd>21716</ZIPCd>
</USAddress>
<PhoneNum>3015556666</PhoneNum>
</Filer>
<AdditionalFilerInformation>
<AtSubmissionFilingGrp>
<EmailAddressTxt>[email protected]</EmailAddressTxt>
</AtSubmissionFilingGrp>
</AdditionalFilerInformation>
</ReturnHeader>
<ReturnData documentCnt="3">
<IRS1040 documentId="IRS10400001">
<IndividualReturnFilingStatusCd>3</IndividualReturnFilingStatusCd>
<NRALiteralCd>NRA</NRALiteralCd>
<SpouseNm>Mary Maracas</SpouseNm>
<VirtualCurAcquiredDurTYInd>false</VirtualCurAcquiredDurTYInd>
<TotalExemptPrimaryAndSpouseCnt>1</TotalExemptPrimaryAndSpouseCnt>
<ChldWhoLivedWithYouCnt>0</ChldWhoLivedWithYouCnt>
<OtherDependentsListedCnt>0</OtherDependentsListedCnt>
<TotalExemptionsCnt>1</TotalExemptionsCnt>
<WagesAmt referenceDocumentId="W20001" referenceDocumentName="IRSW2">110000</WagesAmt>
<WagesSalariesAndTipsAmt>110000</WagesSalariesAndTipsAmt>
<TaxableInterestAmt referenceDocumentId="IRS1040B001" referenceDocumentName="IRS1040ScheduleB">10000</TaxableInterestAmt>
<TotalIncomeAmt>120000</TotalIncomeAmt>
<AdjustedGrossIncomeAmt>120000</AdjustedGrossIncomeAmt>
<TotalItemizedOrStandardDedAmt>14600</TotalItemizedOrStandardDedAmt>
<TotalDeductionsAmt>14600</TotalDeductionsAmt>
<TaxableIncomeAmt>105400</TaxableIncomeAmt>
<TaxAmt>18339</TaxAmt>
<TotalTaxBeforeCrAndOthTaxesAmt>18339</TotalTaxBeforeCrAndOthTaxesAmt>
<TaxLessCreditsAmt>18339</TaxLessCreditsAmt>
<TotalTaxAmt>18339</TotalTaxAmt>
<FormW2WithheldTaxAmt>10000</FormW2WithheldTaxAmt>
<WithholdingTaxAmt>10000</WithholdingTaxAmt>
<TotalPaymentsAmt>10000</TotalPaymentsAmt>
<OwedAmt>8339</OwedAmt>
<ThirdPartyDesigneeInd>false</ThirdPartyDesigneeInd>
<PrimaryOccupationTxt>Percussionist</PrimaryOccupationTxt>
<RefundProductCd>NO FINANCIAL PRODUCT</RefundProductCd>
</IRS1040>
<IRS1040ScheduleB documentId="IRS1040B001" documentName="IRS1040ScheduleB">
<Form1040SchBPartIGroup2>
<InterestPayerName>
<BusinessNameLine1Txt>Drum Corp Investing</BusinessNameLine1Txt>
</InterestPayerName>
<InterestAmt>10000</InterestAmt>
</Form1040SchBPartIGroup2>
<InterestSubtotalAmt interestSubtotalLiteralCd="INTEREST SUBTOTAL">10000</InterestSubtotalAmt>
<TaxableInterestSubtotalAmt>10000</TaxableInterestSubtotalAmt>
<CalculatedTotalTaxableIntAmt>10000</CalculatedTotalTaxableIntAmt>
<ForeignAccountsQuestionInd>false</ForeignAccountsQuestionInd>
<ForeignTrustQuestionInd>false</ForeignTrustQuestionInd>
</IRS1040ScheduleB>
<IRSW2 documentId="W20001" documentName="IRSW2">
<EmployeeSSN>400007207</EmployeeSSN>
<EmployerEIN>018887766</EmployerEIN>
<EmployerNameControlTxt>SNAR</EmployerNameControlTxt>
<EmployerName>
<BusinessNameLine1Txt>Snare Store</BusinessNameLine1Txt>
</EmployerName>
<EmployerUSAddress>
<AddressLine1Txt>1 Timpani Street</AddressLine1Txt>
<CityNm>Brunswick</CityNm>
<StateAbbreviationCd>MD</StateAbbreviationCd>
<ZIPCd>21716</ZIPCd>
</EmployerUSAddress>
<EmployeeNm>Dory Drum</EmployeeNm>
<EmployeeUSAddress>
<AddressLine1Txt>10 Tambourine Place</AddressLine1Txt>
<CityNm>Brunswick</CityNm>
<StateAbbreviationCd>MD</StateAbbreviationCd>
<ZIPCd>21716</ZIPCd>
</EmployeeUSAddress>
<WagesAmt>110000</WagesAmt>
<WithholdingAmt>10000</WithholdingAmt>
<SocialSecurityWagesAmt>110000</SocialSecurityWagesAmt>
<SocialSecurityTaxAmt>8000</SocialSecurityTaxAmt>
<MedicareWagesAndTipsAmt>110000</MedicareWagesAndTipsAmt>
<MedicareTaxWithheldAmt>6000</MedicareTaxWithheldAmt>
<W2StateLocalTaxGrp>
<W2StateTaxGrp>
<StateAbbreviationCd>MD</StateAbbreviationCd>
<EmployerStateIdNum>2224444</EmployerStateIdNum>
<StateWagesAmt>110000</StateWagesAmt>
<StateIncomeTaxAmt>10</StateIncomeTaxAmt>
<W2LocalTaxGrp/>
</W2StateTaxGrp>
</W2StateLocalTaxGrp>
<StandardOrNonStandardCd>S</StandardOrNonStandardCd>
</IRSW2>
</ReturnData>
</Return>
13 changes: 13 additions & 0 deletions spec/lib/submission_builder/ty2022/states/return_header_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test was not properly testing the xml itself before. Its unrelated to the story

expect(doc.at('DisasterReliefTxt')).not_to be_present
end
end
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(: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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading