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-1880 Add recipients address to 1099R #5663

Merged
merged 7 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/lib/submission_builder/document.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module SubmissionBuilder
class Document
include SubmissionBuilder::FormattingMethods
include XmlMethods
attr_accessor :submission, :schema_file, :schema_version

def initialize(submission, validate: true, kwargs: {})
Expand Down
11 changes: 10 additions & 1 deletion app/lib/submission_builder/state1099_r.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def document
form1099r = @kwargs[:form1099r]
state_abbreviation = form1099r.intake.state_code.upcase

build_xml_doc("IRS1099R", documentId: "IRS1099R-#{form1099r.id}") do |xml|
xml_doc = build_xml_doc("IRS1099R", documentId: "IRS1099R-#{form1099r.id}") do |xml|
xml.PayerNameControlTxt form1099r.payer_name_control
if form1099r.payer_name.present?
xml.PayerName do
Expand All @@ -23,6 +23,13 @@ def document
xml.PayerEIN form1099r.payer_identification_number
xml.RecipientSSN sanitize_for_xml(form1099r.recipient_ssn) if form1099r.recipient_ssn.present?
xml.RecipientNm sanitize_for_xml(form1099r.recipient_name) if form1099r.recipient_name.present?
xml.RecipientUSAddress do
xml.AddressLine1Txt sanitize_for_xml(form1099r.recipient_address_line1) if form1099r.recipient_address_line1.present?
xml.AddressLine2Txt sanitize_for_xml(form1099r.recipient_address_line2) if form1099r.recipient_address_line2.present?
xml.CityNm sanitize_for_xml(form1099r.recipient_city_name) if form1099r.recipient_city_name.present?
xml.StateAbbreviationCd sanitize_for_xml(form1099r.recipient_state_code) if form1099r.recipient_state_code.present?
xml.ZIPCd sanitize_for_xml(form1099r.recipient_zip) if form1099r.recipient_zip.present?
end
xml.GrossDistributionAmt form1099r.gross_distribution_amount&.round
xml.TaxableAmt form1099r.taxable_amount&.round
if form1099r.taxable_amount_not_determined?
Expand All @@ -49,6 +56,8 @@ def document
end
end
end
delete_blank_nodes(xml_doc)
xml_doc
end
end
end
5 changes: 5 additions & 0 deletions app/models/df_1099r_accessor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class Df1099rAccessor < DfXmlAccessor
total_distribution: "TotalDistributionInd",
capital_gain_amount: "CapitalGainAmt",
designated_roth_account_first_year: "DesignatedROTHAcctFirstYr",
recipient_address_line1: "RecipientUSAddress AddressLine1Txt",
recipient_address_line2: "RecipientUSAddress AddressLine2Txt",
recipient_city_name: "RecipientUSAddress CityNm",
recipient_state_code: "RecipientUSAddress StateAbbreviationCd",
recipient_zip: "RecipientUSAddress ZIPCd",
}

def self.selectors
Expand Down
5 changes: 5 additions & 0 deletions app/models/state_file1099_r.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
# payer_state_identification_number :string
# payer_zip :string
# phone_number :string
# recipient_address_line1 :string
# recipient_address_line2 :string
# recipient_city_name :string
# recipient_name :string
# recipient_ssn :string
# recipient_state_code :string
# recipient_zip :string
# standard :boolean
# state_code :string
# state_distribution_amount :decimal(12, 2)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddRecipientAddressColumnsToStateFile1099Rs < ActiveRecord::Migration[7.1]
def change
add_column :state_file1099_rs, :recipient_address_line1, :string
add_column :state_file1099_rs, :recipient_address_line2, :string
add_column :state_file1099_rs, :recipient_city_name, :string
add_column :state_file1099_rs, :recipient_state_code, :string
add_column :state_file1099_rs, :recipient_zip, :string
end
end
7 changes: 6 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2025_02_27_182343) do
ActiveRecord::Schema[7.1].define(version: 2025_02_27_234021) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "plpgsql"
Expand Down Expand Up @@ -1735,8 +1735,13 @@
t.string "payer_state_identification_number"
t.string "payer_zip"
t.string "phone_number"
t.string "recipient_address_line1"
t.string "recipient_address_line2"
t.string "recipient_city_name"
t.string "recipient_name"
t.string "recipient_ssn"
t.string "recipient_state_code"
t.string "recipient_zip"
t.boolean "standard"
t.string "state_code"
t.decimal "state_distribution_amount", precision: 12, scale: 2
Expand Down
10 changes: 10 additions & 0 deletions spec/factories/state_file1099_rs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
# payer_state_identification_number :string
# payer_zip :string
# phone_number :string
# recipient_address_line1 :string
# recipient_address_line2 :string
# recipient_city_name :string
# recipient_name :string
# recipient_ssn :string
# recipient_state_code :string
# recipient_zip :string
# standard :boolean
# state_code :string
# state_distribution_amount :decimal(12, 2)
Expand Down Expand Up @@ -51,6 +56,11 @@
payer_identification_number { "22345" }
recipient_ssn { "123456789" }
recipient_name { "Dorothy Jane Red" }
recipient_address_line1 { "123 Sesame St" }
recipient_address_line2 { "Apt 202" }
recipient_city_name { "Long Island" }
recipient_state_code { "AZ" }
recipient_zip { "12345-1234" }
gross_distribution_amount { 100.25 }
taxable_amount { 50.5 }
taxable_amount_not_determined { true }
Expand Down
22 changes: 21 additions & 1 deletion spec/lib/submission_builder/state1099_r_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
intake: intake,
state_code: state_code.upcase,
payer_state_code: state_code.upcase
)
)
end
let(:intake) do
create("state_file_#{state_code}_intake".to_sym)
Expand All @@ -29,6 +29,11 @@
expect(doc.at("PayerEIN").text).to eq "22345"
expect(doc.at("RecipientSSN").text).to eq "123456789"
expect(doc.at("RecipientNm").text).to eq "Dorothy Jane Red"
expect(doc.at("RecipientUSAddress AddressLine1Txt").text).to eq "123 Sesame St"
expect(doc.at("RecipientUSAddress AddressLine2Txt").text).to eq "Apt 202"
expect(doc.at("RecipientUSAddress CityNm").text).to eq "Long Island"
expect(doc.at("RecipientUSAddress StateAbbreviationCd").text).to eq "AZ"
expect(doc.at("RecipientUSAddress ZIPCd").text).to eq "12345-1234"
expect(doc.at("GrossDistributionAmt").text).to eq "100"
expect(doc.at("TaxableAmt").text).to eq "51"
expect(doc.at("TxblAmountNotDeterminedInd").text).to eq "X"
Expand All @@ -51,6 +56,21 @@
expect(doc.at("F1099RStateTaxGrp StateAbbreviationCd").text).to eq "#{intake.state_code.upcase}"
end
end

context "omitting recipient address tag when address absent" do
before do
form1099r.update(
recipient_address_line1: nil,
recipient_address_line2: nil,
recipient_city_name: nil,
recipient_state_code: nil,
recipient_zip: nil,
)
end
it "doesn't include the tag" do
expect(doc.at("RecipientUSAddress")).to be_nil
end
end
end
end
end
5 changes: 5 additions & 0 deletions spec/models/state_file1099_r_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
# payer_state_identification_number :string
# payer_zip :string
# phone_number :string
# recipient_address_line1 :string
# recipient_address_line2 :string
# recipient_city_name :string
# recipient_name :string
# recipient_ssn :string
# recipient_state_code :string
# recipient_zip :string
# standard :boolean
# state_code :string
# state_distribution_amount :decimal(12, 2)
Expand Down
5 changes: 4 additions & 1 deletion spec/models/state_file_base_intake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@
intake.synchronize_df_1099_rs_to_database

expect(intake.state_file1099_rs.first.state_tax_withheld_amount).to eq 50
expect(intake.state_file1099_rs.count).to eq 1
expect(intake.state_file1099_rs.first.recipient_address_line1).to eq "200 Neptune Street"
expect(intake.state_file1099_rs.first.recipient_city_name).to eq "Flagstaff"
expect(intake.state_file1099_rs.first.recipient_state_code).to eq "AZ"
expect(intake.state_file1099_rs.first.recipient_zip).to eq "86001"
end
end

Expand Down
Loading