diff --git a/app/models/form/sales/pages/shared_ownership_deposit_value_check.rb b/app/models/form/sales/pages/shared_ownership_deposit_value_check.rb index 4d720c1d8..258697161 100644 --- a/app/models/form/sales/pages/shared_ownership_deposit_value_check.rb +++ b/app/models/form/sales/pages/shared_ownership_deposit_value_check.rb @@ -12,8 +12,8 @@ class Form::Sales::Pages::SharedOwnershipDepositValueCheck < ::Form::Page "arguments" => [ { "key" => "field_formatted_as_currency", - "arguments_for_key" => "expected_shared_ownership_deposit_value", - "i18n_template" => "expected_shared_ownership_deposit_value", + "arguments_for_key" => "mortgage_deposit_and_discount_total", + "i18n_template" => "mortgage_deposit_and_discount_total", }, ], } diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index d4ac25450..e2e92174e 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -219,6 +219,14 @@ class SalesLog < Log value * equity / 100 end + def mortgage_deposit_and_discount_total + mortgage_amount = mortgage || 0 + deposit_amount = deposit || 0 + cashdis_amount = cashdis || 0 + + mortgage_amount + deposit_amount + cashdis_amount + end + def mortgage_and_deposit_total return unless mortgage && deposit diff --git a/config/locales/en.yml b/config/locales/en.yml index 68e16eafd..9e93e463a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -556,7 +556,7 @@ en: 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." shared_ownership_deposit: - title_text: "Mortgage, deposit and cash discount total should equal %{expected_shared_ownership_deposit_value}" + title_text: "You told us that the mortgage, deposit and discount add up to %{mortgage_deposit_and_discount_total}" old_persons_shared_ownership: title_text: "You told us the buyer is using the Older Persons Shared Ownership scheme." hint_text: "At least one buyer must be aged 65 years and over to use this scheme." diff --git a/spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb b/spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb index 285449fe9..9a184a6fc 100644 --- a/spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb +++ b/spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :mode it "has the correct title_text" do expect(page.title_text).to eq({ "translation" => "soft_validations.shared_ownership_deposit.title_text", - "arguments" => [{ "arguments_for_key" => "expected_shared_ownership_deposit_value", "i18n_template" => "expected_shared_ownership_deposit_value", "key" => "field_formatted_as_currency" }], + "arguments" => [{ "arguments_for_key" => "mortgage_deposit_and_discount_total", "i18n_template" => "mortgage_deposit_and_discount_total", "key" => "field_formatted_as_currency" }], }) end