diff --git a/app/models/journeys/early_years_payment/practitioner/session_answers.rb b/app/models/journeys/early_years_payment/practitioner/session_answers.rb index 2d4065923d..383a577ffa 100644 --- a/app/models/journeys/early_years_payment/practitioner/session_answers.rb +++ b/app/models/journeys/early_years_payment/practitioner/session_answers.rb @@ -3,7 +3,7 @@ module EarlyYearsPayment module Practitioner class SessionAnswers < Journeys::SessionAnswers def policy - nil + Policies::EarlyYearsPayments end end end diff --git a/app/models/journeys/early_years_payment/practitioner/slug_sequence.rb b/app/models/journeys/early_years_payment/practitioner/slug_sequence.rb index 2f098d9368..f059bb7b85 100644 --- a/app/models/journeys/early_years_payment/practitioner/slug_sequence.rb +++ b/app/models/journeys/early_years_payment/practitioner/slug_sequence.rb @@ -9,6 +9,8 @@ class SlugSequence personal-details enter-home-address email-address + email-verification + mobile-number ].freeze def self.start_page_url diff --git a/app/views/claims/_one_time_password.html.erb b/app/views/claims/_one_time_password.html.erb index 67fac5914e..1835071f37 100644 --- a/app/views/claims/_one_time_password.html.erb +++ b/app/views/claims/_one_time_password.html.erb @@ -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", @@ -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 %>

<%= t("one_time_password.hint1_html", email_or_mobile_message: email_or_text_message, email_or_mobile_value: email_or_mobile_value) %> diff --git a/app/views/claims/email_verification.html.erb b/app/views/claims/email_verification.html.erb index 712fa47c5e..be0131397f 100644 --- a/app/views/claims/email_verification.html.erb +++ b/app/views/claims/email_verification.html.erb @@ -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 } ) %> diff --git a/app/views/early_years_payment/practitioner/claims/email_address.html.erb b/app/views/early_years_payment/practitioner/claims/email_address.html.erb index ddd00ddeb2..85d16ba087 100644 --- a/app/views/early_years_payment/practitioner/claims/email_address.html.erb +++ b/app/views/early_years_payment/practitioner/claims/email_address.html.erb @@ -1 +1,24 @@ -

email address page goes here

+<% content_for(:page_title, page_title("Your email address", journey: current_journey_routing_name, show_error: @form.errors.any?)) %> + +
+
+ <%= 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 %> +

<%= @form.t("hint1") %>

+

<%= @form.t("hint2") %>

+ <% end %> + + <%= f.govuk_submit %> + <% end %> +
+
diff --git a/app/views/early_years_payment/practitioner/claims/email_verification.html.erb b/app/views/early_years_payment/practitioner/claims/email_verification.html.erb new file mode 100644 index 0000000000..abd32ca320 --- /dev/null +++ b/app/views/early_years_payment/practitioner/claims/email_verification.html.erb @@ -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 + } +) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 653bf0bb5e..81a3696611 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1403,6 +1403,11 @@ en: journey_name: Claim an early years financial incentive payment - practitioner feedback_email: implementme@example.com 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: diff --git a/spec/features/early_years_payment/practitioner/happy_path_spec.rb b/spec/features/early_years_payment/practitioner/happy_path_spec.rb index 217c9a9208..4006429bad 100644 --- a/spec/features/early_years_payment/practitioner/happy_path_spec.rb +++ b/spec/features/early_years_payment/practitioner/happy_path_spec.rb @@ -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: "johndoe@example.com" + 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