From 632123580e88971495fbfbc77185188e2eb9a324 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Tue, 5 Nov 2024 16:19:06 +0000 Subject: [PATCH] remove email from EY practitioner magic link --- .../practitioner/find_reference_form.rb | 4 +-- app/mailers/claim_mailer.rb | 2 +- .../claims/find_reference.html.erb | 2 -- .../admin/admin_ey_identity_task_spec.rb | 2 +- .../practitioner/find_reference_spec.rb | 28 ++----------------- .../practitioner/find_reference_form_spec.rb | 11 ++------ .../claim_submission_form_spec.rb | 2 +- spec/mailers/claim_mailer_spec.rb | 2 +- 8 files changed, 11 insertions(+), 42 deletions(-) diff --git a/app/forms/journeys/early_years_payment/practitioner/find_reference_form.rb b/app/forms/journeys/early_years_payment/practitioner/find_reference_form.rb index 02d60c8c4e..159b30ec11 100644 --- a/app/forms/journeys/early_years_payment/practitioner/find_reference_form.rb +++ b/app/forms/journeys/early_years_payment/practitioner/find_reference_form.rb @@ -3,7 +3,6 @@ module EarlyYearsPayment module Practitioner class FindReferenceForm < Form attribute :reference_number, :string - attribute :email, :string validates :reference_number, presence: {message: i18n_error_message(:presence)} @@ -12,11 +11,10 @@ def save existing_claim = Claim .by_policy(Policies::EarlyYearsPayments) - .find_by(reference: reference_number, practitioner_email_address: email) + .find_by(reference: reference_number) journey_session.answers.assign_attributes( reference_number:, - start_email: email, reference_number_found: existing_claim.present?, claim_already_submitted: existing_claim&.submitted?, nursery_name: existing_claim&.eligibility&.eligible_ey_provider&.nursery_name diff --git a/app/mailers/claim_mailer.rb b/app/mailers/claim_mailer.rb index 777ab1f385..cb1b2d979d 100644 --- a/app/mailers/claim_mailer.rb +++ b/app/mailers/claim_mailer.rb @@ -236,7 +236,7 @@ def early_years_payment_provider_magic_link(one_time_password, email) end def early_years_practitioner_invite_link(claim:) - "https://#{ENV["CANONICAL_HOSTNAME"]}/#{Journeys::EarlyYearsPayment::Practitioner::ROUTING_NAME}/find-reference?skip_landing_page=true&email=#{CGI.escape(claim.practitioner_email_address)}" + "https://#{ENV["CANONICAL_HOSTNAME"]}/#{Journeys::EarlyYearsPayment::Practitioner::ROUTING_NAME}/find-reference?skip_landing_page=true" end def policy_check!(claim, policy) diff --git a/app/views/early_years_payment/practitioner/claims/find_reference.html.erb b/app/views/early_years_payment/practitioner/claims/find_reference.html.erb index af53199a42..547a790ad5 100644 --- a/app/views/early_years_payment/practitioner/claims/find_reference.html.erb +++ b/app/views/early_years_payment/practitioner/claims/find_reference.html.erb @@ -5,8 +5,6 @@ <%= form_with model: @form, url: claim_path(current_journey_routing_name, request.query_parameters), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %> <%= f.govuk_error_summary %> - <%= f.hidden_field :email, value: (params[:email] || journey_session.answers.attributes["start_email"]) %> -

<%= @form.t(:question) %>

diff --git a/spec/features/admin/admin_ey_identity_task_spec.rb b/spec/features/admin/admin_ey_identity_task_spec.rb index 002e718a73..cbe281f354 100644 --- a/spec/features/admin/admin_ey_identity_task_spec.rb +++ b/spec/features/admin/admin_ey_identity_task_spec.rb @@ -318,7 +318,7 @@ def complete_practitioner_journey( create(:journey_configuration, :early_years_payment_practitioner) - visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=practitioner@example.com" + visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true" fill_in "Claim reference number", with: claim.reference diff --git a/spec/features/early_years_payment/practitioner/find_reference_spec.rb b/spec/features/early_years_payment/practitioner/find_reference_spec.rb index 8cdc781a2d..d7533ae407 100644 --- a/spec/features/early_years_payment/practitioner/find_reference_spec.rb +++ b/spec/features/early_years_payment/practitioner/find_reference_spec.rb @@ -10,32 +10,10 @@ ) end - scenario "when correct email address with different case" do - when_early_years_payment_practitioner_journey_configuration_exists - - visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=USER@example.com" - expect(page).to have_content "Enter your claim reference" - fill_in "Claim reference number", with: claim.reference - click_button "Submit" - - expect(page).to have_content "Sign in with GOV.UK One Login" - end - - scenario "when different email address" do - when_early_years_payment_practitioner_journey_configuration_exists - - visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=other@example.com" - expect(page).to have_content "Enter your claim reference" - fill_in "Claim reference number", with: claim.reference - click_button "Submit" - - expect(page).to have_content "This claim reference isn’t correct." - end - scenario "after multiple attempts should work" do when_early_years_payment_practitioner_journey_configuration_exists - visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=user@example.com" + visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true" expect(page).to have_content "Enter your claim reference" fill_in "Claim reference number", with: claim.reference click_button "Submit" @@ -52,7 +30,7 @@ scenario "should show ineligibility page when an invalid reference is given" do when_early_years_payment_practitioner_journey_configuration_exists - visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=user@example.com" + visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true" expect(page).to have_content "Enter your claim reference" fill_in "Claim reference number", with: "invalid" click_button "Submit" @@ -87,7 +65,7 @@ scenario "should show ineligibility page when a submitted claim reference is given" do when_early_years_payment_practitioner_journey_configuration_exists - visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=user@example.com" + visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true" expect(page).to have_content "Enter your claim reference" fill_in "Claim reference number", with: claim.reference click_button "Submit" diff --git a/spec/forms/journeys/early_years_payment/practitioner/find_reference_form_spec.rb b/spec/forms/journeys/early_years_payment/practitioner/find_reference_form_spec.rb index 86d0be3040..604c5df27c 100644 --- a/spec/forms/journeys/early_years_payment/practitioner/find_reference_form_spec.rb +++ b/spec/forms/journeys/early_years_payment/practitioner/find_reference_form_spec.rb @@ -7,12 +7,11 @@ let(:journey_session) { create(:early_years_payment_practitioner_session) } let(:reference_number) { nil } - let(:email) { nil } let(:eligible_ey_provider) { create(:eligible_ey_provider) } let(:params) do - ActionController::Parameters.new(claim: {reference_number:, email:}) + ActionController::Parameters.new(claim: {reference_number:}) end describe "validations" do @@ -25,14 +24,12 @@ context "when EY claim" do let(:reference_number) { claim.reference } - let(:email) { claim.practitioner_email_address } let(:claim) do create( :claim, policy: Policies::EarlyYearsPayments, - reference: "foo", - practitioner_email_address: "user@example.com" + reference: "foo" ) end @@ -120,13 +117,11 @@ context "when reference is a non EY claim" do let(:reference_number) { claim.reference } - let(:email) { claim.practitioner_email_address } let(:claim) do create( :claim, - reference: "foo", - practitioner_email_address: "user@example.com" + reference: "foo" ) end diff --git a/spec/forms/journeys/early_years_payment/provider/authenticated/claim_submission_form_spec.rb b/spec/forms/journeys/early_years_payment/provider/authenticated/claim_submission_form_spec.rb index 3615a3c654..39eef83f7e 100644 --- a/spec/forms/journeys/early_years_payment/provider/authenticated/claim_submission_form_spec.rb +++ b/spec/forms/journeys/early_years_payment/provider/authenticated/claim_submission_form_spec.rb @@ -54,7 +54,7 @@ full_name: claim.full_name, setting_name: claim.eligibility.eligible_ey_provider.nursery_name, ref_number: claim.reference, - complete_claim_url: "https://www.example.com/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=johndoe%40example.com" + complete_claim_url: "https://www.example.com/early-years-payment-practitioner/find-reference?skip_landing_page=true" ) ) end diff --git a/spec/mailers/claim_mailer_spec.rb b/spec/mailers/claim_mailer_spec.rb index 106217ec23..47f1664806 100644 --- a/spec/mailers/claim_mailer_spec.rb +++ b/spec/mailers/claim_mailer_spec.rb @@ -406,7 +406,7 @@ class SomePolicy; end full_name: "Test Practitioner", setting_name: "Test Nursery", ref_number: "TEST123", - complete_claim_url: "https://www.example.com/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=practitioner%40example.com" + complete_claim_url: "https://www.example.com/early-years-payment-practitioner/find-reference?skip_landing_page=true" } expect(mail[:personalisation].unparsed_value).to eql(expected_personalisation)