From ddfd974f9edc3d8d3644c80255dc420c5dd09cce Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Fri, 27 Sep 2024 12:30:09 +0100 Subject: [PATCH] update EY practitioner email invite link --- app/mailers/claim_mailer.rb | 7 +++++-- .../provider/authenticated/claim_submission_form_spec.rb | 2 +- spec/mailers/claim_mailer_spec.rb | 9 ++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/mailers/claim_mailer.rb b/app/mailers/claim_mailer.rb index 0be387b0a0..7da5c336b2 100644 --- a/app/mailers/claim_mailer.rb +++ b/app/mailers/claim_mailer.rb @@ -90,8 +90,7 @@ def early_years_payment_practitioner_email(claim) full_name: claim.full_name, setting_name: claim.eligibility.eligible_ey_provider.nursery_name, ref_number: claim.reference, - # TODO: Reference new route for practitioner journey - complete_claim_url: "https://gov.uk/claim-an-early-years-financial-incentive-payment?claim=#{claim.reference}&email=#{CGI.escape claim.practitioner_email_address}" + complete_claim_url: early_years_practitioner_invite_link(claim:) } template_id = template_ids(claim)[:CLAIM_PRACTITIONER_NOTIFY_TEMPLATE_ID] @@ -212,6 +211,10 @@ def early_years_payment_provider_magic_link(one_time_password, email) "https://#{ENV["CANONICAL_HOSTNAME"]}/#{Journeys::EarlyYearsPayment::Provider::Authenticated::ROUTING_NAME}/claim?code=#{one_time_password}&email=#{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)}" + end + def policy_check!(claim, policy) return if claim.policy == policy 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 3be4d88636..9fed2e5aab 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 @@ -50,7 +50,7 @@ full_name: claim.full_name, setting_name: claim.eligibility.eligible_ey_provider.nursery_name, ref_number: claim.reference, - complete_claim_url: "https://gov.uk/claim-an-early-years-financial-incentive-payment?claim=#{claim.reference}&email=#{CGI.escape claim.practitioner_email_address}" + complete_claim_url: "https://www.example.com/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=johndoe%40example.com" ) ) end diff --git a/spec/mailers/claim_mailer_spec.rb b/spec/mailers/claim_mailer_spec.rb index 29ace77d76..7cd447bc71 100644 --- a/spec/mailers/claim_mailer_spec.rb +++ b/spec/mailers/claim_mailer_spec.rb @@ -401,7 +401,14 @@ class SomePolicy; end before { claim.eligibility.update!(nursery_urn: eligible_ey_provider.urn) } it "has personalisation keys for: full_name, setting_name, ref_number, complete_claim_url" do - expect(mail[:personalisation].decoded).to eq("{:full_name=>\"Test Practitioner\", :setting_name=>\"Test Nursery\", :ref_number=>\"TEST123\", :complete_claim_url=>\"https://gov.uk/claim-an-early-years-financial-incentive-payment?claim=TEST123&email=practitioner%40example.com\"}") + expected_personalisation = { + 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" + } + + expect(mail[:personalisation].unparsed_value).to eql(expected_personalisation) expect(mail.body).to be_empty end end