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 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