From d9d8256a85df0f67ae7022f92b0659a69d486c64 Mon Sep 17 00:00:00 2001 From: Abigail McPhillips Date: Thu, 25 Jul 2024 15:01:48 +0100 Subject: [PATCH] Namespace journey to EarlyYearsPayment::Provider Change the journey from EarlyYearsPayment to EarlyYearsPayment::Provider since there will be a second journey relating to the practitioner answers --- app/models/journeys.rb | 2 +- app/models/journeys/early_years_payment.rb | 14 ------- .../eligibility_checker.rb | 6 --- .../journeys/early_years_payment/provider.rb | 16 +++++++ .../provider/eligibility_checker.rb | 8 ++++ .../early_years_payment/provider/session.rb | 9 ++++ .../provider/session_answers.rb | 11 +++++ .../provider/session_answers_type.rb | 7 ++++ .../provider/slug_sequence.rb | 42 +++++++++++++++++++ .../journeys/early_years_payment/session.rb | 7 ---- .../early_years_payment/session_answers.rb | 9 ---- .../session_answers_type.rb | 5 --- .../early_years_payment/slug_sequence.rb | 40 ------------------ app/models/policies/early_years_payment.rb | 14 ------- .../early_years_payment/eligibility.rb | 17 -------- .../policy_eligibility_checker.rb | 23 ---------- .../policies/early_years_payment/provider.rb | 16 +++++++ .../provider/eligibility.rb | 19 +++++++++ .../provider/policy_eligibility_checker.rb | 25 +++++++++++ .../{ => provider}/landing_page.html.erb | 4 +- config/analytics.yml | 2 +- config/locales/en.yml | 6 ++- ...reate_early_years_payment_eligibilities.rb | 7 ---- ...ly_years_payment_provider_eligibilities.rb | 7 ++++ db/schema.rb | 2 +- db/seeds.rb | 2 +- spec/factories/journey_configurations.rb | 4 +- .../early_years_payment/happy_path_spec.rb | 10 ----- .../provider/happy_path_spec.rb | 10 +++++ spec/models/journeys_spec.rb | 4 +- spec/support/steps/journey_configuration.rb | 4 +- 31 files changed, 186 insertions(+), 166 deletions(-) delete mode 100644 app/models/journeys/early_years_payment.rb delete mode 100644 app/models/journeys/early_years_payment/eligibility_checker.rb create mode 100644 app/models/journeys/early_years_payment/provider.rb create mode 100644 app/models/journeys/early_years_payment/provider/eligibility_checker.rb create mode 100644 app/models/journeys/early_years_payment/provider/session.rb create mode 100644 app/models/journeys/early_years_payment/provider/session_answers.rb create mode 100644 app/models/journeys/early_years_payment/provider/session_answers_type.rb create mode 100644 app/models/journeys/early_years_payment/provider/slug_sequence.rb delete mode 100644 app/models/journeys/early_years_payment/session.rb delete mode 100644 app/models/journeys/early_years_payment/session_answers.rb delete mode 100644 app/models/journeys/early_years_payment/session_answers_type.rb delete mode 100644 app/models/journeys/early_years_payment/slug_sequence.rb delete mode 100644 app/models/policies/early_years_payment.rb delete mode 100644 app/models/policies/early_years_payment/eligibility.rb delete mode 100644 app/models/policies/early_years_payment/policy_eligibility_checker.rb create mode 100644 app/models/policies/early_years_payment/provider.rb create mode 100644 app/models/policies/early_years_payment/provider/eligibility.rb create mode 100644 app/models/policies/early_years_payment/provider/policy_eligibility_checker.rb rename app/views/early_years_payment/{ => provider}/landing_page.html.erb (94%) delete mode 100644 db/migrate/20240724092519_create_early_years_payment_eligibilities.rb create mode 100644 db/migrate/20240724092519_create_early_years_payment_provider_eligibilities.rb delete mode 100644 spec/features/early_years_payment/happy_path_spec.rb create mode 100644 spec/features/early_years_payment/provider/happy_path_spec.rb diff --git a/app/models/journeys.rb b/app/models/journeys.rb index 2a731c9efb..f0943fcb55 100644 --- a/app/models/journeys.rb +++ b/app/models/journeys.rb @@ -10,7 +10,7 @@ def self.table_name_prefix TeacherStudentLoanReimbursement, GetATeacherRelocationPayment, FurtherEducationPayments, - EarlyYearsPayment + EarlyYearsPayment::Provider ].freeze def all diff --git a/app/models/journeys/early_years_payment.rb b/app/models/journeys/early_years_payment.rb deleted file mode 100644 index 1a7513b63b..0000000000 --- a/app/models/journeys/early_years_payment.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Journeys - module EarlyYearsPayment - extend Base - extend self - - ROUTING_NAME = "early-years-payment" - VIEW_PATH = "early_years_payment" - I18N_NAMESPACE = "early_years_payment" - POLICIES = [Policies::EarlyYearsPayment] - FORMS = { - "claims" => {} - } - end -end diff --git a/app/models/journeys/early_years_payment/eligibility_checker.rb b/app/models/journeys/early_years_payment/eligibility_checker.rb deleted file mode 100644 index b71f4e0165..0000000000 --- a/app/models/journeys/early_years_payment/eligibility_checker.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Journeys - module EarlyYearsPayment - class EligibilityChecker < Journeys::EligibilityChecker - end - end -end diff --git a/app/models/journeys/early_years_payment/provider.rb b/app/models/journeys/early_years_payment/provider.rb new file mode 100644 index 0000000000..e284c5967f --- /dev/null +++ b/app/models/journeys/early_years_payment/provider.rb @@ -0,0 +1,16 @@ +module Journeys + module EarlyYearsPayment + module Provider + extend Base + extend self + + ROUTING_NAME = "early-years-payment-provider" + VIEW_PATH = "early_years_payment/provider" + I18N_NAMESPACE = "early_years_payment_provider" + POLICIES = [Policies::EarlyYearsPayment::Provider] + FORMS = { + "claims" => {} + } + end + end +end diff --git a/app/models/journeys/early_years_payment/provider/eligibility_checker.rb b/app/models/journeys/early_years_payment/provider/eligibility_checker.rb new file mode 100644 index 0000000000..41dc18f9d9 --- /dev/null +++ b/app/models/journeys/early_years_payment/provider/eligibility_checker.rb @@ -0,0 +1,8 @@ +module Journeys + module EarlyYearsPayment + module Provider + class EligibilityChecker < Journeys::EligibilityChecker + end + end + end +end diff --git a/app/models/journeys/early_years_payment/provider/session.rb b/app/models/journeys/early_years_payment/provider/session.rb new file mode 100644 index 0000000000..6bbc126e49 --- /dev/null +++ b/app/models/journeys/early_years_payment/provider/session.rb @@ -0,0 +1,9 @@ +module Journeys + module EarlyYearsPayment + module Provider + class Session < Journeys::Session + attribute :answers, SessionAnswersType.new + end + end + end +end diff --git a/app/models/journeys/early_years_payment/provider/session_answers.rb b/app/models/journeys/early_years_payment/provider/session_answers.rb new file mode 100644 index 0000000000..2eaa758595 --- /dev/null +++ b/app/models/journeys/early_years_payment/provider/session_answers.rb @@ -0,0 +1,11 @@ +module Journeys + module EarlyYearsPayment + module Provider + class SessionAnswers < Journeys::SessionAnswers + def policy + Policies::EarlyYearsPayment::Provider + end + end + end + end +end diff --git a/app/models/journeys/early_years_payment/provider/session_answers_type.rb b/app/models/journeys/early_years_payment/provider/session_answers_type.rb new file mode 100644 index 0000000000..5ae13b57cd --- /dev/null +++ b/app/models/journeys/early_years_payment/provider/session_answers_type.rb @@ -0,0 +1,7 @@ +module Journeys + module EarlyYearsPayment + module Provider + class SessionAnswersType < ::Journeys::SessionAnswersType; end + end + end +end diff --git a/app/models/journeys/early_years_payment/provider/slug_sequence.rb b/app/models/journeys/early_years_payment/provider/slug_sequence.rb new file mode 100644 index 0000000000..14f1357832 --- /dev/null +++ b/app/models/journeys/early_years_payment/provider/slug_sequence.rb @@ -0,0 +1,42 @@ +module Journeys + module EarlyYearsPayment + module Provider + class SlugSequence + ELIGIBILITY_SLUGS = %w[].freeze + + PERSONAL_DETAILS_SLUGS = %w[].freeze + + PAYMENT_DETAILS_SLUGS = %w[].freeze + + RESULTS_SLUGS = %w[].freeze + + SLUGS = ( + ELIGIBILITY_SLUGS + + PERSONAL_DETAILS_SLUGS + + PAYMENT_DETAILS_SLUGS + + RESULTS_SLUGS + ).freeze + + def self.start_page_url + if Rails.env.production? + "https://www.example.com" # TODO: update to correct guidance + else + Rails.application.routes.url_helpers.landing_page_path("early-years-payment-provider") + end + end + + attr_reader :journey_session + + delegate :answers, to: :journey_session + + def initialize(journey_session) + @journey_session = journey_session + end + + def slugs + SLUGS + end + end + end + end +end diff --git a/app/models/journeys/early_years_payment/session.rb b/app/models/journeys/early_years_payment/session.rb deleted file mode 100644 index be4599b33c..0000000000 --- a/app/models/journeys/early_years_payment/session.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Journeys - module EarlyYearsPayment - class Session < Journeys::Session - attribute :answers, SessionAnswersType.new - end - end -end diff --git a/app/models/journeys/early_years_payment/session_answers.rb b/app/models/journeys/early_years_payment/session_answers.rb deleted file mode 100644 index 3bbb00480b..0000000000 --- a/app/models/journeys/early_years_payment/session_answers.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Journeys - module EarlyYearsPayment - class SessionAnswers < Journeys::SessionAnswers - def policy - Policies::EarlyYearsPayment - end - end - end -end diff --git a/app/models/journeys/early_years_payment/session_answers_type.rb b/app/models/journeys/early_years_payment/session_answers_type.rb deleted file mode 100644 index 847947da5e..0000000000 --- a/app/models/journeys/early_years_payment/session_answers_type.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Journeys - module EarlyYearsPayment - class SessionAnswersType < ::Journeys::SessionAnswersType; end - end -end diff --git a/app/models/journeys/early_years_payment/slug_sequence.rb b/app/models/journeys/early_years_payment/slug_sequence.rb deleted file mode 100644 index a1c3b7e049..0000000000 --- a/app/models/journeys/early_years_payment/slug_sequence.rb +++ /dev/null @@ -1,40 +0,0 @@ -module Journeys - module EarlyYearsPayment - class SlugSequence - ELIGIBILITY_SLUGS = %w[].freeze - - PERSONAL_DETAILS_SLUGS = %w[].freeze - - PAYMENT_DETAILS_SLUGS = %w[].freeze - - RESULTS_SLUGS = %w[].freeze - - SLUGS = ( - ELIGIBILITY_SLUGS + - PERSONAL_DETAILS_SLUGS + - PAYMENT_DETAILS_SLUGS + - RESULTS_SLUGS - ).freeze - - def self.start_page_url - if Rails.env.production? - "https://www.example.com" # TODO: update to correct guidance - else - Rails.application.routes.url_helpers.landing_page_path("early-years-payment") - end - end - - attr_reader :journey_session - - delegate :answers, to: :journey_session - - def initialize(journey_session) - @journey_session = journey_session - end - - def slugs - SLUGS - end - end - end -end diff --git a/app/models/policies/early_years_payment.rb b/app/models/policies/early_years_payment.rb deleted file mode 100644 index 2f15831956..0000000000 --- a/app/models/policies/early_years_payment.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Policies - module EarlyYearsPayment - include BasePolicy - extend self - - # Percentage of claims to QA - MIN_QA_THRESHOLD = 10 - - # TODO: This is needed once the reply-to email address has been added to Gov Notify - def notify_reply_to_id - nil - end - end -end diff --git a/app/models/policies/early_years_payment/eligibility.rb b/app/models/policies/early_years_payment/eligibility.rb deleted file mode 100644 index fd8245bae4..0000000000 --- a/app/models/policies/early_years_payment/eligibility.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Policies - module EarlyYearsPayment - class Eligibility < ApplicationRecord - self.table_name = "early_years_payment_eligibilities" - - has_one :claim, as: :eligibility, inverse_of: :eligibility - - def policy - Policies::EarlyYearsPayment - end - - def ineligible? - false - end - end - end -end diff --git a/app/models/policies/early_years_payment/policy_eligibility_checker.rb b/app/models/policies/early_years_payment/policy_eligibility_checker.rb deleted file mode 100644 index b21a53db58..0000000000 --- a/app/models/policies/early_years_payment/policy_eligibility_checker.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Policies - module EarlyYearsPayment - class PolicyEligibilityChecker - attr_reader :answers - - delegate_missing_to :answers - - def initialize(answers:) - @answers = answers - end - - def status - return :ineligible if ineligible? - - :eligible_now - end - - def ineligible? - false - end - end - end -end diff --git a/app/models/policies/early_years_payment/provider.rb b/app/models/policies/early_years_payment/provider.rb new file mode 100644 index 0000000000..4af61dd8d1 --- /dev/null +++ b/app/models/policies/early_years_payment/provider.rb @@ -0,0 +1,16 @@ +module Policies + module EarlyYearsPayment + module Provider + include BasePolicy + extend self + + # Percentage of claims to QA + MIN_QA_THRESHOLD = 10 + + # TODO: This is needed once the reply-to email address has been added to Gov Notify + def notify_reply_to_id + nil + end + end + end +end diff --git a/app/models/policies/early_years_payment/provider/eligibility.rb b/app/models/policies/early_years_payment/provider/eligibility.rb new file mode 100644 index 0000000000..2459c38c0f --- /dev/null +++ b/app/models/policies/early_years_payment/provider/eligibility.rb @@ -0,0 +1,19 @@ +module Policies + module EarlyYearsPayment + module Provider + class Eligibility < ApplicationRecord + self.table_name = "early_years_payment_provider_eligibilities" + + has_one :claim, as: :eligibility, inverse_of: :eligibility + + def policy + Policies::EarlyYearsPayment::Provider + end + + def ineligible? + false + end + end + end + end +end diff --git a/app/models/policies/early_years_payment/provider/policy_eligibility_checker.rb b/app/models/policies/early_years_payment/provider/policy_eligibility_checker.rb new file mode 100644 index 0000000000..4192c2eb71 --- /dev/null +++ b/app/models/policies/early_years_payment/provider/policy_eligibility_checker.rb @@ -0,0 +1,25 @@ +module Policies + module EarlyYearsPayment + module Provider + class PolicyEligibilityChecker + attr_reader :answers + + delegate_missing_to :answers + + def initialize(answers:) + @answers = answers + end + + def status + return :ineligible if ineligible? + + :eligible_now + end + + def ineligible? + false + end + end + end + end +end diff --git a/app/views/early_years_payment/landing_page.html.erb b/app/views/early_years_payment/provider/landing_page.html.erb similarity index 94% rename from app/views/early_years_payment/landing_page.html.erb rename to app/views/early_years_payment/provider/landing_page.html.erb index 2c12d0758a..7af7929ee3 100644 --- a/app/views/early_years_payment/landing_page.html.erb +++ b/app/views/early_years_payment/provider/landing_page.html.erb @@ -1,6 +1,6 @@
-

<%= t("early_years_payment.journey_name") %>

+

<%= t("early_years_payment_provider.landing_page.title") %>

Use this service to make an early years financial incentive payment claim @@ -124,7 +124,7 @@

You can cancel a claim or get help on this service by contacting us at - <%= govuk_link_to t("early_years_payment.feedback_email"), "mailto:#{t("early_years_payment.feedback_email")}", no_visited_state: true %>. + <%= govuk_link_to t("early_years_payment_provider.feedback_email"), "mailto:#{t("early_years_payment_provider.feedback_email")}", no_visited_state: true %>.

diff --git a/config/analytics.yml b/config/analytics.yml index a6c8dde7bf..2f31f03235 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -278,7 +278,7 @@ shared: - lower_award_amount - created_at - updated_at - :early_years_payment_eligibilities: + :early_years_payment_provider_eligibilities: - id - created_at - updated_at diff --git a/config/locales/en.yml b/config/locales/en.yml index 079ed1c3c9..b987776a90 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1019,8 +1019,10 @@ en: By submitting this you are confirming that, to the best of your knowledge, the details you are providing are correct. btn_text: Accept and send - early_years_payment: - journey_name: Claim an early years financial incentive payment + early_years_payment_provider: + journey_name: Claim an early years financial incentive payment - provider + landing_page: + title: Claim an early years financial incentive payment feedback_email: "help@opsteam.education.gov.uk" activerecord: errors: diff --git a/db/migrate/20240724092519_create_early_years_payment_eligibilities.rb b/db/migrate/20240724092519_create_early_years_payment_eligibilities.rb deleted file mode 100644 index a3b78c1405..0000000000 --- a/db/migrate/20240724092519_create_early_years_payment_eligibilities.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateEarlyYearsPaymentEligibilities < ActiveRecord::Migration[7.0] - def change - create_table :early_years_payment_eligibilities, id: :uuid do |t| - t.timestamps - end - end -end diff --git a/db/migrate/20240724092519_create_early_years_payment_provider_eligibilities.rb b/db/migrate/20240724092519_create_early_years_payment_provider_eligibilities.rb new file mode 100644 index 0000000000..bb54764af5 --- /dev/null +++ b/db/migrate/20240724092519_create_early_years_payment_provider_eligibilities.rb @@ -0,0 +1,7 @@ +class CreateEarlyYearsPaymentProviderEligibilities < ActiveRecord::Migration[7.0] + def change + create_table :early_years_payment_provider_eligibilities, id: :uuid do |t| + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index c282dd5529..7a97da6a27 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -175,7 +175,7 @@ t.index ["teacher_reference_number"], name: "index_ecp_eligibility_trn" end - create_table "early_years_payment_eligibilities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "early_years_payment_provider_eligibilities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false end diff --git a/db/seeds.rb b/db/seeds.rb index 3ccf91ad6c..cf8141c936 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -11,7 +11,7 @@ Journeys::Configuration.create!(routing_name: Journeys::AdditionalPaymentsForTeaching::ROUTING_NAME, current_academic_year: AcademicYear.current) Journeys::Configuration.create!(routing_name: Journeys::GetATeacherRelocationPayment::ROUTING_NAME, current_academic_year: AcademicYear.current) Journeys::Configuration.create!(routing_name: Journeys::FurtherEducationPayments::ROUTING_NAME, current_academic_year: AcademicYear.current) - Journeys::Configuration.create!(routing_name: Journeys::EarlyYearsPayment::ROUTING_NAME, current_academic_year: AcademicYear.current) + Journeys::Configuration.create!(routing_name: Journeys::EarlyYearsPayment::Provider::ROUTING_NAME, current_academic_year: AcademicYear.current) ENV["FIXTURES_PATH"] = "spec/fixtures" ENV["FIXTURES"] = "local_authorities,local_authority_districts,schools" diff --git a/spec/factories/journey_configurations.rb b/spec/factories/journey_configurations.rb index 87b8e9c22c..b9e008fae8 100644 --- a/spec/factories/journey_configurations.rb +++ b/spec/factories/journey_configurations.rb @@ -30,8 +30,8 @@ routing_name { Journeys::FurtherEducationPayments::ROUTING_NAME } end - trait :early_years_payment do - routing_name { Journeys::EarlyYearsPayment::ROUTING_NAME } + trait :early_years_payment_provider do + routing_name { Journeys::EarlyYearsPayment::Provider::ROUTING_NAME } end trait :closed do diff --git a/spec/features/early_years_payment/happy_path_spec.rb b/spec/features/early_years_payment/happy_path_spec.rb deleted file mode 100644 index 4af011ddae..0000000000 --- a/spec/features/early_years_payment/happy_path_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require "rails_helper" - -RSpec.feature "Early years payment" do - scenario "happy path claim" do - when_early_years_payment_journey_configuration_exists - - visit landing_page_path(Journeys::EarlyYearsPayment::ROUTING_NAME) - expect(page).to have_link("Start now") - end -end diff --git a/spec/features/early_years_payment/provider/happy_path_spec.rb b/spec/features/early_years_payment/provider/happy_path_spec.rb new file mode 100644 index 0000000000..3643bb1f86 --- /dev/null +++ b/spec/features/early_years_payment/provider/happy_path_spec.rb @@ -0,0 +1,10 @@ +require "rails_helper" + +RSpec.feature "Early years payment provider" do + scenario "happy path claim" do + when_early_years_payment_provider_journey_configuration_exists + + visit landing_page_path(Journeys::EarlyYearsPayment::Provider::ROUTING_NAME) + expect(page).to have_link("Start now") + end +end diff --git a/spec/models/journeys_spec.rb b/spec/models/journeys_spec.rb index 7df7ac3288..25dbf99a58 100644 --- a/spec/models/journeys_spec.rb +++ b/spec/models/journeys_spec.rb @@ -10,7 +10,7 @@ Journeys::TeacherStudentLoanReimbursement, Journeys::GetATeacherRelocationPayment, Journeys::FurtherEducationPayments, - Journeys::EarlyYearsPayment + Journeys::EarlyYearsPayment::Provider ]) end end @@ -22,7 +22,7 @@ Journeys::TeacherStudentLoanReimbursement::ROUTING_NAME, Journeys::GetATeacherRelocationPayment::ROUTING_NAME, Journeys::FurtherEducationPayments::ROUTING_NAME, - Journeys::EarlyYearsPayment::ROUTING_NAME + Journeys::EarlyYearsPayment::Provider::ROUTING_NAME ]) end end diff --git a/spec/support/steps/journey_configuration.rb b/spec/support/steps/journey_configuration.rb index 35ec4323ea..f187f429c3 100644 --- a/spec/support/steps/journey_configuration.rb +++ b/spec/support/steps/journey_configuration.rb @@ -2,6 +2,6 @@ def when_further_education_payments_journey_configuration_exists create(:journey_configuration, :further_education_payments) end -def when_early_years_payment_journey_configuration_exists - create(:journey_configuration, :early_years_payment) +def when_early_years_payment_provider_journey_configuration_exists + create(:journey_configuration, :early_years_payment_provider) end