-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into nj-293-move-retirement-screen
- Loading branch information
Showing
105 changed files
with
4,596 additions
and
292 deletions.
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
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
3 changes: 2 additions & 1 deletion
3
app/controllers/state_file/archived_intakes/archived_intake_controller.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
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
27 changes: 27 additions & 0 deletions
27
app/controllers/state_file/questions/id_disability_controller.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,27 @@ | ||
module StateFile | ||
module Questions | ||
class IdDisabilityController < QuestionsController | ||
def self.show?(intake) | ||
Flipper.enabled?(:show_retirement_ui) && | ||
intake.state_file1099_rs.any? { |form1099r| form1099r.taxable_amount&.to_f&.positive? } && | ||
!intake.filing_status_mfs? && meets_age_requirements?(intake) | ||
end | ||
|
||
def self.meets_age_requirements?(intake) | ||
primary_age = intake.calculate_age(intake.primary_birth_date, inclusive_of_jan_1: true) | ||
if intake.filing_status_mfj? && intake.spouse_birth_date.present? | ||
spouse_age = intake.calculate_age(intake.spouse_birth_date, inclusive_of_jan_1: true) | ||
(primary_age >= 62 && primary_age < 65) || (spouse_age >= 62 && spouse_age < 65) | ||
else | ||
primary_age >= 62 && primary_age < 65 | ||
end | ||
end | ||
|
||
private | ||
|
||
def form_params | ||
params.require(:state_file_id_disability_form).permit(:mfj_disability, :primary_disabled, :spouse_disabled) | ||
end | ||
end | ||
end | ||
end |
53 changes: 53 additions & 0 deletions
53
app/controllers/state_file/questions/id_retirement_and_pension_income_controller.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,53 @@ | ||
module StateFile | ||
module Questions | ||
class IdRetirementAndPensionIncomeController < RetirementIncomeSubtractionController | ||
def self.show?(intake) | ||
Flipper.enabled?(:show_retirement_ui) && !intake.filing_status_mfs? && | ||
has_eligible_1099rs?(intake) | ||
end | ||
|
||
def self.has_eligible_1099rs?(intake) | ||
intake.state_file1099_rs.any? do |form1099r| | ||
form1099r.taxable_amount&.to_f&.positive? && person_qualifies?(form1099r, intake) | ||
end | ||
end | ||
|
||
def self.person_qualifies?(form1099r, intake) | ||
primary_tin = intake.primary.ssn | ||
spouse_tin = intake.spouse&.ssn | ||
|
||
case form1099r.recipient_ssn | ||
when primary_tin | ||
intake.primary_disabled_yes? || intake.primary_senior? | ||
when spouse_tin | ||
intake.spouse_disabled_yes? || intake.spouse_senior? | ||
else | ||
false | ||
end | ||
end | ||
|
||
private | ||
|
||
def person_qualifies?(form1099r) | ||
self.class.person_qualifies?(form1099r, current_intake) | ||
end | ||
|
||
def eligible_1099rs | ||
@eligible_1099rs ||= current_intake.state_file1099_rs.select do |form1099r| | ||
form1099r.taxable_amount&.to_f&.positive? && person_qualifies?(form1099r) | ||
end | ||
end | ||
|
||
def num_items | ||
eligible_1099rs.count | ||
end | ||
|
||
def load_item(index) | ||
@state_file_1099r = eligible_1099rs[index] | ||
render "public_pages/page_not_found", status: 404 if @state_file_1099r.nil? | ||
end | ||
|
||
def followup_class = StateFileId1099RFollowup | ||
end | ||
end | ||
end |
1 change: 1 addition & 0 deletions
1
app/controllers/state_file/questions/md_permanently_disabled_controller.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
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,49 @@ | ||
module StateFile | ||
class IdDisabilityForm < QuestionsForm | ||
set_attributes_for :intake, :primary_disabled, :spouse_disabled | ||
|
||
attr_accessor :mfj_disability | ||
validates_presence_of :mfj_disability, if: -> { intake.filing_status_mfj?} | ||
validates :primary_disabled, inclusion: { in: %w[yes no], message: :blank }, unless: -> { intake.filing_status_mfj? } | ||
|
||
def save | ||
if intake.filing_status_mfj? | ||
primary_eligible = eligible?(:primary) | ||
spouse_eligible = eligible?(:spouse) | ||
|
||
case mfj_disability | ||
when "me" | ||
@intake.update(primary_disabled: primary_eligible ? "yes" : "no", spouse_disabled: "no") | ||
when "spouse" | ||
@intake.update(primary_disabled: "no", spouse_disabled: spouse_eligible ? "yes" : "no") | ||
when "both" | ||
@intake.update( | ||
primary_disabled: primary_eligible ? "yes" : "no", | ||
spouse_disabled: spouse_eligible ? "yes" : "no" | ||
) | ||
when "none" | ||
@intake.update(primary_disabled: "no", spouse_disabled: "no") | ||
end | ||
else | ||
@intake.update(attributes_for(:intake)) | ||
end | ||
end | ||
|
||
private | ||
|
||
def eligible?(primary_or_spouse) | ||
person = intake.send(primary_or_spouse) | ||
birth_date = person.birth_date | ||
return false unless birth_date.present? | ||
|
||
age = intake.calculate_age(birth_date, inclusive_of_jan_1: true) | ||
age_eligible = age >= 62 && age < 65 | ||
|
||
has_taxable_1099r = intake.state_file1099_rs.any? do |form| | ||
form.recipient_ssn == person.ssn && form.taxable_amount&.to_f&.positive? | ||
end | ||
|
||
age_eligible && has_taxable_1099r | ||
end | ||
end | ||
end |
19 changes: 19 additions & 0 deletions
19
app/forms/state_file/id_retirement_and_pension_income_form.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,19 @@ | ||
module StateFile | ||
class IdRetirementAndPensionIncomeForm < Form | ||
include FormAttributes | ||
|
||
|
||
set_attributes_for :state_file_id1099_r_followup, :eligible_income_source | ||
|
||
validates :eligible_income_source, presence: true | ||
|
||
def initialize(state_file_id1099_r_followup = nil, params = {}) | ||
@state_file_id1099_r_followup = state_file_id1099_r_followup | ||
super(params) | ||
end | ||
|
||
def save | ||
@state_file_id1099_r_followup.update(attributes_for(:state_file_id1099_r_followup)) | ||
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
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.