diff --git a/app/models/form/sales/pages/extra_borrowing_value_check.rb b/app/models/form/sales/pages/extra_borrowing_value_check.rb deleted file mode 100644 index 9fc621611..000000000 --- a/app/models/form/sales/pages/extra_borrowing_value_check.rb +++ /dev/null @@ -1,35 +0,0 @@ -class Form::Sales::Pages::ExtraBorrowingValueCheck < Form::Page - def initialize(id, hsh, subsection) - super - @depends_on = [ - { - "extra_borrowing_expected_but_not_reported?" => true, - }, - ] - @copy_key = "sales.soft_validations.extra_borrowing_value_check" - @title_text = { - "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", - "arguments" => [ - { - "key" => "field_formatted_as_currency", - "arguments_for_key" => "mortgage_and_deposit_total", - "i18n_template" => "mortgage_and_deposit_total", - }, - ], - } - @informative_text = { - "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", - "arguments" => [], - } - end - - def questions - @questions ||= [ - Form::Sales::Questions::ExtraBorrowingValueCheck.new(nil, nil, self), - ] - end - - def interruption_screen_question_ids - %w[extrabor mortgage deposit value discount] - end -end diff --git a/app/models/form/sales/questions/extra_borrowing_value_check.rb b/app/models/form/sales/questions/extra_borrowing_value_check.rb deleted file mode 100644 index 7a251fab8..000000000 --- a/app/models/form/sales/questions/extra_borrowing_value_check.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Form::Sales::Questions::ExtraBorrowingValueCheck < ::Form::Question - def initialize(id, hsh, page) - super(id, hsh, page) - @id = "extrabor_value_check" - @copy_key = "sales.soft_validations.extra_borrowing_value_check" - @type = "interruption_screen" - @answer_options = { - "0" => { "value" => "Yes" }, - "1" => { "value" => "No" }, - } - @hidden_in_check_answers = { - "depends_on" => [ - { - "extrabor_value_check" => 0, - }, - { - "extrabor_value_check" => 1, - }, - ], - } - end -end diff --git a/app/models/form/sales/subsections/discounted_ownership_scheme.rb b/app/models/form/sales/subsections/discounted_ownership_scheme.rb index 6577c5408..257c0c347 100644 --- a/app/models/form/sales/subsections/discounted_ownership_scheme.rb +++ b/app/models/form/sales/subsections/discounted_ownership_scheme.rb @@ -13,7 +13,6 @@ class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_discounted_ownership", nil, self, ownershipsch: 2, joint_purchase: false), Form::Sales::Pages::PurchasePrice.new(nil, nil, self), Form::Sales::Pages::Discount.new(nil, nil, self), - Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_price_value_check", nil, self), Form::Sales::Pages::PercentageDiscountValueCheck.new("percentage_discount_value_check", nil, self), Form::Sales::Pages::Grant.new(nil, nil, self), Form::Sales::Pages::GrantValueCheck.new(nil, nil, self), @@ -30,9 +29,7 @@ class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection (Form::Sales::Pages::MortgageLengthNotInterviewed.new("mortgage_length_discounted_ownership_not_interviewed", nil, self, ownershipsch: 2) if form.start_year_2026_or_later?), (Form::Sales::Pages::MortgageLengthInterviewed.new("mortgage_length_discounted_ownership_interviewed", nil, self, ownershipsch: 2) if form.start_year_2026_or_later?), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_discounted_ownership", nil, self, ownershipsch: 2), - Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_value_check", nil, self), Form::Sales::Pages::Deposit.new("deposit_discounted_ownership", nil, self, ownershipsch: 2, optional: false), - Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_deposit_value_check", nil, self), Form::Sales::Pages::DepositValueCheck.new("discounted_ownership_deposit_joint_purchase_value_check", nil, self, joint_purchase: true), Form::Sales::Pages::DepositValueCheck.new("discounted_ownership_deposit_value_check", nil, self, joint_purchase: false), Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_deposit", nil, self), diff --git a/app/models/validations/sales/soft_validations.rb b/app/models/validations/sales/soft_validations.rb index 77a5f77a5..40f29cdf5 100644 --- a/app/models/validations/sales/soft_validations.rb +++ b/app/models/validations/sales/soft_validations.rb @@ -78,13 +78,6 @@ module Validations::Sales::SoftValidations deposit > savings * 4 / 3 end - def extra_borrowing_expected_but_not_reported? - return unless saledate && !form.start_year_2024_or_later? - return unless extrabor && mortgage && deposit && value && discount - - extrabor != 1 && mortgage + deposit > value - value * discount / 100 - end - def purchase_price_out_of_soft_range? return unless value && beds && la && sale_range diff --git a/spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb b/spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb index 456294f2c..3e619f852 100644 --- a/spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb +++ b/spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb @@ -62,7 +62,6 @@ RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model living_before_purchase_discounted_ownership purchase_price discount - extra_borrowing_price_value_check percentage_discount_value_check grant grant_value_check @@ -76,9 +75,7 @@ RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model discounted_ownership_deposit_and_mortgage_value_check_after_mortgage mortgage_length_discounted_ownership extra_borrowing_discounted_ownership - extra_borrowing_value_check deposit_discounted_ownership - extra_borrowing_deposit_value_check discounted_ownership_deposit_joint_purchase_value_check discounted_ownership_deposit_value_check discounted_ownership_deposit_and_mortgage_value_check_after_deposit @@ -97,7 +94,6 @@ RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model living_before_purchase_discounted_ownership purchase_price discount - extra_borrowing_price_value_check percentage_discount_value_check grant grant_value_check @@ -112,9 +108,7 @@ RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model mortgage_length_discounted_ownership_not_interviewed mortgage_length_discounted_ownership_interviewed extra_borrowing_discounted_ownership - extra_borrowing_value_check deposit_discounted_ownership - extra_borrowing_deposit_value_check discounted_ownership_deposit_joint_purchase_value_check discounted_ownership_deposit_value_check discounted_ownership_deposit_and_mortgage_value_check_after_deposit diff --git a/spec/models/validations/sales/soft_validations_spec.rb b/spec/models/validations/sales/soft_validations_spec.rb index 0622e8283..a800b5b54 100644 --- a/spec/models/validations/sales/soft_validations_spec.rb +++ b/spec/models/validations/sales/soft_validations_spec.rb @@ -372,20 +372,6 @@ RSpec.describe Validations::Sales::SoftValidations do end end end - - context "when validating extra borrowing" do - let(:saledate) { collection_start_date_for_year_or_later(2024) } - - it "returns false for logs from 2024 onwards" do - record.extrabor = 2 - record.mortgage = 50_000 - record.deposit = 40_000 - record.value = 100_000 - record.discount = 11 - expect(record) - .not_to be_extra_borrowing_expected_but_not_reported - end - end end describe "savings amount validations" do