diff --git a/app/controllers/admin/further_education_payments/provider_verification_emails_controller.rb b/app/controllers/admin/further_education_payments/provider_verification_emails_controller.rb new file mode 100644 index 0000000000..d847cdf80f --- /dev/null +++ b/app/controllers/admin/further_education_payments/provider_verification_emails_controller.rb @@ -0,0 +1,17 @@ +module Admin + module FurtherEducationPayments + class ProviderVerificationEmailsController < Admin::BaseAdminController + before_action :ensure_service_operator + + def create + claim = Claim.find(params[:claim_id]) + + ClaimMailer.further_education_payment_provider_verification_email(claim).deliver_later + + flash[:notice] = "Verification email sent to #{claim.school.name}" + + redirect_back(fallback_location: admin_claim_path(claim)) + end + end + end +end diff --git a/app/views/admin/tasks/provider_verification.html.erb b/app/views/admin/tasks/provider_verification.html.erb index b27437be5a..a09b0baf3c 100644 --- a/app/views/admin/tasks/provider_verification.html.erb +++ b/app/views/admin/tasks/provider_verification.html.erb @@ -52,6 +52,11 @@

This task has not yet been completed by the provider

+ + <%= govuk_button_to( + "Resend provider verification email", + admin_claim_further_education_payments_provider_verification_emails_path(@claim) + ) %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index ebc26afad7..fbeb9df00f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -126,6 +126,9 @@ def matches?(request) get "search", on: :collection patch "hold" patch "unhold" + namespace :further_education_payments do + resources :provider_verification_emails, only: [:create] + end end resources :qualification_report_uploads, only: [:new, :create] diff --git a/spec/features/admin/admin_claim_further_education_payments_spec.rb b/spec/features/admin/admin_claim_further_education_payments_spec.rb index cbac04d165..8bdc8918d3 100644 --- a/spec/features/admin/admin_claim_further_education_payments_spec.rb +++ b/spec/features/admin/admin_claim_further_education_payments_spec.rb @@ -10,7 +10,12 @@ describe "provider verification task" do context "when the provider is yet to verify the claim" do it "shows the task as pending" do - fe_provider = create(:school, :further_education, name: "Springfield A and M") + fe_provider = create( + :school, + :further_education, + :fe_eligible, + name: "Springfield A and M" + ) claim = create( :claim, @@ -39,6 +44,24 @@ expect(page).to have_content( "This task has not yet been completed by the provider" ) + + perform_enqueued_jobs do + click_on "Resend provider verification email" + end + + provider_email_address = claim.school.eligible_fe_provider.primary_key_contact_email_address + + expect(provider_email_address).to( + have_received_email( + "9a25fe46-2ee4-4a5c-8d47-0f04f058a87d", + recipient_name: "Springfield A and M", + claimant_name: "Edna Krabappel", + claim_reference: "AB123456", + claim_submission_date: "1 August 2024", + verification_due_date: "15 August 2024", + verification_url: Journeys::FurtherEducationPayments::Provider::SlugSequence.verify_claim_url(claim) + ) + ) end end