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

Move journey_requires_student_loan_details method #3384

Merged
merged 1 commit into from
Nov 13, 2024
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
28 changes: 2 additions & 26 deletions app/controllers/claims_form_callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ def personal_bank_account_before_update
end

def information_provided_before_update
return unless journey_requires_student_loan_details?
return unless journey.requires_student_loan_details?

retrieve_student_loan_details if on_tid_route?
end

def personal_details_after_form_save_success
return redirect_to_next_slug unless journey_requires_student_loan_details?
return redirect_to_next_slug unless journey.requires_student_loan_details?

retrieve_student_loan_details
redirect_to_next_slug
Expand Down Expand Up @@ -119,28 +119,4 @@ def current_hmrc_validation_attempt_count
def on_tid_route?
journey_session.answers.logged_in_with_tid? && journey_session.answers.all_personal_details_same_as_tid?
end

def journey_requires_student_loan_details?
student_loans_journey? || additional_payments_journey? || get_a_teacher_relocation_payment_journey? || further_education_payments_journey? || early_years_payments_practitioner_journey?
end

def student_loans_journey?
current_journey_routing_name == "student-loans"
end

def additional_payments_journey?
current_journey_routing_name == "additional-payments"
end

def get_a_teacher_relocation_payment_journey?
current_journey_routing_name == "get-a-teacher-relocation-payment"
end

def further_education_payments_journey?
current_journey_routing_name == "further-education-payments"
end

def early_years_payments_practitioner_journey?
current_journey_routing_name == "early-years-payment-practitioner"
end
end
4 changes: 4 additions & 0 deletions app/models/journeys/additional_payments_for_teaching.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@ def set_a_reminder?(itt_academic_year:, policy:)
eligible_itt_years = JourneySubjectEligibilityChecker.selectable_itt_years_for_claim_year(next_year)
eligible_itt_years.include?(itt_academic_year)
end

def requires_student_loan_details?
true
end
end
end
4 changes: 4 additions & 0 deletions app/models/journeys/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,9 @@ def answers_for_claim(journey_session)
def start_with_magic_link?
defined?(self::START_WITH_MAGIC_LINK) && self::START_WITH_MAGIC_LINK
end

def requires_student_loan_details?
false
end
end
end
4 changes: 4 additions & 0 deletions app/models/journeys/early_years_payment/practitioner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ module Practitioner
"enter-home-address" => AddressForm
}
}

def requires_student_loan_details?
true
end
end
end
end
4 changes: 4 additions & 0 deletions app/models/journeys/further_education_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@ module FurtherEducationPayments
"teacher-reference-number" => TeacherReferenceNumberForm
}
}

def requires_student_loan_details?
true
end
end
end
4 changes: 4 additions & 0 deletions app/models/journeys/get_a_teacher_relocation_payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ module GetATeacherRelocationPayment
"personal-details" => PersonalDetailsForm
}
}

def requires_student_loan_details?
true
end
end
end
4 changes: 4 additions & 0 deletions app/models/journeys/teacher_student_loan_reimbursement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ module TeacherStudentLoanReimbursement
"select-home-address" => SelectHomeAddressForm
}
}.freeze

def requires_student_loan_details?
true
end
end
end