Skip to content

Commit

Permalink
Az 8879 e-file authorization form #186264976 (#3800)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lou Moore authored Nov 21, 2023
1 parent e746ab5 commit 81ca793
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/lib/efile/az/az140.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def calculate
end

def refund_or_owed_amount
calculate_line_79
calculate_line_79 - calculate_line_80
end

private
Expand Down
70 changes: 70 additions & 0 deletions app/lib/pdf_filler/az8879_pdf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module PdfFiller
class Az8879Pdf
include PdfHelper

def source_pdf_name
"az8879-TY2023"
end

def initialize(submission)
@submission = submission

# Most PDF fields are grabbed right off the XML
@xml_document = SubmissionBuilder::Ty2022::States::Az::IndividualReturn.new(submission).document
end

def hash_for_pdf
answers = {
"Your First Name and Initial" => @submission.data_source.primary.first_name_and_middle_initial,
"Your Last Name" => @submission.data_source.primary.last_name,
"Your SSN" => @submission.data_source.primary.ssn,
"Spouse First Name and Initial" => @submission.data_source.spouse.first_name_and_middle_initial,
"Spouse Last Name" => @submission.data_source.spouse.last_name,
"Spouse SSN" => @submission.data_source.spouse.ssn,
"1 AZ AGI" => @xml_document.at('AZAdjGrossIncome')&.text,
"2 Balance of Tax" => @xml_document.at("BalanceOfTaxDue")&.text,
"3 AZ Income Tax Withheld" => @xml_document.at("AzIncTaxWithheld")&.text,
}

if @xml_document.at('RefundAmt').present?
answers["4 Refund Checkbox"] = 'Yes'
answers["4 Refund Amount"] = @xml_document.at("RefundAmt")&.text
elsif @xml_document.at('AmtOwed').present?
answers["5 Owed Checkbox"] = 'Yes'
answers["5 Owed Amount"] = @xml_document.at("AmtOwed")&.text
end

# TODO: double check assumption that "Foreign Account Checkbox" will always be unchecked
case @submission.data_source.account_type
when 'checking'
answers['Account Type Checkbox - Checking'] = 'Yes'
when 'savings'
answers['Account Type Checkbox - Savings'] = 'Yes'
end

answers.merge!(
"Routing Number" => @submission.data_source.routing_number,
"Account Number" => @submission.data_source.account_number,
"Direct Debit Date" => @submission.data_source.date_electronic_withdrawal&.strftime("%m%d%Y"),
"Direct Debit Amount" => @submission.data_source.withdraw_amount,
"Electronic Return Originator" => 'Code for America Labs, Inc'
)

if @submission.data_source.primary_esigned_yes?
answers["Your Signature"] = @submission.data_source.primary.full_name
answers["Your Date Signed"] = @submission.data_source.primary_esigned_at.to_date
if @xml_document.at('RefundAmt').present?
answers["6a Checkbox"] = 'Yes'
elsif @xml_document.at('AmtOwed').present?
answers["6b Checkbox"] = 'Yes'
answers["6c Checkbox"] = 'Yes'
end
end
if @submission.data_source.spouse_esigned_yes?
answers["Spouse Signature"] = @submission.data_source.spouse.full_name
answers["Spouse Date Signed"] = @submission.data_source.spouse_esigned_at.to_date
end
answers
end
end
end
Binary file added app/lib/pdfs/az8879-TY2023.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ def supported_documents
xml: nil,
pdf: PdfFiller::Az140Pdf,
include: true
},
{
xml: nil,
pdf: PdfFiller::Az8879Pdf,
include: true
}
]
@submission.data_source.state_file1099_gs.each do |form1099g|
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 @@ -80,6 +80,10 @@ def initialize(intake, primary_or_spouse)
def full_name
[@first_name, @middle_initial, @last_name].map(&:presence).compact.join(' ')
end

def first_name_and_middle_initial
[@first_name, @middle_initial].map(&:presence).compact.join(' ')
end
end

def disqualifying_eligibility_answer
Expand Down
2 changes: 1 addition & 1 deletion app/views/state_file/questions/az_review/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="highlight-box highlight-box--blue spacing-below-15 padding-20">
<div class="spacing-below-5">
<p class="text--bold spacing-below-5"><%=@refund_or_owed_label %></p>
<p class="spacing-below-0"><%=number_to_currency(@refund_or_owed_amount) %></p>
<p class="spacing-below-0"><%=number_to_currency(@refund_or_owed_amount.abs) %></p>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/state_file/questions/ny_review/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="highlight-box highlight-box--blue spacing-below-15 padding-20">
<div class="spacing-below-5">
<p class="text--bold spacing-below-5"><%=@refund_or_owed_label %></p>
<p class="spacing-below-0"><%=number_to_currency(@refund_or_owed_amount) %></p>
<p class="spacing-below-0"><%=number_to_currency(@refund_or_owed_amount.abs) %></p>
</div>
</div>

Expand Down
16 changes: 16 additions & 0 deletions spec/lib/pdf_filler/az8879_pdf_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'rails_helper'

RSpec.describe PdfFiller::Az8879Pdf do
include PdfSpecHelper

let(:submission) { create :efile_submission, tax_return: nil, data_source: create(:state_file_az_intake) }
let(:pdf) { described_class.new(submission) }

describe '#hash_for_pdf' do
it 'uses field names that exist in the pdf' do
pdf_fields = filled_in_values(submission.generate_filing_pdf.path)
missing_fields = pdf.hash_for_pdf.keys.map(&:to_s) - pdf_fields.keys
expect(missing_fields).to eq([])
end
end
end

0 comments on commit 81ca793

Please sign in to comment.