-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add models (journey, eligibility, session, session_answers, slug_sequence, policy) for the new EarlyYearsPayment journey. - Add basic happy path spec that visits the landing page. - Add basic view for landing page - Include the new journey config in the seeds - Add migration to create early_years_payment_eligibilities.
- Loading branch information
1 parent
c423f29
commit db39d8f
Showing
20 changed files
with
203 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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 |
6 changes: 6 additions & 0 deletions
6
app/models/journeys/early_years_payment/eligibility_checker.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
class EligibilityChecker < Journeys::EligibilityChecker | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
class Session < Journeys::Session | ||
attribute :answers, SessionAnswersType.new | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
class SessionAnswers < Journeys::SessionAnswers | ||
def policy | ||
Policies::EarlyYearsPayment | ||
end | ||
end | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
app/models/journeys/early_years_payment/session_answers_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
class SessionAnswersType < ::Journeys::SessionAnswersType; end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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 |
23 changes: 23 additions & 0 deletions
23
app/models/policies/early_years_payment/policy_eligibility_checker.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= govuk_start_button(text: "Start now", href: "#") %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
db/migrate/20240724092519_create_early_years_payment_eligibilities.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class CreateEarlyYearsPaymentEligibilities < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :early_years_payment_eligibilities, id: :uuid do |t| | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
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) | ||
end |