diff --git a/app/models/claim.rb b/app/models/claim.rb index 7274a3e535..ed3f0a0f7a 100644 --- a/app/models/claim.rb +++ b/app/models/claim.rb @@ -448,10 +448,7 @@ def one_login_idv_mismatch? def awaiting_provider_verification? return false unless has_further_education_policy? - return false if eligibility.verified? - - # TODO - duplication with app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb - !eligibility.flagged_as_duplicate? || notes.where(label: "provider_verification").any? + eligibility.awaiting_provider_verification? end private diff --git a/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb b/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb index 890ca01694..a8ac063ad6 100644 --- a/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb +++ b/app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb @@ -30,7 +30,7 @@ def admin_sent_emails end def verification_email_sent? - !claim.eligibility.flagged_as_duplicate? || verification_email_sent_by_admin_team? + claim.eligibility.awaiting_provider_verification? end def verification_email_sent_by_admin_team? diff --git a/app/models/policies/further_education_payments/eligibility.rb b/app/models/policies/further_education_payments/eligibility.rb index 5ea2719296..ac6efa32fb 100644 --- a/app/models/policies/further_education_payments/eligibility.rb +++ b/app/models/policies/further_education_payments/eligibility.rb @@ -66,6 +66,13 @@ def permanent_contract? def verified? verification.present? end + + def awaiting_provider_verification? + return false if verified? + + # when a provider verification email is sent by the admin team, a note is created + !flagged_as_duplicate? || claim.notes.where(label: "provider_verification").any? + end end end end