-
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
NJ 230 - refactor return_header to remove state_code #5297
Open
jachan
wants to merge
2
commits into
main
Choose a base branch
from
nj-230-state-code-refactor
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.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
jachan marked this conversation as resolved.
Show resolved
Hide resolved
|
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 |
---|---|---|
@@ -1,18 +1,20 @@ | ||
module SubmissionBuilder | ||
class StateReturn < SubmissionBuilder::Document | ||
def document | ||
@document = state_schema_version.present? ? | ||
build_xml_doc(build_xml_doc_tag, stateSchemaVersion: state_schema_version) : | ||
@document = if state_schema_version.present? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Linter changes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, can manually disable the linter and fix if folks prefer the old way. |
||
build_xml_doc(build_xml_doc_tag, stateSchemaVersion: state_schema_version) | ||
else | ||
build_xml_doc(build_xml_doc_tag) | ||
end | ||
build_headers | ||
build_main_document | ||
build_documents | ||
build_state_specific_tags(@document) | ||
@document | ||
end | ||
|
||
def pdf_documents | ||
included_documents.map { |item| item if item.pdf }.compact | ||
included_documents.select { |item| item.pdf } | ||
end | ||
|
||
def build_headers | ||
|
@@ -50,7 +52,7 @@ def attached_documents | |
end | ||
|
||
def xml_documents | ||
included_documents.map { |item| item if item.xml }.compact | ||
included_documents.select { |item| item.xml } | ||
end | ||
|
||
def included_documents | ||
|
@@ -128,5 +130,9 @@ def state_schema_version; end | |
def build_state_specific_tags(_); end | ||
|
||
def documents_wrapper; end | ||
|
||
def self.preparer_person_name; end | ||
|
||
def self.ptin; 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
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.
[dust] It would make more sense to me to add ptin and preparer_person_name as methods on the default and NJ intakes rather than introduce this pattern of pulling from state submission builder, OR to add an NJ return header similar to the NJ W2. I do see that this PR follows @mpidcock's suggestion though, so I'm commenting mostly to try to understand why this implementation
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.
I think the original plan was to try and remove all
state_code
references entirely, including referencing theStateInformationService
. However, that can't be done within the existing structure, since thisReturnHeader
is shared between all states. It has no knowledge of what state it's representing without using state_code. The solution I chose uses the existing state_submission_builder attribute in theStateInformationService
to figure out what state it's representing.The other ideas you suggest both seem like viable alternatives!
StateInformationService
.I prefer to avoid using intake, since conceptually, this doesn't match with how we utilize
intake
.intake
is used for user input, while this is something static that appears on every NJ return, regardless of what the user selects.This was the approach I originally had in mind. I'm not quite sure what it would take to implement though. I believe it would involve modifying the
NjReturnXml
child class to override thereturn_header
method in the parentStateReturn
class. We'd also need to create a newNjReturnHeader
class that is essentially identical toreturn_header.rb
, but adds the PaidPreparerFields. This approach feels most correct to me, but I recognize it would involve a lot of duplicated XML between theReturnHeader
and theNjReturnHeader
classes.Happy to discuss further with CfA about which option feels right here.