Browse Source

Extract shared ownership soft validations

pull/2712/head
Kat 2 years ago
parent
commit
48032fa44b
  1. 5
      app/models/form/sales/pages/about_price_value_check.rb
  2. 2
      app/models/form/sales/pages/deposit_value_check.rb
  3. 3
      app/models/form/sales/pages/handover_date_check.rb
  4. 5
      app/models/form/sales/pages/monthly_charges_value_check.rb
  5. 4
      app/models/form/sales/pages/shared_ownership_deposit_value_check.rb
  6. 5
      app/models/form/sales/pages/staircase_bought_value_check.rb
  7. 7
      app/models/form/sales/pages/staircase_owned_value_check.rb
  8. 3
      app/models/form/sales/questions/about_price_value_check.rb
  9. 6
      app/models/form/sales/questions/deposit_value_check.rb
  10. 3
      app/models/form/sales/questions/handover_date_check.rb
  11. 3
      app/models/form/sales/questions/monthly_charges_value_check.rb
  12. 3
      app/models/form/sales/questions/shared_ownership_deposit_value_check.rb
  13. 3
      app/models/form/sales/questions/staircase_bought_value_check.rb
  14. 7
      app/models/form/sales/questions/staircase_owned_value_check.rb
  15. 19
      config/locales/en.yml
  16. 76
      config/locales/forms/2023/sales/soft_validations.en.yml
  17. 75
      config/locales/forms/2024/sales/soft_validations.en.yml
  18. 2
      spec/models/form/lettings/subsections/tenancy_information_spec.rb
  19. 7
      spec/models/form/sales/pages/about_price_value_check_spec.rb
  20. 5
      spec/models/form/sales/pages/handover_date_check_spec.rb
  21. 7
      spec/models/form/sales/pages/monthly_charges_value_check_spec.rb
  22. 9
      spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb
  23. 9
      spec/models/form/sales/pages/staircase_owned_value_check_spec.rb
  24. 2
      spec/models/form/sales/questions/deposit_value_check_spec.rb
  25. 2
      spec/models/form/sales/questions/staircase_owned_value_check_spec.rb

5
app/models/form/sales/pages/about_price_value_check.rb

@ -6,8 +6,9 @@ class Form::Sales::Pages::AboutPriceValueCheck < ::Form::Page
"purchase_price_out_of_soft_range?" => true, "purchase_price_out_of_soft_range?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.value_value_check"
@title_text = { @title_text = {
"translation" => "soft_validations.purchase_price.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "value", "key" => "value",
@ -17,7 +18,7 @@ class Form::Sales::Pages::AboutPriceValueCheck < ::Form::Page
], ],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.purchase_price.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [ "arguments" => [
{ {
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",

2
app/models/form/sales/pages/deposit_value_check.rb

@ -26,7 +26,7 @@ class Form::Sales::Pages::DepositValueCheck < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::DepositValueCheck.new(nil, nil, self), Form::Sales::Questions::DepositValueCheck.new(nil, nil, self, joint_purchase: @joint_purchase),
] ]
end end

3
app/models/form/sales/pages/handover_date_check.rb

@ -2,11 +2,12 @@ class Form::Sales::Pages::HandoverDateCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "handover_date_check" @id = "handover_date_check"
@copy_key = "sales.soft_validations.hodate_check"
@depends_on = [{ "saledate_check" => nil, "hodate_3_years_or_more_saledate?" => true }, @depends_on = [{ "saledate_check" => nil, "hodate_3_years_or_more_saledate?" => true },
{ "saledate_check" => 1, "hodate_3_years_or_more_saledate?" => true }] { "saledate_check" => 1, "hodate_3_years_or_more_saledate?" => true }]
@informative_text = {} @informative_text = {}
@title_text = { @title_text = {
"translation" => "soft_validations.hodate.must_be_less_than_3_years_from_saledate", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [], "arguments" => [],
} }
end end

5
app/models/form/sales/pages/monthly_charges_value_check.rb

@ -6,8 +6,9 @@ class Form::Sales::Pages::MonthlyChargesValueCheck < ::Form::Page
"monthly_charges_over_soft_max?" => true, "monthly_charges_over_soft_max?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.monthly_charges_value_check"
@title_text = { @title_text = {
"translation" => "soft_validations.monthly_charges_over_soft_max.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",
@ -17,7 +18,7 @@ class Form::Sales::Pages::MonthlyChargesValueCheck < ::Form::Page
], ],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.monthly_charges_over_soft_max.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
end end

4
app/models/form/sales/pages/shared_ownership_deposit_value_check.rb

@ -6,9 +6,9 @@ class Form::Sales::Pages::SharedOwnershipDepositValueCheck < ::Form::Page
"shared_ownership_deposit_invalid?" => true, "shared_ownership_deposit_invalid?" => true,
}, },
] ]
@informative_text = {} @copy_key = "sales.soft_validations.shared_ownership_deposit_value_check"
@title_text = { @title_text = {
"translation" => "soft_validations.shared_ownership_deposit.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "mortgage_deposit_and_discount_error_fields", "key" => "mortgage_deposit_and_discount_error_fields",

5
app/models/form/sales/pages/staircase_bought_value_check.rb

@ -7,8 +7,9 @@ class Form::Sales::Pages::StaircaseBoughtValueCheck < ::Form::Page
"staircase_bought_above_fifty?" => true, "staircase_bought_above_fifty?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.staircase_bought_value_check"
@title_text = { @title_text = {
"translation" => "soft_validations.staircase_bought_seems_high.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "stairbought", "key" => "stairbought",
@ -17,7 +18,7 @@ class Form::Sales::Pages::StaircaseBoughtValueCheck < ::Form::Page
], ],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.staircase_bought_seems_high.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
end end

7
app/models/form/sales/pages/staircase_owned_value_check.rb

@ -8,8 +8,9 @@ class Form::Sales::Pages::StaircaseOwnedValueCheck < ::Form::Page
"joint_purchase?" => joint_purchase, "joint_purchase?" => joint_purchase,
}, },
] ]
@copy_key = "sales.soft_validations.stairowned_value_check.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@title_text = { @title_text = {
"translation" => joint_purchase ? "soft_validations.staircase_owned.title_text.two" : "soft_validations.staircase_owned.title_text.one", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "stairowned", "key" => "stairowned",
@ -19,14 +20,14 @@ class Form::Sales::Pages::StaircaseOwnedValueCheck < ::Form::Page
], ],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.staircase_owned.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
end end
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::StaircaseOwnedValueCheck.new(nil, nil, self), Form::Sales::Questions::StaircaseOwnedValueCheck.new(nil, nil, self, joint_purchase: @joint_purchase),
] ]
end end

3
app/models/form/sales/questions/about_price_value_check.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::AboutPriceValueCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "value_value_check" @id = "value_value_check"
@check_answer_label = "Purchase price confirmation" @copy_key = "sales.soft_validations.value_value_check"
@header = "Are you sure?"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

6
app/models/form/sales/questions/deposit_value_check.rb

@ -1,8 +1,8 @@
class Form::Sales::Questions::DepositValueCheck < ::Form::Question class Form::Sales::Questions::DepositValueCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page, joint_purchase:)
super super(id, hsh, page)
@id = "deposit_value_check" @id = "deposit_value_check"
@copy_key = "sales.soft_validations.deposit_value_check" @copy_key = "sales.soft_validations.deposit_value_check.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

3
app/models/form/sales/questions/handover_date_check.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::HandoverDateCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "hodate_check" @id = "hodate_check"
@check_answer_label = "Practical completion or handover date check" @copy_key = "sales.soft_validations.hodate_check"
@header = "Are you sure?"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

3
app/models/form/sales/questions/monthly_charges_value_check.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::MonthlyChargesValueCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "monthly_charges_value_check" @id = "monthly_charges_value_check"
@check_answer_label = "Monthly charges confirmation" @copy_key = "sales.soft_validations.monthly_charges_value_check"
@header = "Are you sure this is correct?"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

3
app/models/form/sales/questions/shared_ownership_deposit_value_check.rb

@ -2,9 +2,8 @@ class Form::Sales::Questions::SharedOwnershipDepositValueCheck < ::Form::Questio
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "shared_ownership_deposit_value_check" @id = "shared_ownership_deposit_value_check"
@check_answer_label = "Shared ownership deposit confirmation" @copy_key = "sales.soft_validations.shared_ownership_deposit_value_check"
@type = "interruption_screen" @type = "interruption_screen"
@header = "Are you sure this is correct?"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
"1" => { "value" => "No" }, "1" => { "value" => "No" },

3
app/models/form/sales/questions/staircase_bought_value_check.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::StaircaseBoughtValueCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "staircase_bought_value_check" @id = "staircase_bought_value_check"
@check_answer_label = "Percentage bought confirmation" @copy_key = "sales.soft_validations.staircase_bought_value_check"
@header = "Are you sure this is correct?"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

7
app/models/form/sales/questions/staircase_owned_value_check.rb

@ -1,9 +1,8 @@
class Form::Sales::Questions::StaircaseOwnedValueCheck < ::Form::Question class Form::Sales::Questions::StaircaseOwnedValueCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page, joint_purchase:)
super super(id, hsh, page)
@id = "stairowned_value_check" @id = "stairowned_value_check"
@check_answer_label = "Percentage owned confirmation" @copy_key = "sales.soft_validations.stairowned_value_check.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@header = "Are you sure?"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

19
config/locales/en.yml

@ -650,15 +650,6 @@ en:
outside_range_title: "You told us the rent is %{brent}." outside_range_title: "You told us the rent is %{brent}."
informative_text: "This is %{higher_or_lower} than we would expect." informative_text: "This is %{higher_or_lower} than we would expect."
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>" hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>"
purchase_price:
title_text: "You told us the purchase price is %{value}."
hint_text: "This is %{higher_or_lower} than we would expect."
staircase_owned:
title_text:
one: "You told us that the buyer now owns %{stairowned} of the property."
two: "You told us that the buyers now own %{stairowned} of the property."
hint_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme.
Make sure these answers are correct."
retirement: retirement:
min: min:
title: "You told us this person is aged %{age} years and retired." title: "You told us this person is aged %{age} years and retired."
@ -679,14 +670,6 @@ Make sure these answers are correct."
void_date: void_date:
title_text: "You told us that the property has been vacant for more than 2 years." title_text: "You told us that the property has been vacant for more than 2 years."
hint_text: "This is higher than we would expect." hint_text: "This is higher than we would expect."
shared_ownership_deposit:
title_text: "You told us that the %{mortgage_deposit_and_discount_error_fields} add up to %{mortgage_deposit_and_discount_total}."
staircase_bought_seems_high:
title_text: "You told us that %{percentage}% was bought in this staircasing transaction."
hint_text: "Most staircasing transactions are less than 50%"
monthly_charges_over_soft_max:
title_text: "You told us that the monthly charges were %{mscharge}."
hint_text: "This is higher than we would expect."
discounted_sale_value: discounted_sale_value:
title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}." title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}."
informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}." informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}."
@ -718,8 +701,6 @@ Make sure these answers are correct."
informative_text: "The reason you have entered looks very similar to one of the existing response categories. informative_text: "The reason you have entered looks very similar to one of the existing response categories.
Please check the categories and select the appropriate one. Please check the categories and select the appropriate one.
If the existing categories are not suitable, please confirm here to move onto the next question." If the existing categories are not suitable, please confirm here to move onto the next question."
hodate:
must_be_less_than_3_years_from_saledate: "You told us practical completion or handover date is more than 3 years before sale completion date."
saledate: saledate:
must_be_less_than_3_years_from_hodate: "You told us sale completion date is more than 3 years after practical completion or handover date." must_be_less_than_3_years_from_hodate: "You told us sale completion date is more than 3 years after practical completion or handover date."
no_address_found: no_address_found:

76
config/locales/forms/2023/sales/soft_validations.en.yml

@ -38,6 +38,7 @@ en:
max: max:
page_header: "" page_header: ""
title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?" title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?"
income2_value_check: income2_value_check:
check_answer_label: "Buyer 2 income confirmation" check_answer_label: "Buyer 2 income confirmation"
hint_text: "" hint_text: ""
@ -49,12 +50,14 @@ en:
max: max:
page_header: "" page_header: ""
title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?" title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?"
combined_income_value_check: combined_income_value_check:
page_header: "" page_header: ""
check_answer_label: "Combined income confirmation" check_answer_label: "Combined income confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?" title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?"
mortgage_value_check: mortgage_value_check:
page_header: "" page_header: ""
check_answer_label: "Mortgage confirmation" check_answer_label: "Mortgage confirmation"
@ -62,6 +65,7 @@ en:
question_text: "Are you sure that the mortgage is more than 5 times the income used for the mortgage application?" question_text: "Are you sure that the mortgage is more than 5 times the income used for the mortgage application?"
title_text: "You told us that the mortgage amount is %{mortgage}." title_text: "You told us that the mortgage amount is %{mortgage}."
informative_text: "This is more than 5 times the income, which is higher than we would expect." informative_text: "This is more than 5 times the income, which is higher than we would expect."
savings_value_check: savings_value_check:
page_header: "" page_header: ""
check_answer_label: "Savings confirmation" check_answer_label: "Savings confirmation"
@ -73,23 +77,76 @@ en:
not_joint_purchase: not_joint_purchase:
title_text: "You told us the buyer’s savings were %{savings}." title_text: "You told us the buyer’s savings were %{savings}."
informative_text: "This is higher than we would expect." informative_text: "This is higher than we would expect."
deposit_value_check::
staircase_bought_value_check:
page_header: "" page_header: ""
check_answer_label: "Deposit confirmation" check_answer_label: "Percentage bought confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" question_text: "Are you sure this is correct?"
title_text: "You told us that %{percentage}% was bought in this staircasing transaction."
informative_text: "Most staircasing transactions are less than 50%"
stairowned_value_check:
joint_purchase: joint_purchase:
page_header: ""
check_answer_label: "Percentage owned confirmation"
hint_text: ""
question_text: "Are you sure?"
title_text: "You told us that the buyers now own %{stairowned} of the property."
informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct."
not_joint_purchase:
page_header: ""
check_answer_label: "Percentage owned confirmation"
hint_text: ""
question_text: "Are you sure?"
title_text: "You told us that the buyer now owns %{stairowned} of the property."
informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct."
hodate_check:
page_header: ""
check_answer_label: "Practical completion or handover date check"
hint_text: ""
question_text: "Are you sure?"
title_text: "You told us practical completion or handover date is more than 3 years before sale completion date."
value_value_check:
page_header: ""
check_answer_label: "Purchase price confirmation"
hint_text: ""
question_text: "Are you sure?"
title_text: "You told us the purchase price is %{value}."
informative_text: "This is %{higher_or_lower} than we would expect."
shared_ownership_deposit_value_check:
page_header: ""
check_answer_label: "Shared ownership deposit confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that the %{mortgage_deposit_and_discount_error_fields} add up to %{mortgage_deposit_and_discount_total}."
deposit_value_check:
joint_purchase:
page_header: ""
check_answer_label: "Deposit confirmation"
hint_text: ""
question_text: "Are you sure that the deposit is this much higher than the buyer's savings?"
title_text: "You told us the buyers’ deposit was %{deposit} and their savings were %{savings}." title_text: "You told us the buyers’ deposit was %{deposit} and their savings were %{savings}."
informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have."
not_joint_purchase: not_joint_purchase:
page_header: ""
check_answer_label: "Deposit confirmation"
hint_text: ""
question_text: "Are you sure that the deposit is this much higher than the buyer's savings?"
title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}." title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}."
informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have."
wheel_value_check: wheel_value_check:
page_header: "" page_header: ""
check_answer_label: "Does anyone in the household use a wheelchair?" check_answer_label: "Does anyone in the household use a wheelchair?"
hint_text: "" hint_text: ""
question_text: "You told us that someone in the household uses a wheelchair." question_text: "You told us that someone in the household uses a wheelchair."
title_text: "You told us that someone in the household uses a wheelchair." title_text: "You told us that someone in the household uses a wheelchair."
buyer_livein_value_check: buyer_livein_value_check:
buyer1: buyer1:
page_header: "" page_header: ""
@ -105,6 +162,7 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us that buyer 2 will not live in the property." title_text: "You told us that buyer 2 will not live in the property."
informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property." informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property."
student_not_child_value_check: student_not_child_value_check:
page_header: "" page_header: ""
check_answer_label: "Student not a child confirmation" check_answer_label: "Student not a child confirmation"
@ -112,6 +170,7 @@ en:
question_text: "Are you sure this person is not a child?" question_text: "Are you sure this person is not a child?"
title_text: "You told us this person is a student aged between 16 and 19." title_text: "You told us this person is a student aged between 16 and 19."
informative_text: "Are you sure this person is not a child?" informative_text: "Are you sure this person is not a child?"
partner_under_16_value_check: partner_under_16_value_check:
page_header: "" page_header: ""
check_answer_label: "Partner under 16 confirmation" check_answer_label: "Partner under 16 confirmation"
@ -119,6 +178,7 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1." title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1."
informative_text: "Are you sure this is correct?" informative_text: "Are you sure this is correct?"
multiple_partners_value_check: multiple_partners_value_check:
page_header: "" page_header: ""
check_answer_label: "Multiple partners confirmation" check_answer_label: "Multiple partners confirmation"
@ -126,3 +186,13 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us there are more than 1 persons with 'Partner' relationship to buyer 1." title_text: "You told us there are more than 1 persons with 'Partner' relationship to buyer 1."
informative_text: "Are you sure this is correct?" informative_text: "Are you sure this is correct?"
monthly_charges_value_check:
page_header: ""
check_answer_label: "Monthly charges confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that the monthly charges were %{mscharge}."
informative_text: "This is higher than we would expect."

75
config/locales/forms/2024/sales/soft_validations.en.yml

@ -38,6 +38,7 @@ en:
max: max:
page_header: "" page_header: ""
title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?" title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?"
income2_value_check: income2_value_check:
check_answer_label: "Buyer 2 income confirmation" check_answer_label: "Buyer 2 income confirmation"
hint_text: "" hint_text: ""
@ -49,12 +50,14 @@ en:
max: max:
page_header: "" page_header: ""
title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?" title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?"
combined_income_value_check: combined_income_value_check:
page_header: "" page_header: ""
check_answer_label: "Combined income confirmation" check_answer_label: "Combined income confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?" title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?"
mortgage_value_check: mortgage_value_check:
page_header: "" page_header: ""
check_answer_label: "Mortgage confirmation" check_answer_label: "Mortgage confirmation"
@ -62,6 +65,7 @@ en:
question_text: "Are you sure that the mortgage is more than 5 times the income used for the mortgage application?" question_text: "Are you sure that the mortgage is more than 5 times the income used for the mortgage application?"
title_text: "You told us that the mortgage amount is %{mortgage}." title_text: "You told us that the mortgage amount is %{mortgage}."
informative_text: "This is more than 5 times the income, which is higher than we would expect." informative_text: "This is more than 5 times the income, which is higher than we would expect."
savings_value_check: savings_value_check:
page_header: "" page_header: ""
check_answer_label: "Savings confirmation" check_answer_label: "Savings confirmation"
@ -73,23 +77,76 @@ en:
not_joint_purchase: not_joint_purchase:
title_text: "You told us the buyer’s savings were %{savings}." title_text: "You told us the buyer’s savings were %{savings}."
informative_text: "This is higher than we would expect." informative_text: "This is higher than we would expect."
deposit_value_check:
staircase_bought_value_check:
page_header: "" page_header: ""
check_answer_label: "Deposit confirmation" check_answer_label: "Percentage bought confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" question_text: "Are you sure this is correct?"
title_text: "You told us that %{percentage}% was bought in this staircasing transaction."
informative_text: "Most staircasing transactions are less than 50%"
stairowned_value_check:
joint_purchase: joint_purchase:
page_header: ""
check_answer_label: "Percentage owned confirmation"
hint_text: ""
question_text: "Are you sure?"
title_text: "You told us that the buyers now own %{stairowned} of the property."
informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct."
not_joint_purchase:
page_header: ""
check_answer_label: "Percentage owned confirmation"
hint_text: ""
question_text: "Are you sure?"
title_text: "You told us that the buyer now owns %{stairowned} of the property."
informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct."
hodate_check:
page_header: ""
check_answer_label: "Practical completion or handover date check"
hint_text: ""
question_text: "Are you sure?"
title_text: "You told us practical completion or handover date is more than 3 years before sale completion date."
value_value_check:
page_header: ""
check_answer_label: "Purchase price confirmation"
hint_text: ""
question_text: "Are you sure?"
title_text: "You told us the purchase price is %{value}."
informative_text: "This is %{higher_or_lower} than we would expect."
shared_ownership_deposit_value_check:
page_header: ""
check_answer_label: "Shared ownership deposit confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that the %{mortgage_deposit_and_discount_error_fields} add up to %{mortgage_deposit_and_discount_total}."
deposit_value_check:
joint_purchase:
page_header: ""
check_answer_label: "Deposit confirmation"
hint_text: ""
question_text: "Are you sure that the deposit is this much higher than the buyer's savings?"
title_text: "You told us the buyers’ deposit was %{deposit} and their savings were %{savings}." title_text: "You told us the buyers’ deposit was %{deposit} and their savings were %{savings}."
informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have."
not_joint_purchase: not_joint_purchase:
page_header: ""
check_answer_label: "Deposit confirmation"
hint_text: ""
question_text: "Are you sure that the deposit is this much higher than the buyer's savings?"
title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}." title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}."
informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have."
wheel_value_check: wheel_value_check:
page_header: "" page_header: ""
check_answer_label: "Does anyone in the household use a wheelchair?" check_answer_label: "Does anyone in the household use a wheelchair?"
hint_text: "" hint_text: ""
question_text: "You told us that someone in the household uses a wheelchair." question_text: "You told us that someone in the household uses a wheelchair."
title_text: "You told us that someone in the household uses a wheelchair." title_text: "You told us that someone in the household uses a wheelchair."
buyer_livein_value_check: buyer_livein_value_check:
buyer1: buyer1:
page_header: "" page_header: ""
@ -105,6 +162,7 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us that buyer 2 will not live in the property." title_text: "You told us that buyer 2 will not live in the property."
informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property." informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property."
student_not_child_value_check: student_not_child_value_check:
page_header: "" page_header: ""
check_answer_label: "Student not a child confirmation" check_answer_label: "Student not a child confirmation"
@ -112,6 +170,7 @@ en:
question_text: "Are you sure this person is not a child?" question_text: "Are you sure this person is not a child?"
title_text: "You told us this person is a student aged between 16 and 19." title_text: "You told us this person is a student aged between 16 and 19."
informative_text: "Are you sure this person is not a child?" informative_text: "Are you sure this person is not a child?"
partner_under_16_value_check: partner_under_16_value_check:
page_header: "" page_header: ""
check_answer_label: "Partner under 16 confirmation" check_answer_label: "Partner under 16 confirmation"
@ -119,6 +178,7 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1." title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1."
informative_text: "Are you sure this is correct?" informative_text: "Are you sure this is correct?"
multiple_partners_value_check: multiple_partners_value_check:
page_header: "" page_header: ""
check_answer_label: "Multiple partners confirmation" check_answer_label: "Multiple partners confirmation"
@ -126,3 +186,12 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us there are more than 1 persons with 'Partner' relationship to buyer 1." title_text: "You told us there are more than 1 persons with 'Partner' relationship to buyer 1."
informative_text: "Are you sure this is correct?" informative_text: "Are you sure this is correct?"
monthly_charges_value_check:
page_header: ""
check_answer_label: "Monthly charges confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that the monthly charges were %{mscharge}."
informative_text: "This is higher than we would expect."

2
spec/models/form/lettings/subsections/tenancy_information_spec.rb

@ -12,7 +12,7 @@ RSpec.describe Form::Lettings::Subsections::TenancyInformation, type: :model do
end end
describe "pages" do describe "pages" do
let(:section) { instance_double(Form::Sales::Sections::Household, form:) } let(:section) { instance_double(Form::Sales::Sections::TenancyInformation, form:) }
let(:form) { instance_double(Form, start_date:) } let(:form) { instance_double(Form, start_date:) }
before do before do

7
spec/models/form/sales/pages/about_price_value_check_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::AboutPriceValueCheck, type: :model do
let(:page_id) { "savings_value_check" } let(:page_id) { "savings_value_check" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:subsection) { instance_double(Form::Subsection, form:) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -28,12 +29,12 @@ RSpec.describe Form::Sales::Pages::AboutPriceValueCheck, type: :model do
end end
it "has the correct title_text" do it "has the correct title_text" do
expect(page.title_text).to eq({ "arguments" => [{ "i18n_template" => "value", "key" => "value", "label" => true }], "translation" => "soft_validations.purchase_price.title_text" }) expect(page.title_text).to eq({ "arguments" => [{ "i18n_template" => "value", "key" => "value", "label" => true }], "translation" => "forms.2024.sales.soft_validations.value_value_check.title_text" })
end end
it "has the correct informative_text" do it "has the correct informative_text" do
expect(page.informative_text).to eq({ expect(page.informative_text).to eq({
"translation" => "soft_validations.purchase_price.hint_text", "translation" => "forms.2024.sales.soft_validations.value_value_check.informative_text",
"arguments" => [ "arguments" => [
{ {
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",

5
spec/models/form/sales/pages/handover_date_check_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::HandoverDateCheck, type: :model do
let(:page_id) { "" } let(:page_id) { "" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:subsection) { instance_double(Form::Subsection, form:) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -21,7 +22,7 @@ RSpec.describe Form::Sales::Pages::HandoverDateCheck, type: :model do
it "has the correct title_text" do it "has the correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.hodate.must_be_less_than_3_years_from_saledate", "translation" => "forms.2024.sales.soft_validations.hodate_check.title_text",
"arguments" => [], "arguments" => [],
}) })
end end

7
spec/models/form/sales/pages/monthly_charges_value_check_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::MonthlyChargesValueCheck, type: :model do
let(:page_id) { "monthly_charges_value_check" } let(:page_id) { "monthly_charges_value_check" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:subsection) { instance_double(Form::Subsection, form:) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -33,13 +34,13 @@ RSpec.describe Form::Sales::Pages::MonthlyChargesValueCheck, type: :model do
it "has correct title_text" do it "has correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.monthly_charges_over_soft_max.title_text", "translation" => "forms.2024.sales.soft_validations.monthly_charges_value_check.title_text",
"arguments" => [{ "arguments_for_key" => "mscharge", "i18n_template" => "mscharge", "key" => "field_formatted_as_currency" }], "arguments" => [{ "arguments_for_key" => "mscharge", "i18n_template" => "mscharge", "key" => "field_formatted_as_currency" }],
}) })
end end
it "has correct informative_text" do it "has correct informative_text" do
expect(page.informative_text).to eq({ "arguments" => [], "translation" => "soft_validations.monthly_charges_over_soft_max.hint_text" }) expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.sales.soft_validations.monthly_charges_value_check.informative_text" })
end end
it "has correct interruption_screen_question_ids" do it "has correct interruption_screen_question_ids" do

9
spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :mode
let(:page_id) { "shared_ownership_deposit_value_check" } let(:page_id) { "shared_ownership_deposit_value_check" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:subsection) { instance_double(Form::Subsection, form:) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -29,7 +30,7 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :mode
it "has the correct title_text" do it "has the correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.shared_ownership_deposit.title_text", "translation" => "forms.2024.sales.soft_validations.shared_ownership_deposit_value_check.title_text",
"arguments" => [ "arguments" => [
{ "i18n_template" => "mortgage_deposit_and_discount_error_fields", "key" => "mortgage_deposit_and_discount_error_fields" }, { "i18n_template" => "mortgage_deposit_and_discount_error_fields", "key" => "mortgage_deposit_and_discount_error_fields" },
{ "arguments_for_key" => "mortgage_deposit_and_discount_total", "i18n_template" => "mortgage_deposit_and_discount_total", "key" => "field_formatted_as_currency" }, { "arguments_for_key" => "mortgage_deposit_and_discount_total", "i18n_template" => "mortgage_deposit_and_discount_total", "key" => "field_formatted_as_currency" },
@ -37,10 +38,6 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :mode
}) })
end end
it "has the correct informative_text" do
expect(page.informative_text).to eq({})
end
it "has the correct interruption_screen_question_ids" do it "has the correct interruption_screen_question_ids" do
expect(page.interruption_screen_question_ids).to eq(%w[mortgage mortgageused cashdis type deposit value equity]) expect(page.interruption_screen_question_ids).to eq(%w[mortgage mortgageused cashdis type deposit value equity])
end end

9
spec/models/form/sales/pages/staircase_owned_value_check_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::StaircaseOwnedValueCheck, type: :model do
let(:page_id) { "an_id" } let(:page_id) { "an_id" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:subsection) { instance_double(Form::Subsection, form:) }
let(:joint_purchase) { false } let(:joint_purchase) { false }
it "has correct subsection" do it "has correct subsection" do
@ -33,7 +34,7 @@ RSpec.describe Form::Sales::Pages::StaircaseOwnedValueCheck, type: :model do
it "has the correct informative_text" do it "has the correct informative_text" do
expect(page.informative_text).to eq({ expect(page.informative_text).to eq({
"translation" => "soft_validations.staircase_owned.hint_text", "translation" => "forms.2024.sales.soft_validations.stairowned_value_check.not_joint_purchase.informative_text",
"arguments" => [], "arguments" => [],
}) })
end end
@ -45,7 +46,7 @@ RSpec.describe Form::Sales::Pages::StaircaseOwnedValueCheck, type: :model do
context "when not a joint purchase" do context "when not a joint purchase" do
it "has the correct title_text" do it "has the correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.staircase_owned.title_text.one", "translation" => "forms.2024.sales.soft_validations.stairowned_value_check.not_joint_purchase.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "stairowned", "key" => "stairowned",
@ -62,7 +63,7 @@ RSpec.describe Form::Sales::Pages::StaircaseOwnedValueCheck, type: :model do
it "has the correct title_text" do it "has the correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.staircase_owned.title_text.two", "translation" => "forms.2024.sales.soft_validations.stairowned_value_check.joint_purchase.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "stairowned", "key" => "stairowned",

2
spec/models/form/sales/questions/deposit_value_check_spec.rb

@ -1,7 +1,7 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Sales::Questions::DepositValueCheck, type: :model do RSpec.describe Form::Sales::Questions::DepositValueCheck, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) } subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase: true) }
let(:question_id) { nil } let(:question_id) { nil }
let(:question_definition) { nil } let(:question_definition) { nil }

2
spec/models/form/sales/questions/staircase_owned_value_check_spec.rb

@ -1,7 +1,7 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Sales::Questions::StaircaseOwnedValueCheck, type: :model do RSpec.describe Form::Sales::Questions::StaircaseOwnedValueCheck, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) } subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase: true) }
let(:question_id) { nil } let(:question_id) { nil }
let(:question_definition) { nil } let(:question_definition) { nil }

Loading…
Cancel
Save