diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index f280eb160..31716de7d 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? @@ -797,4 +797,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 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)