Skip to content

Commit

Permalink
Update MD EL101 PDF to 2024 (#5250)
Browse files Browse the repository at this point in the history
* Update pdf filed names, recognizing signature fields are not getting filled
* Update signature field to be fill-able & follow up
  • Loading branch information
arinchoi03 authored Dec 19, 2024
1 parent 6630dbb commit b3ed502
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 15 deletions.
29 changes: 16 additions & 13 deletions app/lib/pdf_filler/md_el101_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class MdEl101Pdf
include PdfHelper

def source_pdf_name
"mdEL101-TY2023"
"mdEL101-TY2024"
end

def initialize(submission)
Expand All @@ -15,27 +15,30 @@ def initialize(submission)
end

def hash_for_pdf

signature = [@xml_document.at('Primary TaxpayerName FirstName')&.text, @xml_document.at('Primary TaxpayerName LastName')&.text].join(' ')
spouse_signature = @submission.data_source.spouse_esigned_yes? ? [@xml_document.at('Secondary TaxpayerName FirstName')&.text, @xml_document.at('Secondary TaxpayerName LastName')&.text].join(' ') : ""
{
'First Name': @xml_document.at('Primary TaxpayerName FirstName')&.text,
'Middle Initial': @xml_document.at('Primary TaxpayerName MiddleInitial')&.text,
'Primary MI': @xml_document.at('Primary TaxpayerName MiddleInitial')&.text,
'Last Name': @xml_document.at('Primary TaxpayerName LastName')&.text,
'SSNTaxpayer Identification Number': @xml_document.at('Primary TaxpayerSSN')&.text,
'Spouses First Name': @xml_document.at('Secondary TaxpayerName FirstName')&.text,
'Spouse Middle Initial': @xml_document.at('Secondary TaxpayerName MiddleInitial')&.text,
'Spouse MI': @xml_document.at('Secondary TaxpayerName MiddleInitial')&.text,
'Spouses Last Name': @xml_document.at('Secondary TaxpayerName LastName')&.text,
'SSNTaxpayer Identification Number_2': @xml_document.at('Secondary TaxpayerSSN')&.text,
'Primary signature': [@xml_document.at('Primary TaxpayerName FirstName')&.text, @xml_document.at('Primary TaxpayerName LastName')&.text].join(' '),
'Primary Date Signed': @xml_document.at('Primary DateSigned')&.text,
'Spouses signature': [@xml_document.at('Secondary TaxpayerName FirstName')&.text, @xml_document.at('Secondary TaxpayerName LastName')&.text].join(' '),
'Spouse Date Signed': @xml_document.at('Secondary DateSigned')&.text,
'Primary Esigned': checkbox_value(@submission.data_source.primary_esigned_yes?),
'ERO firm name': 'FileYourStateTaxes',
'ERO firm name 2': @submission.data_source.spouse_esigned_yes? ? 'FileYourStateTaxes' : "",
'Primary Signature Pin': @xml_document.at('Primary TaxpayerPIN')&.text,
'Spouse Esigned': checkbox_value(@submission.data_source.spouse_esigned_yes?),
'Secondary Signature Pin': @xml_document.at('Secondary TaxpayerPIN')&.text,
'2 Amount of overpayment to be refunded to you 2': calculated_fields.fetch(:MD502_LINE_48),
'3': calculated_fields.fetch(:MD502_LINE_50),
'I authorize': checkbox_value(@submission.data_source.primary_esigned_yes?),
'ERO firm name': 'FileYourStateTaxes',
'to enter or generate my PIN': @xml_document.at('Primary TaxpayerPIN')&.text,
'I authorize_2': checkbox_value(@submission.data_source.spouse_esigned_yes?),
'ERO firm name_2': @submission.data_source.spouse_esigned_yes? ? 'FileYourStateTaxes' : "",
'to enter or generate my PIN_2': @xml_document.at('Secondary TaxpayerPIN')&.text,
'Primary signature': signature,
Date: @xml_document.at('Primary DateSigned')&.text,
'Spouses signature': spouse_signature,
Date_2: @xml_document.at('Secondary DateSigned')&.text,
}
end

Expand Down
Binary file added app/lib/pdfs/mdEL101-TY2024.pdf
Binary file not shown.
56 changes: 54 additions & 2 deletions spec/lib/pdf_filler/md_el101_pdf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,46 @@
let(:pdf_fields) { filled_in_values(file_path) }
let(:intake) { create(:state_file_md_intake) }

before do
submission.data_source.direct_file_data.primary_ssn = '555123666'
submission.data_source.primary_esigned_yes!
submission.data_source.primary_esigned_at = 1.hour.ago
submission.data_source.primary_signature_pin = '23456'
end

it 'uses field names that exist in the pdf' do
missing_fields = pdf.hash_for_pdf.keys.map { |k| k.to_s.gsub("'", "'").to_s } - pdf_fields.keys
expect(missing_fields).to eq([])
end

context "single filer" do
it "fills out the required fields" do
expect(pdf_fields["First Name"]).to eq("Mary")
expect(pdf_fields["Primary MI"]).to eq("A")
expect(pdf_fields["Last Name"]).to eq("Lando")
expect(pdf_fields["SSNTaxpayer Identification Number"]).to eq("555123666")
expect(pdf_fields["ERO firm name"]).to eq "FileYourStateTaxes"
expect(pdf_fields["to enter or generate my PIN"]).to eq "23456"
expect(pdf_fields["Primary signature"]).to eq "Mary Lando"
expect(pdf_fields["Date"]).to eq Date.today.strftime("%F")
expect(pdf_fields["Spouses First Name"]).to eq("")
expect(pdf_fields["Spouse MI"]).to eq("")
expect(pdf_fields["Spouses Last Name"]).to eq("")
expect(pdf_fields["SSNTaxpayer Identification Number_2"]).to eq("")
expect(pdf_fields["ERO firm name_2"]).to eq ""
expect(pdf_fields["to enter or generate my PIN_2"]).to eq ""
expect(pdf_fields["Spouses signature"]).to eq ""
expect(pdf_fields["Date_2"]).to eq ""
end
end

context "when taxes are owed" do
before do
allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_45).and_return 100
end

it 'outputs the amount owed' do
it "fills out the required fields" do
expect(pdf_fields["2 Amount of overpayment to be refunded to you 2"]).to eq("0")
expect(pdf_fields["3"]).to eq "100"
end
end
Expand All @@ -32,8 +61,31 @@
allow_any_instance_of(Efile::Md::Md502Calculator).to receive(:calculate_line_46).and_return 300
end

it 'outputs the amount to be refunded' do
it "fills out the required fields" do
expect(pdf_fields["2 Amount of overpayment to be refunded to you 2"]).to eq "300"
expect(pdf_fields["3"]).to eq("0")
end
end

context "when mfj" do
let(:intake) { create(:state_file_md_intake, :with_spouse) }

before do
submission.data_source.direct_file_data.spouse_ssn = '555123456'
submission.data_source.spouse_esigned_yes!
submission.data_source.spouse_esigned_at = 1.hour.ago
submission.data_source.spouse_signature_pin = '11111'
end

it "fills out spouse information" do
expect(pdf_fields["Spouses First Name"]).to eq("Marty")
expect(pdf_fields["Spouse MI"]).to eq("B")
expect(pdf_fields["Spouses Last Name"]).to eq("Lando")
expect(pdf_fields["SSNTaxpayer Identification Number_2"]).to eq("555123456")
expect(pdf_fields["ERO firm name_2"]).to eq "FileYourStateTaxes"
expect(pdf_fields["to enter or generate my PIN_2"]).to eq "11111"
expect(pdf_fields["Spouses signature"]).to eq "Marty Lando"
expect(pdf_fields["Date_2"]).to eq Date.today.strftime("%F")
end
end
end
Expand Down

0 comments on commit b3ed502

Please sign in to comment.