Skip to content

Commit

Permalink
Do not attempt to fill out account holder names if taxes are owed (ac…
Browse files Browse the repository at this point in the history
…count holder info is only provided if refund) (#5443)
  • Loading branch information
arinchoi03 authored Jan 24, 2025
1 parent 68b3556 commit 0d90b7e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/lib/pdf_filler/md502_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def generate_codes_for_502_su

def full_names_of_bank_account_holders
intake = @submission.data_source
return nil unless intake.payment_or_deposit_type.to_sym == :direct_deposit
return nil unless intake.payment_or_deposit_type.to_sym == :direct_deposit && intake.refund_or_owe_taxes_type == :refund

if intake.has_joint_account_holder_yes?
account_holder_full_name + " and " + account_holder_full_name(for_joint: true)
Expand All @@ -191,6 +191,8 @@ def account_holder_full_name(for_joint: false)
attributes = %w[FirstName MiddleInitial LastName NameSuffix]
account_holder_xmls = @xml_document.css('Form502 NameOnBankAccount')
account_holder_xml = for_joint ? account_holder_xmls[1] : account_holder_xmls[0]
return if account_holder_xml.nil?

attributes.map { |attr| account_holder_xml.at(attr)&.text }.filter_map(&:presence).join(" ")
end

Expand Down
15 changes: 15 additions & 0 deletions spec/lib/pdf_filler/md502_pdf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,21 @@
expect(pdf_fields["50"]).to eq "100"
expect(pdf_fields["50 decimal"]).to eq "00"
end

context "direct deposit payment is chosen" do
before do
intake.update(
payment_or_deposit_type: :direct_deposit,
routing_number: "123456789",
account_number: "87654321",
account_type: "checking"
)
end

it "should not try to fill out names on bank account" do
expect(pdf_fields["51d Names as it appears on the bank account"]).to eq ""
end
end
end

context "when there is a refund" do
Expand Down

0 comments on commit 0d90b7e

Please sign in to comment.