From d3287fd73fd737b6a1c73aa6d9c10343ed6764db Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Fri, 12 Feb 2021 14:22:46 +0200 Subject: [PATCH 1/2] Added test for check domain status UpdatePending if registrants have the same ident --- .../epp/domain/update/base_test.rb | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb index 14e806fca..9a5e79639 100644 --- a/test/integration/epp/domain/update/base_test.rb +++ b/test/integration/epp/domain/update/base_test.rb @@ -123,6 +123,46 @@ class EppDomainUpdateBaseTest < EppTestCase assert_verification_and_notification_emails end + def test_domain_should_doesnt_have_pending_update_when_updated_registrant_with_same_idents_data + assert_not @domain.statuses.include? "pendingUpdate" + + old_registrant = @domain.registrant + new_registrant = contacts(:william).becomes(Registrant) + + new_registrant.update(ident: old_registrant.ident) + new_registrant.update(ident_country_code: old_registrant.ident_country_code) + new_registrant.update(ident_type: old_registrant.ident_type) + + request_xml = <<-XML + + + + + + #{@domain.name} + + #{new_registrant.code} + + + + + + #{'test' * 2000} + + + + + XML + + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + @domain.reload + assert_epp_response :completed_successfully + + assert_equal @domain.registrant, new_registrant + assert_not @domain.statuses.include? "pendingUpdate" + end + def test_requires_verification_from_current_registrant_when_not_yet_verified_by_registrar Setting.request_confirmation_on_registrant_change_enabled = true new_registrant = contacts(:william) From 69562ec2a2d6e05b9c810f306e42a25700aa56fa Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Mon, 15 Feb 2021 17:56:18 +0500 Subject: [PATCH 2/2] Fix checking if verification needed --- app/models/epp/domain.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index ad96adc64..1aec22f7f 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -495,7 +495,7 @@ class Epp::Domain < Domain registrant_verification_needed = false # registrant block may not be present, so we need this to rule out false positives if frame.css('registrant').text.present? - registrant_verification_needed = (registrant.code != frame.css('registrant').text) + registrant_verification_needed = verification_needed?(code: frame.css('registrant').text) end if registrant_verification_needed && disputed? @@ -798,4 +798,13 @@ class Epp::Domain < Domain result end end + + private + + def verification_needed?(code:) + new_registrant = Registrant.find_by(code: code) + return false if new_registrant.try(:identical_to?, registrant) + + registrant.code != code + end end