Require legalDocument on domain create

This commit is contained in:
Martin Lensment 2015-01-02 17:38:53 +02:00
parent 4aaef3f80b
commit 56c923c988
5 changed files with 57 additions and 10 deletions

View file

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

View file

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

View file

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