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

NJ 269 - populate fill if paying by check/card in PDF #5515

Merged
merged 4 commits into from
Feb 5, 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
2 changes: 2 additions & 0 deletions app/lib/efile/line_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,8 @@ NJ1040_LINE_78:
label: '78 Total Adjustments to Tax Due/Overpayment amount (Add lines 69 through 77)'
NJ1040_LINE_79:
label: '79 Balance due (If line 67 is more than zero, add line 67 and line 78)'
NJ1040_LINE_79_CHECKBOX:
label: 'Fill in if paying by e-check or credit card'
NJ1040_LINE_80:
label: '80 Refund amount (If line 68 is more than zero, subtract line 78 from line 68)'
NJ2450_COLUMN_A_TOTAL_PRIMARY:
Expand Down
5 changes: 5 additions & 0 deletions app/lib/efile/nj/nj1040_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def calculate
set_line(:NJ1040_LINE_77, :calculate_line_77)
set_line(:NJ1040_LINE_78, :calculate_line_78)
set_line(:NJ1040_LINE_79, :calculate_line_79)
set_line(:NJ1040_LINE_79_CHECKBOX, :calculate_line_79_checkbox)
set_line(:NJ1040_LINE_80, :calculate_line_80)
@nj2450_primary.calculate if line_59_primary || line_61_primary
@nj2450_spouse.calculate if line_59_spouse || line_61_spouse
Expand Down Expand Up @@ -601,6 +602,10 @@ def calculate_line_79
0
end

def calculate_line_79_checkbox
@intake.payment_or_deposit_type_direct_deposit? && line_or_zero(:NJ1040_LINE_79).positive?
end

def calculate_line_80
if line_or_zero(:NJ1040_LINE_68).positive?
# Line 78 is always 0 now
Expand Down
3 changes: 3 additions & 0 deletions app/lib/pdf_filler/nj1040_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def hash_for_pdf
# line 65 nj child tax credit
'64': @xml_document.at("Body NJChildTCNumOfDep")&.text,

# line 79 payment checkbox
Line77bdue: calculated_fields_not_in_xml.fetch(:NJ1040_LINE_79_CHECKBOX) ? "On" : "Off",

# Gubernatorial elections fund
Group245: @xml_document.at("Body PrimGubernElectFund").present? ? 'Choice1' : 'Choice2',
Group246: if get_mfj_spouse_ssn
Expand Down
36 changes: 36 additions & 0 deletions spec/lib/efile/nj/nj1040_calculator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2147,6 +2147,42 @@ def over_65_birth_year
end
end

describe 'line 79 checkbox' do
let(:intake) { create(:state_file_nj_intake, payment_or_deposit_type: payment_or_deposit_type) }

def stub_balance_owed(balance)
allow(instance).to receive(:calculate_line_67).and_return balance
instance.calculate
end

context 'when user selected pay by mail & owes a balance' do
let(:payment_or_deposit_type) { :mail }

it 'returns false' do
stub_balance_owed(100)
expect(instance.lines[:NJ1040_LINE_79_CHECKBOX].value).to eq(false)
end
end

context 'when user selected pay by direct debit & owes a balance' do
let(:payment_or_deposit_type) { :direct_deposit }

it 'returns true' do
stub_balance_owed(100)
expect(instance.lines[:NJ1040_LINE_79_CHECKBOX].value).to eq(true)
end
end

context 'when user selected pay by direct debit but is not owing a balance' do
let(:payment_or_deposit_type) { :direct_deposit }

it 'returns false' do
stub_balance_owed(0)
expect(instance.lines[:NJ1040_LINE_79_CHECKBOX].value).to eq(false)
end
end
end

describe 'line 80 Refund amount' do
it 'returns 0 when line 68 is not above 0' do
allow(instance).to receive(:calculate_line_68).and_return 0
Expand Down
12 changes: 12 additions & 0 deletions spec/lib/pdf_filler/nj1040_pdf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2201,6 +2201,18 @@
end
end

describe 'line 79 - paying by e-check / credit card checkbox' do
it 'checks box when calculated is true' do
allow_any_instance_of(Efile::Nj::Nj1040Calculator).to receive(:calculate_line_79_checkbox).and_return true
expect(pdf_fields["Line77bdue"]).to eq "On"
end

it 'does not check box when calculated is false' do
allow_any_instance_of(Efile::Nj::Nj1040Calculator).to receive(:calculate_line_79_checkbox).and_return false
expect(pdf_fields["Line77bdue"]).to eq "Off"
end
end

describe 'line 80 - Refund amount' do
it 'inserts xml output' do
allow_any_instance_of(Efile::Nj::Nj1040Calculator).to receive(:calculate_line_80).and_return 12_345_678
Expand Down
Loading