From 57bb52a8abaae93a217b1f9cc4ed1ddccd90c50a Mon Sep 17 00:00:00 2001 From: oleghasjanov Date: Fri, 27 Mar 2026 11:50:59 +0200 Subject: [PATCH 1/2] Validate registrant phone number during domain Enqueue OrgRegistrantPhoneCheckerJob on domain create, transfer, and update to ensure phone disclosure is checked for registrant contacts at the time of domain operations, not only when contact already has registrant_domains association. Close #2908 --- app/interactions/actions/domain_create.rb | 5 +++++ app/interactions/actions/domain_transfer.rb | 5 +++++ app/interactions/actions/domain_update.rb | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/app/interactions/actions/domain_create.rb b/app/interactions/actions/domain_create.rb index bd4f032d23..0d7dab709a 100644 --- a/app/interactions/actions/domain_create.rb +++ b/app/interactions/actions/domain_create.rb @@ -18,6 +18,7 @@ def call # domain.attach_default_contacts assign_expiry_time maybe_attach_legal_doc + maybe_validate_phone_number commit end @@ -210,5 +211,9 @@ def validation_process_errored? def current_registrar Registrar.find(params[:registrar]) end + + def maybe_validate_phone_number + OrgRegistrantPhoneCheckerJob.perform_later(type: 'single', registrant_user_code: domain.registrant.code) + end end end diff --git a/app/interactions/actions/domain_transfer.rb b/app/interactions/actions/domain_transfer.rb index f72f7b5d73..1249846037 100644 --- a/app/interactions/actions/domain_transfer.rb +++ b/app/interactions/actions/domain_transfer.rb @@ -34,6 +34,7 @@ def run_validations validate_registrar validate_eligilibty validate_not_discarded + maybe_validate_phone_number end def valid_transfer_code? @@ -66,5 +67,9 @@ def commit bare_domain = Domain.find(domain.id) ::DomainTransfer.request(bare_domain, user) end + + def maybe_validate_phone_number + OrgRegistrantPhoneCheckerJob.perform_later(type: 'single', registrant_user_code: domain.registrant.code) + end end end diff --git a/app/interactions/actions/domain_update.rb b/app/interactions/actions/domain_update.rb index 36752b2a0b..bbb30099df 100644 --- a/app/interactions/actions/domain_update.rb +++ b/app/interactions/actions/domain_update.rb @@ -18,6 +18,7 @@ def call ::Actions::BaseAction.maybe_attach_legal_doc(domain, params[:legal_document]) ask_registrant_verification + maybe_validate_phone_number commit end @@ -298,5 +299,9 @@ def any_errors? def true?(obj) obj.to_s.downcase == 'true' end + + def maybe_validate_phone_number + OrgRegistrantPhoneCheckerJob.perform_later(type: 'single', registrant_user_code: domain.registrant.code) + end end end From a1e64f5eb490522d6809f797cfd07bc2214e333d Mon Sep 17 00:00:00 2001 From: oleghasjanov Date: Fri, 27 Mar 2026 13:02:00 +0200 Subject: [PATCH 2/2] fixed tests --- test/integration/epp/domain/update/base_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb index a8c2045c9a..3853743c91 100644 --- a/test/integration/epp/domain/update/base_test.rb +++ b/test/integration/epp/domain/update/base_test.rb @@ -304,7 +304,7 @@ def test_requires_verification_from_current_registrant_when_provided_registrant_ XML assert_no_enqueued_jobs - assert_enqueued_jobs 3 do + assert_enqueued_jobs 4 do post epp_update_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end @@ -387,7 +387,7 @@ def test_requires_verification_from_current_registrant_when_not_yet_verified_by_ XML assert_no_enqueued_jobs - assert_enqueued_jobs 3 do + assert_enqueued_jobs 4 do post epp_update_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end @@ -427,7 +427,7 @@ def test_updates_registrant_when_legaldoc_is_not_mandatory XML assert_no_enqueued_jobs - assert_enqueued_jobs 3 do + assert_enqueued_jobs 4 do post epp_update_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end