From e2d7a361c0cc5c2662fcf9431f9653c3c9a75fec Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 2 May 2023 11:25:35 +0100 Subject: [PATCH] Update validation message: extra borrowing --- .../sales/pages/extra_borrowing_value_check.rb | 14 ++++++++++++-- app/models/sales_log.rb | 6 ++++++ config/locales/en.yml | 3 ++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/models/form/sales/pages/extra_borrowing_value_check.rb b/app/models/form/sales/pages/extra_borrowing_value_check.rb index d0e1bf089..b3cf0b2db 100644 --- a/app/models/form/sales/pages/extra_borrowing_value_check.rb +++ b/app/models/form/sales/pages/extra_borrowing_value_check.rb @@ -7,9 +7,19 @@ class Form::Sales::Pages::ExtraBorrowingValueCheck < Form::Page }, ] @title_text = { - "translation" => "soft_validations.extra_borrowing.title", + "translation" => "soft_validations.extra_borrowing.title_text", + "arguments" => [ + { + "key" => "field_formatted_as_currency", + "arguments_for_key" => "mortgage_and_deposit_total", + "i18n_template" => "mortgage_and_deposit_total", + }, + ], + } + @informative_text = { + "translation" => "soft_validations.extra_borrowing.hint_text", + "arguments" => [], } - @informative_text = {} end def questions diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index 06d1d0f5c..d4ac25450 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -219,6 +219,12 @@ class SalesLog < Log value * equity / 100 end + def mortgage_and_deposit_total + return unless mortgage && deposit + + mortgage + deposit + end + def process_postcode(postcode, postcode_known_key, la_inferred_key, la_key) return if postcode.blank? diff --git a/config/locales/en.yml b/config/locales/en.yml index 6c8e2ff3c..be9816fe9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -543,7 +543,8 @@ en: title: "You told us this person is %{age} or over and not retired" hint_text: "The minimum expected retirement age for %{gender} in England is %{age}." extra_borrowing: - title: "The mortgage and deposit are higher than the purchase minus the discount" + title_text: "You told us that the mortgage and deposit total is %{mortgage_and_deposit_total}" + hint_text: "This is higher than the purchase price minus the discount." pregnancy: title: "You told us somebody in the household is pregnant" no_females: "You also told us there are no female tenants living at the property."