-
Notifications
You must be signed in to change notification settings - Fork 13
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 663 implement form 502 su xml pdf part 1 #4942
Open
anisharamnani
wants to merge
14
commits into
main
Choose a base branch
from
FYST-663-Implement-Form-502SU-XML-PDF-Part-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+346
−8
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
12b484d
Add Form 502SU including names, SSN, and lines 1 and ab
60446d1
Merge branch 'main' into FYST-663-Implement-Form-502SU-XML-PDF-Part-1
b4bf32a
Add line data for 502SU and line 13 to 502 Return XML and PDF
b774206
Merge branch 'main' into FYST-663-Implement-Form-502SU-XML-PDF-Part-1
24a7220
Remove unncessary instance variables, add conditional formatting for …
a8d045a
Merge branch 'main' into FYST-663-Implement-Form-502SU-XML-PDF-Part-1
6f52348
Stub out additional code letters for form 502SU
f3a4e14
Fix condition for showing form 502SU and for adding the appropriate l…
c134305
Add line label for MD502_LINE_13 and fix test as well
2b2b355
Merge branch 'main' into FYST-663-Implement-Form-502SU-XML-PDF-Part-1
b5b2caa
Clean up formatting for appropriate letters for form 502
fbac69a
Reorder placement of 502SU in MD Return XML
0d3f01f
Merge branch 'main' into FYST-663-Implement-Form-502SU-XML-PDF-Part-1
f916e66
Reorder MD XML documents
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Efile | ||
module Md | ||
class Md502SuCalculator < ::Efile::TaxCalculator | ||
attr_reader :lines, :value_access_tracker | ||
|
||
def initialize(value_access_tracker:, lines:, intake:) | ||
@value_access_tracker = value_access_tracker | ||
@lines = lines | ||
intake = intake | ||
@direct_file_json_data = intake.direct_file_json_data | ||
end | ||
|
||
def calculate | ||
set_line(:MD502_SU_LINE_AB, :calculate_line_ab) | ||
set_line(:MD502_SU_LINE_U, :calculate_line_u) # STUBBED: PLEASE REPLACE, don't forget line_data.yml | ||
set_line(:MD502_SU_LINE_V, :calculate_line_v) # STUBBED: PLEASE REPLACE, don't forget line_data.yml | ||
set_line(:MD502_SU_LINE_1, :calculate_line_1) | ||
end | ||
|
||
private | ||
|
||
def calculate_line_ab | ||
@direct_file_json_data.interest_reports.sum(&:interest_on_government_bonds).round | ||
end | ||
|
||
def calculate_line_u; end | ||
|
||
def calculate_line_v; end | ||
|
||
def calculate_line_1 | ||
line_or_zero(:MD502_SU_LINE_AB) + line_or_zero(:MD502_SU_LINE_U) + line_or_zero(:MD502_SU_LINE_V) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module PdfFiller | ||
class Md502SuPdf | ||
include PdfHelper | ||
|
||
def source_pdf_name | ||
"md502SU-TY2023" | ||
end | ||
|
||
def initialize(submission) | ||
@submission = submission | ||
builder = StateFile::StateInformationService.submission_builder_class(:md) | ||
end | ||
|
||
def hash_for_pdf | ||
{ | ||
'Your First Name' => @submission.data_source.primary.first_name, | ||
'Text1' => @submission.data_source.primary.middle_initial, | ||
'Your Last Name' => @submission.data_source.primary.last_name, | ||
'Your Social Security Number' => @submission.data_source.primary.ssn, | ||
'Spouses First Name' => @submission.data_source.spouse.first_name, | ||
'Text2' => @submission.data_source.spouse.middle_initial, | ||
'Spouses Last Name' => @submission.data_source.spouse.last_name, | ||
'Spouses Social Security Number' => @submission.data_source.spouse.ssn, | ||
'ab Income from US Government obligations See Instruction 13 ab' => calculated_fields.fetch(:MD502_SU_LINE_AB), | ||
'appropriate code letters TOTAL 1' => calculated_fields.fetch(:MD502_SU_LINE_1), | ||
} | ||
end | ||
|
||
private | ||
|
||
def calculated_fields | ||
@calculated_fields ||= @submission.data_source.tax_calculator.calculate | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/lib/submission_builder/ty2024/states/md/documents/md502_su.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
module SubmissionBuilder | ||
module Ty2024 | ||
module States | ||
module Md | ||
module Documents | ||
class Md502Su < SubmissionBuilder::Document | ||
include SubmissionBuilder::FormattingMethods | ||
|
||
def document | ||
build_xml_doc("Form502SU", documentId: "Form502SU") do |xml| | ||
xml.Subtractions do |subtractions| | ||
subtractions.Total calculated_fields.fetch(:MD502_SU_LINE_1) | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def intake | ||
@submission.data_source | ||
end | ||
|
||
def calculated_fields | ||
@md502_su_fields ||= intake.tax_calculator.calculate | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'rails_helper' | ||
|
||
describe Efile::Md::Md502SuCalculator do | ||
let(:intake) { create(:state_file_md_intake) } | ||
let(:main_calculator) do | ||
Efile::Md::Md502Calculator.new( | ||
year: MultiTenantService.statefile.current_tax_year, | ||
intake: intake | ||
) | ||
end | ||
let(:instance) { main_calculator.instance_variable_get(:@md502_su) } | ||
|
||
describe 'line ab' do | ||
before do | ||
instance.calculate | ||
end | ||
|
||
context 'without interest reports' do | ||
it 'does not set line ab' do | ||
expect(instance.lines[:MD502_SU_LINE_AB].value).to eq(0) | ||
end | ||
end | ||
|
||
context 'with interest report' do | ||
let(:intake) { create(:state_file_md_intake, :df_data_1099_int) } | ||
it 'sets line ab' do | ||
expect(instance.lines[:MD502_SU_LINE_AB].value).to eq(2) | ||
end | ||
end | ||
end | ||
|
||
describe 'line 1' do | ||
it 'totals lines a through yc' do | ||
allow(instance).to receive(:calculate_line_ab).and_return 100 | ||
instance.calculate | ||
expect(instance.lines[:MD502_SU_LINE_1].value).to eq(100) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pebble] is there supposed to be an
=
here or isTotal
a method name receiving a parameter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is intentional! the
build_xml_doc
method generates the xml for the state return. therefore the value for Total will be assigned from this method.