diff --git a/app/services/imports/sales_logs_import_service.rb b/app/services/imports/sales_logs_import_service.rb index 157e797b4..68d8e95ce 100644 --- a/app/services/imports/sales_logs_import_service.rb +++ b/app/services/imports/sales_logs_import_service.rb @@ -152,6 +152,10 @@ module Imports attributes["discounted_sale_value_check"] = 0 attributes["buyer_livein_value_check"] = 0 attributes["percentage_discount_value_check"] = 0 + attributes["hodate_check"] = 0 + attributes["saledate_check"] = 0 + attributes["combined_income_value_check"] = 0 + attributes["stairowned_value_check"] = 0 # 2023/34 attributes attributes["address_line1"] = string_or_nil(xml_doc, "AddressLine1") @@ -330,6 +334,8 @@ module Imports discounted_sale_value_check buyer_livein_value_check percentage_discount_value_check + combined_income_value_check + stairowned_value_check uprn_known uprn_confirmed] end diff --git a/spec/services/imports/sales_logs_import_service_spec.rb b/spec/services/imports/sales_logs_import_service_spec.rb index df279e5d5..2357618d0 100644 --- a/spec/services/imports/sales_logs_import_service_spec.rb +++ b/spec/services/imports/sales_logs_import_service_spec.rb @@ -595,6 +595,56 @@ RSpec.describe Imports::SalesLogsImportService do end end + context "and the hodate soft validation is triggered (hodate_value_check)" do + let(:sales_log_id) { "shared_ownership_sales_log" } + + before do + sales_log_xml.at_xpath("//xmlns:HODAY").content = "1" + sales_log_xml.at_xpath("//xmlns:HOMONTH").content = "1" + sales_log_xml.at_xpath("//xmlns:HOYEAR").content = "2018" + end + + it "completes the log" do + sales_log_service.send(:create_log, sales_log_xml) + sales_log = SalesLog.find_by(old_id: sales_log_id) + expect(sales_log.status).to eq("completed") + end + end + + context "and the combined income soft validation is triggered (combined_income_value_check)" do + let(:sales_log_id) { "shared_ownership_sales_log" } + + before do + sales_log_xml.at_xpath("//xmlns:joint").content = "1 Yes" + sales_log_xml.at_xpath("//xmlns:Q2Person1Income").content = "45000" + sales_log_xml.at_xpath("//xmlns:P2IncKnown").content = "1 Yes" + sales_log_xml.at_xpath("//xmlns:Q2Person2Income").content = "45000" + end + + it "completes the log" do + sales_log_service.send(:create_log, sales_log_xml) + sales_log = SalesLog.find_by(old_id: sales_log_id) + expect(sales_log.status).to eq("completed") + end + end + + context "and the stairowned soft validation is triggered (stairowned_value_check)" do + let(:sales_log_id) { "shared_ownership_sales_log" } + + before do + sales_log_xml.at_xpath("//xmlns:DerSaleType").content = "24" + sales_log_xml.at_xpath("//xmlns:PercentOwns").content = "77" + sales_log_xml.at_xpath("//xmlns:Q17aStaircase").content = "1" + sales_log_xml.at_xpath("//xmlns:PercentBought").content = "10" + end + + it "completes the log" do + sales_log_service.send(:create_log, sales_log_xml) + sales_log = SalesLog.find_by(old_id: sales_log_id) + expect(sales_log.status).to eq("completed") + end + end + context "and it has an invalid record with invalid child age" do let(:sales_log_id) { "discounted_ownership_sales_log" }