Skip to content

Commit

Permalink
EY practitioner email address and verification
Browse files Browse the repository at this point in the history
  • Loading branch information
alkesh committed Sep 27, 2024
1 parent d684b63 commit b552b30
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module EarlyYearsPayment
module Practitioner
class SessionAnswers < Journeys::SessionAnswers
def policy
nil
Policies::EarlyYearsPayments
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class SlugSequence
personal-details
enter-home-address
email-address
email-verification
mobile-number
].freeze

def self.start_page_url
Expand Down
6 changes: 2 additions & 4 deletions app/views/claims/_one_time_password.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<%= form_with model: form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_error_summary %>

<% caption_settings = { text: "#{email_or_mobile == "email" ? "Email address" : "Mobile number"} verification", size: "xl" } if show_caption %>
<%= f.govuk_text_field :one_time_password,
width: 5,
autocomplete: "off",
Expand All @@ -13,10 +14,7 @@
tag: "h1",
size: "l"
},
caption: {
text: "#{email_or_mobile == "email" ? "Email address" : "Mobile number"} verification",
size: "xl"
},
caption: caption_settings,
hint: -> do %>
<p>
<%= t("one_time_password.hint1_html", email_or_mobile_message: email_or_text_message, email_or_mobile_value: email_or_mobile_value) %>
Expand Down
3 changes: 2 additions & 1 deletion app/views/claims/email_verification.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
form: @form,
current_journey_routing_name: current_journey_routing_name,
email_or_mobile: "email",
email_or_text_message: "an email"
email_or_text_message: "an email",
show_caption: true
}
) %>
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
<p class="govuk-body">email address page goes here</p>
<% content_for(:page_title, page_title("Your email address", journey: current_journey_routing_name, show_error: @form.errors.any?)) %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_for @form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %>
<%= f.govuk_error_summary %>

<%= f.govuk_text_field :email_address,
autocomplete: "email",
spellcheck: "false",
label: {
text: @form.t("label"),
tag: "h1",
size: "l"
},
hint: -> do %>
<p><%= @form.t("hint1") %></p>
<p><%= @form.t("hint2") %></p>
<% end %>

<%= f.govuk_submit %>
<% end %>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<% content_for(
:page_title,
page_title(
t("one_time_password.title"),
journey: current_journey_routing_name,
show_error: @form.errors.any?
)
) %>

<%= render(
partial: "one_time_password",
locals: {
form: @form,
current_journey_routing_name: current_journey_routing_name,
email_or_mobile: "email",
email_or_text_message: "an email",
show_caption: false
}
) %>
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,11 @@ en:
journey_name: Claim an early years financial incentive payment - practitioner
feedback_email: [email protected]
claim_description: for early years financial incentive payment
forms:
email_address:
label: Your email address
hint1: We’ll use this to update you with progress on your claim.
hint2: We recommend you use a non-work email address in case your circumstances change while we process your claim.
activerecord:
errors:
models:
Expand Down
11 changes: 11 additions & 0 deletions spec/features/early_years_payment/practitioner/happy_path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,16 @@
fill_in "County", with: "City of Derby"
fill_in "Postcode", with: "DE22 4BS"
click_on "Continue"

expect(page.title).to have_text("Your email address")
expect(page).to have_content("Your email address")
fill_in "claim-email-address-field", with: "[email protected]"
click_on "Continue"

expect(page).to have_content("Enter the 6-digit passcode")
mail = ActionMailer::Base.deliveries.last
otp_in_mail_sent = mail[:personalisation].unparsed_value[:one_time_password]
fill_in "claim-one-time-password-field", with: otp_in_mail_sent
click_on "Confirm"
end
end

0 comments on commit b552b30

Please sign in to comment.