-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3100 from DFE-Digital/fe-eligibility-fields
LUPEYALPHA-862 copy session answers over to eligiblity model on submi…
- Loading branch information
Showing
18 changed files
with
324 additions
and
20 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
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
db/migrate/20240814123634_add_answer_fields_to_fe_eligibilities.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 @@ | ||
class AddAnswerFieldsToFeEligibilities < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :further_education_payments_eligibilities, :teaching_responsibilities, :boolean | ||
add_column :further_education_payments_eligibilities, :provision_search, :text | ||
add_reference :further_education_payments_eligibilities, :possible_school, type: :uuid, foreign_key: {to_table: :schools}, index: {name: :index_fe_payments_eligibilities_on_possible_school_id} | ||
add_reference :further_education_payments_eligibilities, :school, type: :uuid, foreign_key: {to_table: :schools}, index: {name: :index_fe_payments_eligibilities_on_school_id} | ||
add_column :further_education_payments_eligibilities, :contract_type, :text | ||
add_column :further_education_payments_eligibilities, :fixed_term_full_year, :boolean | ||
add_column :further_education_payments_eligibilities, :taught_at_least_one_term, :boolean | ||
add_column :further_education_payments_eligibilities, :teaching_hours_per_week, :text | ||
add_column :further_education_payments_eligibilities, :teaching_hours_per_week_next_term, :text | ||
add_column :further_education_payments_eligibilities, :further_education_teaching_start_year, :text | ||
add_column :further_education_payments_eligibilities, :subjects_taught, :jsonb, default: [] | ||
add_column :further_education_payments_eligibilities, :building_construction_courses, :jsonb, default: [] | ||
add_column :further_education_payments_eligibilities, :chemistry_courses, :jsonb, default: [] | ||
add_column :further_education_payments_eligibilities, :computing_courses, :jsonb, default: [] | ||
add_column :further_education_payments_eligibilities, :early_years_courses, :jsonb, default: [] | ||
add_column :further_education_payments_eligibilities, :engineering_manufacturing_courses, :jsonb, default: [] | ||
add_column :further_education_payments_eligibilities, :maths_courses, :jsonb, default: [] | ||
add_column :further_education_payments_eligibilities, :physics_courses, :jsonb, default: [] | ||
add_column :further_education_payments_eligibilities, :hours_teaching_eligible_subjects, :boolean | ||
add_column :further_education_payments_eligibilities, :teaching_qualification, :text | ||
add_column :further_education_payments_eligibilities, :subject_to_formal_performance_action, :boolean | ||
add_column :further_education_payments_eligibilities, :subject_to_disciplinary_action, :boolean | ||
add_column :further_education_payments_eligibilities, :half_teaching_hours, :boolean | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AddOneloginFieldsToClaims < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :claims, :identity_confirmed_with_onelogin, :boolean | ||
add_column :claims, :logged_in_with_onelogin, :boolean | ||
add_column :claims, :onelogin_credentials, :jsonb, default: {} | ||
add_column :claims, :onelogin_user_info, :jsonb, default: {} | ||
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
108 changes: 105 additions & 3 deletions
108
spec/factories/journeys/further_education_payments/further_education_payments_answers.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 |
---|---|---|
@@ -1,13 +1,115 @@ | ||
FactoryBot.define do | ||
factory :further_education_payments_answers, class: "Journeys::FurtherEducationPayments::SessionAnswers" do | ||
trait :with_details_from_onelogin do | ||
trait :with_name do | ||
first_name { "Jo" } | ||
surname { "Bloggs" } | ||
onelogin_user_info { {email: "[email protected]"} } | ||
end | ||
|
||
trait :with_details_from_onelogin do | ||
with_name | ||
onelogin_user_info { {"email" => "[email protected]"} } | ||
end | ||
|
||
trait :with_onelogin_credentials do | ||
onelogin_credentials { {"id_token" => "some_token"} } | ||
end | ||
|
||
trait :with_dob do | ||
date_of_birth { 20.years.ago.to_date } | ||
end | ||
|
||
trait :with_nino do | ||
national_insurance_number { generate(:national_insurance_number) } | ||
end | ||
|
||
trait :with_personal_details do | ||
with_details_from_onelogin | ||
with_dob | ||
with_nino | ||
end | ||
|
||
trait :with_email_details do | ||
email_address { generate(:email_address) } | ||
email_verified { true } | ||
end | ||
|
||
trait :with_mobile_details do | ||
mobile_number { "07474000123" } | ||
provide_mobile_number { true } | ||
mobile_verified { true } | ||
end | ||
|
||
trait :with_bank_details do | ||
bank_or_building_society { :personal_bank_account } | ||
banking_name { "Jo Bloggs" } | ||
bank_sort_code { rand(100000..999999) } | ||
bank_account_number { rand(10000000..99999999) } | ||
end | ||
|
||
trait :with_bank_details_validated do | ||
hmrc_bank_validation_succeeded { true } | ||
hmrc_bank_validation_responses do | ||
[ | ||
{code: 200, body: "Test response"} | ||
] | ||
end | ||
end | ||
|
||
trait :with_payroll_gender do | ||
payroll_gender { "female" } | ||
end | ||
|
||
trait :with_teacher_reference_number do | ||
teacher_reference_number { generate(:teacher_reference_number) } | ||
end | ||
|
||
trait :permanent do | ||
contract_type { "permanent" } | ||
teaching_hours_per_week { "more_than_12" } | ||
end | ||
|
||
trait :with_academic_year do | ||
academic_year { AcademicYear.current } | ||
end | ||
|
||
trait :eligible do | ||
teaching_responsibilities { true } | ||
school_id { create(:school, :further_education, :fe_eligible).id } | ||
permanent | ||
further_education_teaching_start_year { "2019" } | ||
subjects_taught { ["maths", "physics"] } | ||
maths_courses { ["approved_level_321_maths", "gcse_maths"] } | ||
physics_courses { ["gcse_physics"] } | ||
hours_teaching_eligible_subjects { true } | ||
half_teaching_hours { true } | ||
teaching_qualification { "yes" } | ||
subject_to_formal_performance_action { false } | ||
subject_to_disciplinary_action { false } | ||
end | ||
|
||
trait :with_award_amount do | ||
award_amount { 4_000.0 } | ||
end | ||
|
||
trait :with_address do | ||
address_line_1 { "1 Test Road" } | ||
address_line_2 { "Some Second Line" } | ||
address_line_3 { "Some Town" } | ||
address_line_4 { "Some County" } | ||
postcode { "WIA OAA" } | ||
end | ||
|
||
trait :submittable do | ||
# FIXME implement this trait with the details required to submit a claim | ||
with_academic_year | ||
eligible | ||
with_award_amount | ||
with_personal_details | ||
with_address | ||
with_email_details | ||
with_mobile_details | ||
with_bank_details | ||
with_bank_details_validated | ||
with_payroll_gender | ||
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.