Skip to content

Commit

Permalink
Add button to resend provider verification email
Browse files Browse the repository at this point in the history
The provider can only start the verification process via the link in the
email. If the provider has lost this email we need a mechanisim for the
ops team to resend the email.
As this admin logic is specific only to the FE policy we've opted to
move the controller into it's own namespace
  • Loading branch information
rjlynch committed Sep 5, 2024
1 parent f692d0c commit 89f12be
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions app/views/admin/tasks/provider_verification.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
<p class="govuk-body">
This task has not yet been completed by the provider
</p>

<%= govuk_button_to(
"Resend provider verification email",
admin_claim_further_education_payments_provider_verification_emails_path(@claim)
) %>
<% end %>
</div>

Expand Down
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 89f12be

Please sign in to comment.