From 1d61cefc3024edd3a1173870389abf17cf7f2e59 Mon Sep 17 00:00:00 2001 From: Nat Dean-Lewis Date: Wed, 25 Mar 2026 11:20:49 +0000 Subject: [PATCH] CLDC-4333: update hint text instead to ensure value is 100% of equity --- app/models/form/sales/questions/value.rb | 6 +- .../sales/sale_information_validations.rb | 15 ----- .../forms/2025/sales/sale_information.en.yml | 2 +- .../forms/2026/sales/sale_information.en.yml | 2 +- .../validations/sales/sale_information.en.yml | 2 - .../models/form/sales/questions/value_spec.rb | 2 +- .../sale_information_validations_spec.rb | 56 ------------------- 7 files changed, 4 insertions(+), 81 deletions(-) diff --git a/app/models/form/sales/questions/value.rb b/app/models/form/sales/questions/value.rb index 266eb3647..0884a3fb6 100644 --- a/app/models/form/sales/questions/value.rb +++ b/app/models/form/sales/questions/value.rb @@ -4,11 +4,7 @@ class Form::Sales::Questions::Value < ::Form::Question @id = "value" @copy_key = form.start_year_2025_or_later? ? "sales.sale_information.value.#{page.id}" : "sales.sale_information.value" @type = "numeric" - @min = if form.start_year_2026_or_later? && subsection.id != "shared_ownership_staircasing_transaction" - 15_000 - else - 0 - end + @min = form.start_year_2026_or_later? ? 15_000 : 0 @step = 1 @width = 10 @prefix = "£" diff --git a/app/models/validations/sales/sale_information_validations.rb b/app/models/validations/sales/sale_information_validations.rb index cec4a16ff..32bf2a716 100644 --- a/app/models/validations/sales/sale_information_validations.rb +++ b/app/models/validations/sales/sale_information_validations.rb @@ -370,21 +370,6 @@ module Validations::Sales::SaleInformationValidations end end - def validate_staircasing_purchase_price(record) - return unless record.form.start_year_2026_or_later? - return unless record.is_staircase? && record.value && record.stairbought&.positive? - - full_purchase_price = record.value * 100 / record.stairbought - if full_purchase_price < 15_000 - %i[value stairbought].each do |field| - record.errors.add field, I18n.t("validations.sales.sale_information.#{field}.full_purchase_price_below_min", - value: record.field_formatted_as_currency("value"), - stairbought: record.stairbought, - full_purchase_price: format_as_currency(full_purchase_price)) - end - end - end - def validate_mortgage_used_dont_know(record) return unless record.mortgage_use_unknown? return if record.form.start_year_2026_or_later? diff --git a/config/locales/forms/2025/sales/sale_information.en.yml b/config/locales/forms/2025/sales/sale_information.en.yml index e81e82940..7360c3a41 100644 --- a/config/locales/forms/2025/sales/sale_information.en.yml +++ b/config/locales/forms/2025/sales/sale_information.en.yml @@ -148,7 +148,7 @@ en: value_shared_ownership: check_answer_label: "Full purchase price" check_answer_prompt: "" - hint_text: "Enter the full purchase price of the property before any discounts are applied. This is the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)." + hint_text: "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser in the current and all previous transactions)." question_text: "What was the full purchase price?" value_shared_ownership_staircase: check_answer_label: "Full purchase price" diff --git a/config/locales/forms/2026/sales/sale_information.en.yml b/config/locales/forms/2026/sales/sale_information.en.yml index b9c3bc8e9..f09d9ab3e 100644 --- a/config/locales/forms/2026/sales/sale_information.en.yml +++ b/config/locales/forms/2026/sales/sale_information.en.yml @@ -148,7 +148,7 @@ en: value_shared_ownership: check_answer_label: "Full purchase price" check_answer_prompt: "" - hint_text: "Enter the full purchase price of the property before any discounts are applied. This is the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)." + hint_text: "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser in the current and all previous transactions)." question_text: "What was the full purchase price?" value_shared_ownership_staircase: check_answer_label: "Full purchase price" diff --git a/config/locales/validations/sales/sale_information.en.yml b/config/locales/validations/sales/sale_information.en.yml index 9d932ade4..ffdf1a874 100644 --- a/config/locales/validations/sales/sale_information.en.yml +++ b/config/locales/validations/sales/sale_information.en.yml @@ -54,7 +54,6 @@ en: mortgage_used: "The mortgage (%{mortgage}) and cash deposit (%{deposit}) added together is %{mortgage_and_deposit_total}.

The full purchase price (%{value}) multiplied by the percentage bought is %{stairbought_part_of_value}.

These two amounts should be the same." mortgage_used_socialhomebuy: "The mortgage amount (%{mortgage}), cash deposit (%{deposit}), and cash discount (%{cashdis}) added together is %{mortgage_deposit_and_discount_total}.

The full purchase price (%{value}) multiplied by the percentage bought (%{stairbought}) is %{stairbought_part_of_value}.

These two amounts should be the same." value: - full_purchase_price_below_min: "Based on the purchase price of %{value} and the percentage bought of %{stairbought}%, the implied full property value is %{full_purchase_price}. The full property value must be at least £15,000." discounted_ownership_value: "The mortgage%{mortgage}%{deposit_and_grant_sentence} added together is %{mortgage_deposit_and_grant_total}.

The full purchase price%{discount_sentence} is %{value_with_discount}.

These two amounts should be the same." outright_sale_value: "The mortgage%{mortgage} and cash deposit (%{deposit}) when added together is %{mortgage_and_deposit_total}.

The full purchase price is %{value}.

These two amounts should be the same." value_over_discounted_london_max: "The percentage discount multiplied by the purchase price is %{discount_value}. This figure should not be more than £137,400 for properties in London." @@ -118,7 +117,6 @@ en: mortgage_used_socialhomebuy: "The mortgage amount (%{mortgage}), cash deposit (%{deposit}), and cash discount (%{cashdis}) added together is %{mortgage_deposit_and_discount_total}.

The full purchase price (%{value}) multiplied by the percentage bought (%{stairbought}) is %{stairbought_part_of_value}.

These two amounts should be the same." mortgage_not_used_socialhomebuy: "The cash deposit (%{deposit}) and cash discount (%{cashdis}) added together is %{deposit_and_discount_total}.

The full purchase price (%{value}) multiplied by the percentage bought (%{stairbought}) is %{stairbought_part_of_value}.

These two amounts should be the same." stairbought: - full_purchase_price_below_min: "Based on the purchase price of %{value} and the percentage bought of %{stairbought}%, the implied full property value is %{full_purchase_price}. The full property value must be at least £15,000." stairbought_over_max: "The percentage bought in this staircasing transaction cannot be higher than %{max_stairbought}% for %{type} sales." staircasing_mortgage: mortgage_used: "The mortgage (%{mortgage}) and cash deposit (%{deposit}) added together is %{mortgage_and_deposit_total}.

The full purchase price (%{value}) multiplied by the percentage bought is %{stairbought_part_of_value}.

These two amounts should be the same." diff --git a/spec/models/form/sales/questions/value_spec.rb b/spec/models/form/sales/questions/value_spec.rb index a48779267..7cdb4d0ec 100644 --- a/spec/models/form/sales/questions/value_spec.rb +++ b/spec/models/form/sales/questions/value_spec.rb @@ -66,7 +66,7 @@ RSpec.describe Form::Sales::Questions::Value, type: :model do end it "has correct min" do - expect(question.min).to eq(0) + expect(question.min).to eq(15_000) end end end diff --git a/spec/models/validations/sales/sale_information_validations_spec.rb b/spec/models/validations/sales/sale_information_validations_spec.rb index 446a6e033..8d4eb4cea 100644 --- a/spec/models/validations/sales/sale_information_validations_spec.rb +++ b/spec/models/validations/sales/sale_information_validations_spec.rb @@ -994,62 +994,6 @@ RSpec.describe Validations::Sales::SaleInformationValidations do end end - describe "#validate_staircasing_purchase_price" do - let(:saledate) { Time.zone.local(2026, 4, 1) } - let(:record) { build(:sales_log, ownershipsch: 1, staircase: 1, saledate:) } - - it "does not add an error when not staircasing" do - record.staircase = 2 - record.value = 5_000 - record.stairbought = 10 - sale_information_validator.validate_staircasing_purchase_price(record) - - expect(record.errors).to be_empty - end - - it "does not add an error when value is nil" do - record.value = nil - record.stairbought = 10 - sale_information_validator.validate_staircasing_purchase_price(record) - - expect(record.errors).to be_empty - end - - it "does not add an error when stairbought is nil" do - record.value = 5_000 - record.stairbought = nil - sale_information_validator.validate_staircasing_purchase_price(record) - - expect(record.errors).to be_empty - end - - it "does not add an error when full purchase price is at least 15,000" do - record.value = 1_500 - record.stairbought = 10 - sale_information_validator.validate_staircasing_purchase_price(record) - - expect(record.errors).to be_empty - end - - it "adds an error when full purchase price is below 15,000" do - record.value = 1_000 - record.stairbought = 10 - sale_information_validator.validate_staircasing_purchase_price(record) - - expect(record.errors[:value]).to be_present - expect(record.errors[:stairbought]).to be_present - end - - it "does not add an error for years before 2026" do - record.saledate = Time.zone.local(2025, 4, 1) - record.value = 1_000 - record.stairbought = 10 - sale_information_validator.validate_staircasing_purchase_price(record) - - expect(record.errors).to be_empty - end - end - describe "#validate_discount_and_value" do let(:record) { FactoryBot.build(:sales_log, value: 200_000, discount: 50, ownershipsch: 2, type: 9, saledate:) } let(:saledate) { current_collection_start_date }