Browse Source

Default discounted_sale_value_check on import

pull/1429/head
Kat 3 years ago
parent
commit
a46fbd3f14
  1. 4
      app/services/imports/sales_logs_import_service.rb
  2. 15
      spec/services/imports/sales_logs_import_service_spec.rb

4
app/services/imports/sales_logs_import_service.rb

@ -153,6 +153,7 @@ module Imports
attributes["income2_value_check"] = 0 attributes["income2_value_check"] = 0
attributes["monthly_charges_value_check"] = 0 attributes["monthly_charges_value_check"] = 0
attributes["student_not_child_value_check"] = 0 attributes["student_not_child_value_check"] = 0
attributes["discounted_sale_value_check"] = 0
# Sets the log creator # Sets the log creator
owner_id = meta_field_value(xml_doc, "owner-user-id").strip owner_id = meta_field_value(xml_doc, "owner-user-id").strip
@ -255,7 +256,8 @@ module Imports
monthly_charges_value_check monthly_charges_value_check
hodate_check hodate_check
saledate_check saledate_check
student_not_child_value_check] student_not_child_value_check
discounted_sale_value_check]
end end
def check_status_completed(sales_log, previous_status) def check_status_completed(sales_log, previous_status)

15
spec/services/imports/sales_logs_import_service_spec.rb

@ -379,6 +379,21 @@ RSpec.describe Imports::SalesLogsImportService do
end end
end end
context "and the value soft validation is triggered (discounted_sale_value_check)" do
let(:sales_log_id) { "discounted_ownership_sales_log" }
before do
sales_log_xml.at_xpath("//xmlns:Q31PurchasePrice").content = "500000"
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")
expect(sales_log.discounted_sale_value_check).to eq(0)
end
end
context "and it has an invalid record with invalid child age" do context "and it has an invalid record with invalid child age" do
let(:sales_log_id) { "discounted_ownership_sales_log" } let(:sales_log_id) { "discounted_ownership_sales_log" }

Loading…
Cancel
Save