mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Require legal doc on domain delete
This commit is contained in:
parent
56c923c988
commit
1996ff725e
2 changed files with 33 additions and 7 deletions
|
@ -174,8 +174,7 @@ module Epp::DomainsHelper
|
|||
|
||||
## DELETE
|
||||
def validate_domain_delete_request
|
||||
@ph = params_hash['epp']['command']['delete']['delete']
|
||||
xml_attrs_present?(@ph, [['name']])
|
||||
epp_request_valid?('name', 'legalDocument')
|
||||
end
|
||||
|
||||
## SHARED
|
||||
|
@ -192,14 +191,13 @@ module Epp::DomainsHelper
|
|||
return nil
|
||||
end
|
||||
|
||||
@ph[:authInfo] ||= {}
|
||||
return domain if domain.auth_info == @ph[:authInfo][:pw]
|
||||
return domain if domain.auth_info == parsed_frame.css('authInfo pw').text
|
||||
|
||||
if (domain.registrar != current_epp_user.registrar && secure[:secure] == true) &&
|
||||
epp_errors << {
|
||||
code: '2302',
|
||||
msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'),
|
||||
value: { obj: 'name', val: @ph[:name].strip.downcase }
|
||||
value: { obj: 'name', val: parsed_frame.css('name').text.strip.downcase }
|
||||
}
|
||||
return nil
|
||||
end
|
||||
|
|
|
@ -1191,7 +1191,18 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
it 'deletes domain' do
|
||||
expect(DomainContact.count).to eq(2)
|
||||
response = epp_request(epp_xml.domain.delete(name: { value: 'example.ee' }), :xml)
|
||||
|
||||
response = epp_request(epp_xml.domain.delete({
|
||||
name: { value: 'example.ee' }
|
||||
}, {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
}), :xml)
|
||||
|
||||
expect(response[:result_code]).to eq('1000')
|
||||
|
||||
expect(Domain.first).to eq(nil)
|
||||
|
@ -1201,10 +1212,27 @@ describe 'EPP Domain', epp: true do
|
|||
it 'does not delete domain with specific status' do
|
||||
d = Domain.first
|
||||
d.domain_statuses.create(value: DomainStatus::CLIENT_DELETE_PROHIBITED)
|
||||
response = epp_request(epp_xml.domain.delete(name: { value: 'example.ee' }), :xml)
|
||||
|
||||
response = epp_request(epp_xml.domain.delete({
|
||||
name: { value: 'example.ee' }
|
||||
}, {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
}), :xml)
|
||||
|
||||
expect(response[:result_code]).to eq('2304')
|
||||
expect(response[:msg]).to eq('Domain status prohibits operation')
|
||||
end
|
||||
|
||||
it 'does not delete domain without legal document' do
|
||||
response = epp_request(epp_xml.domain.delete(name: { value: 'example.ee' }), :xml)
|
||||
expect(response[:result_code]).to eq('2003')
|
||||
expect(response[:msg]).to eq('Required parameter missing: legalDocument')
|
||||
end
|
||||
end
|
||||
|
||||
it 'checks a domain' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue