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 230 - refactor return_header to remove state_code #5297

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jachan
Copy link
Contributor

@jachan jachan commented Dec 27, 2024

Link to pivotal/JIRA issue

Is PM acceptance required? (delete one)

  • No - merge after code review approval

Reminder: merge main into this branch and get green tests before merging to main

What was done?

  • Refactor based on Martha's comment on PR: NJ 229 - Add static paid preparer fields to return header #5266 (comment)
  • Previously, we relied on an if state_code == 'nj' statement to conditionally place PaidPreparerFields. This refactor makes the logic consistent across all states - if ptin and preparer_person_name are overwritten in the state's submission builder, it places the relevant fields in the Header.

How to test?

  • Run unit tests
  • Ran through FYST with jones_mfj persona, validated that NJ XML had PaidPreparerField block

Copy link

Heroku app: https://gyr-review-app-5297-8311d7a58f0a.herokuapp.com/
View logs: heroku logs --app gyr-review-app-5297 (optionally add --tail)

@@ -3,6 +3,10 @@ class ReturnHeader < SubmissionBuilder::Document
include SubmissionBuilder::FormattingMethods
include SubmissionBuilder::BusinessLogicMethods

def state_submission_builder
Copy link
Contributor

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

Copy link
Contributor Author

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 the StateInformationService. However, that can't be done within the existing structure, since this ReturnHeader 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 the StateInformationService to figure out what state it's representing.

The other ideas you suggest both seem like viable alternatives!

  1. Add to state intake, and then pull from intake here, rather than referencing the 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.

  1. Adding a separate NJ Return Header

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 the return_header method in the parent StateReturn class. We'd also need to create a new NjReturnHeader class that is essentially identical to return_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 the ReturnHeader and the NjReturnHeader classes.

Happy to discuss further with CfA about which option feels right here.

@@ -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?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

@mluedke2 mluedke2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like this to remove checks to state codes! once done in the test too, i approve 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants