Browse Source

Mark hodate value check confirmed (#1906)

* Mark hodate value check confirmed

* Add other missing value_checks for sales
pull/1908/head
kosiakkatrina 1 year ago committed by GitHub
parent
commit
564fa9ebb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/services/imports/sales_logs_import_service.rb
  2. 50
      spec/services/imports/sales_logs_import_service_spec.rb

6
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

50
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" }

Loading…
Cancel
Save