Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/interactions/actions/domain_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def assign_new_registrant
def replace_domain_registrant(new_registrant)
return if domain.registrant == new_registrant

@changes_registrant = true if domain.registrant.ident != new_registrant.ident
@changes_registrant = true unless domain.registrant.identical_to?(new_registrant)
if @changes_registrant && domain.registrant_change_prohibited?
domain.add_epp_error(2304, 'status', DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED,
I18n.t(:object_status_prohibits_operation))
Expand Down
48 changes: 48 additions & 0 deletions test/integration/epp/domain/update/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,14 @@ def test_domain_should_not_padding_if_registrant_update_with_same_ident
refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE
end

def test_asks_verification_when_registrant_has_same_ident_but_different_country_code
assert_registrant_change_verification_asked(ident_country_code: 'LV')
end

def test_asks_verification_when_registrant_has_same_ident_but_different_ident_type
assert_registrant_change_verification_asked(ident_type: 'org')
end

def test_skips_verification_when_provided_registrant_is_the_same_as_current_one
Setting.request_confirmation_on_registrant_change_enabled = true

Expand Down Expand Up @@ -1185,4 +1193,44 @@ def test_does_not_allow_underage_admin_contact
def assert_verification_and_notification_emails
assert_emails 2
end

def assert_registrant_change_verification_asked(different_attrs)
Setting.request_confirmation_on_registrant_change_enabled = true

current = @domain.registrant
new_registrant = contacts(:william)
new_registrant.update_columns(
{ ident: current.ident, ident_type: current.ident_type,
ident_country_code: current.ident_country_code }.merge(different_attrs)
)

request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee', for_version: '1.0')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee', for_version: '1.2')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant>#{new_registrant.code}</domain:registrant>
</domain:chg>
</domain:update>
</update>
<extension>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis', for_version: '1.0')}">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML

post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload

assert_epp_response :completed_successfully_action_pending
assert_includes @domain.statuses, DomainStatus::PENDING_UPDATE
assert_equal current, @domain.registrant
end
end
Loading