mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
Require legalDocument on domain create
This commit is contained in:
parent
4aaef3f80b
commit
56c923c988
5 changed files with 57 additions and 10 deletions
|
@ -67,11 +67,10 @@ module Epp::Common
|
|||
def epp_request_valid?(*selectors)
|
||||
selectors.each do |selector|
|
||||
el = parsed_frame.css(selector).first
|
||||
next unless el
|
||||
epp_errors << {
|
||||
code: '2003',
|
||||
msg: I18n.t('errors.messages.required_parameter_missing', key: el.name)
|
||||
} unless el.text.present?
|
||||
msg: I18n.t('errors.messages.required_parameter_missing', key: el.try(:name) || selector)
|
||||
} if el.nil? || el.text.blank?
|
||||
end
|
||||
|
||||
epp_errors.empty?
|
||||
|
|
|
@ -100,9 +100,8 @@ module Epp::DomainsHelper
|
|||
def validate_domain_create_request
|
||||
ret = true
|
||||
|
||||
@ph = params_hash['epp']['command']['create']['create']
|
||||
# TODO: Verify contact presence if registrant is juridical
|
||||
attrs_present = xml_attrs_present?(@ph, [['name'], ['ns'], ['registrant']])
|
||||
attrs_present = epp_request_valid?('name', 'ns', 'registrant', 'legalDocument')
|
||||
ret = false unless attrs_present
|
||||
|
||||
if parsed_frame.css('hostObj').any?
|
||||
|
|
|
@ -16,7 +16,7 @@ module Epp::KeyrelayHelper
|
|||
private
|
||||
|
||||
def validate_keyrelay_request
|
||||
epp_request_valid?('pubKey', 'flags', 'protocol', 'algorithm', 'name', 'pw')
|
||||
epp_request_valid?('pubKey', 'flags', 'protocol', 'alg', 'name', 'pw')
|
||||
|
||||
begin
|
||||
abs_datetime = parsed_frame.css('absolute').text
|
||||
|
|
|
@ -41,6 +41,24 @@ describe 'EPP Domain', epp: true do
|
|||
expect(response[:clTRID]).to eq('ABC-12345')
|
||||
end
|
||||
|
||||
it 'validates required parameters' do
|
||||
epp_xml = EppXml::Domain.new(cl_trid: 'ABC-12345')
|
||||
xml = epp_xml.create({
|
||||
name: { value: 'test.ee' }
|
||||
})
|
||||
|
||||
response = epp_request(xml, :xml)
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
expect(response[:results][0][:msg]).to eq('Required parameter missing: ns')
|
||||
|
||||
expect(response[:results][1][:result_code]).to eq('2003')
|
||||
expect(response[:results][1][:msg]).to eq('Required parameter missing: registrant')
|
||||
|
||||
expect(response[:results][2][:result_code]).to eq('2003')
|
||||
expect(response[:results][2][:msg]).to eq('Required parameter missing: legalDocument')
|
||||
end
|
||||
|
||||
context 'with two epp users' do
|
||||
let(:domain) { Domain.first }
|
||||
|
||||
|
|
|
@ -124,8 +124,18 @@ module Epp
|
|||
}
|
||||
|
||||
dnssec_params = dnssec_defaults.deep_merge(dnssec_params) if dnssec_params != false
|
||||
|
||||
custom_params = {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
epp_xml = EppXml::Domain.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.create(xml_params, dnssec_params)
|
||||
epp_xml.create(xml_params, dnssec_params, custom_params)
|
||||
end
|
||||
|
||||
def domain_create_xml_with_legal_doc
|
||||
|
@ -156,7 +166,10 @@ module Epp
|
|||
]
|
||||
}, {}, {
|
||||
_anonymus: [
|
||||
legalDocument: { value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==', attrs: { type: 'pdf' } }
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
})
|
||||
end
|
||||
|
@ -190,8 +203,17 @@ module Epp
|
|||
}
|
||||
}
|
||||
|
||||
custom_params = {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
epp_xml = EppXml::Domain.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.create(xml_params, {})
|
||||
epp_xml.create(xml_params, {}, custom_params)
|
||||
end
|
||||
|
||||
def domain_create_with_host_attrs
|
||||
|
@ -223,8 +245,17 @@ module Epp
|
|||
}
|
||||
}
|
||||
|
||||
custom_params = {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
epp_xml = EppXml::Domain.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.create(xml_params, {})
|
||||
epp_xml.create(xml_params, {}, custom_params)
|
||||
end
|
||||
|
||||
def domain_update_xml(xml_params = {}, dnssec_params = {}, custom_params = {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue