Skip to content

Commit

Permalink
update EY practitioner email invite link
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Sep 30, 2024
1 parent a83a913 commit ddfd974
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 5 additions & 2 deletions app/mailers/claim_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion spec/mailers/claim_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ddfd974

Please sign in to comment.