Merge pull request #1962 from internetee/dependabot/bundler/rails-6.1.3.1

Bump rails from 6.0.3.6 to 6.1.3.1
This commit is contained in:
Timo Võhmar 2021-05-06 15:40:10 +03:00 committed by GitHub
commit b2b7e44f74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 525 additions and 448 deletions

View file

@ -76,65 +76,69 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.3.6)
actionpack (= 6.0.3.6)
actioncable (6.1.3.1)
actionpack (= 6.1.3.1)
activesupport (= 6.1.3.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.6)
actionpack (= 6.0.3.6)
activejob (= 6.0.3.6)
activerecord (= 6.0.3.6)
activestorage (= 6.0.3.6)
activesupport (= 6.0.3.6)
actionmailbox (6.1.3.1)
actionpack (= 6.1.3.1)
activejob (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
mail (>= 2.7.1)
actionmailer (6.0.3.6)
actionpack (= 6.0.3.6)
actionview (= 6.0.3.6)
activejob (= 6.0.3.6)
actionmailer (6.1.3.1)
actionpack (= 6.1.3.1)
actionview (= 6.1.3.1)
activejob (= 6.1.3.1)
activesupport (= 6.1.3.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.6)
actionview (= 6.0.3.6)
activesupport (= 6.0.3.6)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.3.1)
actionview (= 6.1.3.1)
activesupport (= 6.1.3.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.6)
actionpack (= 6.0.3.6)
activerecord (= 6.0.3.6)
activestorage (= 6.0.3.6)
activesupport (= 6.0.3.6)
actiontext (6.1.3.1)
actionpack (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
nokogiri (>= 1.8.5)
actionview (6.0.3.6)
activesupport (= 6.0.3.6)
actionview (6.1.3.1)
activesupport (= 6.1.3.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_interaction (4.0.0)
activemodel (>= 5, < 7)
activejob (6.0.3.6)
activesupport (= 6.0.3.6)
activejob (6.1.3.1)
activesupport (= 6.1.3.1)
globalid (>= 0.3.6)
activemodel (6.0.3.6)
activesupport (= 6.0.3.6)
activerecord (6.0.3.6)
activemodel (= 6.0.3.6)
activesupport (= 6.0.3.6)
activemodel (6.1.3.1)
activesupport (= 6.1.3.1)
activerecord (6.1.3.1)
activemodel (= 6.1.3.1)
activesupport (= 6.1.3.1)
activerecord-import (1.0.8)
activerecord (>= 3.2)
activestorage (6.0.3.6)
actionpack (= 6.0.3.6)
activejob (= 6.0.3.6)
activerecord (= 6.0.3.6)
activestorage (6.1.3.1)
actionpack (= 6.1.3.1)
activejob (= 6.1.3.1)
activerecord (= 6.1.3.1)
activesupport (= 6.1.3.1)
marcel (~> 1.0.0)
activesupport (6.0.3.6)
mini_mime (~> 1.0.2)
activesupport (6.1.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
aes_key_wrap (1.1.0)
@ -289,7 +293,7 @@ GEM
mimemagic (0.4.3)
nokogiri (~> 1)
rake
mini_mime (1.1.0)
mini_mime (1.0.3)
mini_portile2 (2.5.1)
minitest (5.14.4)
monetize (1.9.4)
@ -358,32 +362,32 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.6)
actioncable (= 6.0.3.6)
actionmailbox (= 6.0.3.6)
actionmailer (= 6.0.3.6)
actionpack (= 6.0.3.6)
actiontext (= 6.0.3.6)
actionview (= 6.0.3.6)
activejob (= 6.0.3.6)
activemodel (= 6.0.3.6)
activerecord (= 6.0.3.6)
activestorage (= 6.0.3.6)
activesupport (= 6.0.3.6)
bundler (>= 1.3.0)
railties (= 6.0.3.6)
rails (6.1.3.1)
actioncable (= 6.1.3.1)
actionmailbox (= 6.1.3.1)
actionmailer (= 6.1.3.1)
actionpack (= 6.1.3.1)
actiontext (= 6.1.3.1)
actionview (= 6.1.3.1)
activejob (= 6.1.3.1)
activemodel (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
bundler (>= 1.15.0)
railties (= 6.1.3.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.3.6)
actionpack (= 6.0.3.6)
activesupport (= 6.0.3.6)
railties (6.1.3.1)
actionpack (= 6.1.3.1)
activesupport (= 6.1.3.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
thor (~> 1.0)
rake (13.0.3)
ransack (2.4.2)
activerecord (>= 5.2.4)
@ -459,12 +463,11 @@ GEM
httpclient (>= 2.4)
temple (0.8.2)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.10)
truemail (2.4.0)
simpleidn (~> 0.2.1)
tzinfo (1.2.9)
thread_safe (~> 0.1)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
@ -577,4 +580,4 @@ DEPENDENCIES
wkhtmltopdf-binary (~> 0.12.5.1)
BUNDLED WITH
2.2.15
2.2.16

View file

@ -34,7 +34,7 @@ module Admin
params[:admin_user].delete(:password) if params[:admin_user][:password].blank?
params[:admin_user].delete(:password_confirmation) if params[:admin_user][:password_confirmation].blank?
if @admin_user.update_attributes(admin_user_params)
if @admin_user.update(admin_user_params)
flash[:notice] = I18n.t('record_updated')
redirect_to [:admin, @admin_user]
else

View file

@ -40,7 +40,6 @@ module Admin
def create
@price = ::Billing::Price.new(price_params)
if @price.save
flash[:notice] = t('.created')
redirect_to_index
@ -50,7 +49,7 @@ module Admin
end
def update
if @price.update_attributes(price_params)
if @price.update(price_params.compact_blank)
flash[:notice] = t('.updated')
redirect_to_index
else
@ -81,7 +80,11 @@ module Admin
valid_to
]
params.require(:price).permit(*allowed_params)
allowed = params.require(:price).permit(*allowed_params)
if allowed[:duration]
allowed[:duration] = ActiveSupport::Duration.build(allowed[:duration].to_i)
end
allowed
end
def search_params
@ -104,8 +107,7 @@ module Admin
end
def durations
durations = ::Billing::Price::durations
durations.collect { |duration| [duration.sub('mon', 'month'), duration] }
::Billing::Price::durations
end
def statuses

View file

@ -28,27 +28,24 @@ module Epp
protected
def respond_with_command_failed_error(exception)
epp_errors << {
code: '2400',
msg: 'Command failed',
}
epp_errors.add(:epp_errors,
code: '2400',
message: 'Command failed')
handle_errors
log_exception(exception)
end
def respond_with_object_does_not_exist_error
epp_errors << {
code: '2303',
msg: 'Object does not exist',
}
epp_errors.add(:epp_errors,
code: '2303',
msg: 'Object does not exist')
handle_errors
end
def respond_with_authorization_error
epp_errors << {
code: '2201',
msg: 'Authorization error',
}
epp_errors.add(:epp_errors,
code: '2201',
msg: 'Authorization error')
handle_errors
end
@ -63,10 +60,9 @@ module Epp
def validate_against_schema
return if %w[hello error].include?(params[:action])
schema.validate(params[:nokogiri_frame]).each do |error|
epp_errors << {
code: 2001,
msg: error
}
epp_errors.add(:epp_errors,
code: 2001,
msg: error)
end
handle_errors and return if epp_errors.any?
end
@ -94,29 +90,17 @@ module Epp
# ERROR + RESPONSE HANDLING
def epp_errors
@errors ||= []
@errors ||= ActiveModel::Errors.new(self)
end
def handle_errors(obj = nil)
@errors ||= []
@errors ||= ActiveModel::Errors.new(self)
if obj
obj.construct_epp_errors
@errors += obj.errors[:epp_errors]
obj.errors.each { |error| @errors.import error }
end
if params[:parsed_frame]&.at_css('update')
@errors.each_with_index do |errors, index|
if errors[:code] == '2304' &&
errors[:value].present? &&
errors[:value][:val] == DomainStatus::SERVER_DELETE_PROHIBITED &&
errors[:value][:obj] == 'status'
@errors[index][:value][:val] = DomainStatus::PENDING_UPDATE
end
end
end
@errors.uniq!
render_epp_response '/epp/error'
end
@ -133,10 +117,9 @@ module Epp
return true
end
epp_errors << {
msg: 'Parameter value policy error. Allowed only Latin characters.',
code: '2306'
}
epp_errors.add(:epp_errors,
msg: 'Parameter value policy error. Allowed only Latin characters.',
code: '2306')
handle_errors and return false
end
@ -180,10 +163,12 @@ module Epp
else
missing = el.present? ? el.text.blank? : true
end
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_parameter_missing', key: "#{full_selector} [#{attr}]")
} if missing
next unless missing
epp_errors.add(:epp_errors,
code: '2003',
message: I18n.t('errors.messages.required_parameter_missing',
key: "#{full_selector} [#{attr}]"))
end
missing ? false : el # return last selector if it was present
@ -201,25 +186,23 @@ module Epp
attribute = element[attribute_selector]
unless attribute
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_parameter_missing', key: attribute_selector)
}
epp_errors.add(:epp_errors,
code: '2003',
msg: I18n.t('errors.messages.required_parameter_missing',
key: attribute_selector))
return
end
return if options[:values].include?(attribute)
if options[:policy]
epp_errors << {
code: '2306',
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector)
}
epp_errors.add(:epp_errors,
code: '2306',
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector))
else
epp_errors << {
code: '2004',
msg: I18n.t('parameter_value_range_error', key: attribute_selector)
}
epp_errors.add(:epp_errors,
code: '2004',
msg: I18n.t('parameter_value_range_error', key: attribute_selector))
end
end
@ -231,30 +214,29 @@ module Epp
attribute = element[attribute_selector]
return if (attribute && options[:values].include?(attribute)) || !attribute
epp_errors << {
code: '2306',
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector)
}
epp_errors.add(:epp_errors,
code: '2306',
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector))
end
def exactly_one_of(*selectors)
full_selectors = create_full_selectors(*selectors)
return if element_count(*full_selectors, use_prefix: false) == 1
epp_errors << {
code: '2306',
msg: I18n.t(:exactly_one_parameter_required, params: full_selectors.join(' OR '))
}
epp_errors.add(:epp_errors,
code: '2306',
msg: I18n.t(:exactly_one_parameter_required,
params: full_selectors.join(' OR ')))
end
def mutually_exclusive(*selectors)
full_selectors = create_full_selectors(*selectors)
return if element_count(*full_selectors, use_prefix: false) <= 1
epp_errors << {
code: '2306',
msg: I18n.t(:mutally_exclusive_params, params: full_selectors.join(', '))
}
epp_errors.add(:epp_errors,
code: '2306',
msg: I18n.t(:mutally_exclusive_params,
params: full_selectors.join(', ')))
end
def optional(selector, *validations)
@ -265,8 +247,8 @@ module Epp
validations.each do |x|
validator = "#{x.first[0]}_validator".camelize.constantize
err = validator.validate_epp(selector.split(' ').last, value)
epp_errors << err if err
result = validator.validate_epp(selector.split(' ').last, value)
epp_errors.add(:epp_errors, result) if result
end
end
@ -297,10 +279,11 @@ module Epp
def xml_attrs_present?(ph, attributes) # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE
attributes.each do |x|
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_parameter_missing', key: x.last)
} unless has_attribute(ph, x)
next if has_attribute(ph, x)
epp_errors.add(:epp_errors,
code: '2003',
msg: I18n.t('errors.messages.required_parameter_missing', key: x.last))
end
epp_errors.empty?
end
@ -355,10 +338,9 @@ module Epp
def enforce_epp_session_timeout
if epp_session.timed_out?
epp_errors << {
code: '2201',
msg: 'Authorization error: Session timeout',
}
epp_errors.add(:epp_errors,
code: '2201',
msg: 'Authorization error: Session timeout')
handle_errors
epp_session.destroy!
else

View file

@ -55,13 +55,13 @@ module Epp
def renew
authorize! :renew, Epp::Contact
epp_errors << { code: '2101', msg: t(:'errors.messages.unimplemented_command') }
epp_errors.add(:epp_errors, code: '2101', msg: t(:'errors.messages.unimplemented_command'))
handle_errors
end
def transfer
authorize! :transfer, Epp::Contact
epp_errors << { code: '2101', msg: t(:'errors.messages.unimplemented_command') }
epp_errors.add(:epp_errors, code: '2101', msg: t(:'errors.messages.unimplemented_command'))
handle_errors
end
@ -72,9 +72,10 @@ module Epp
end
def action_call_response(action:)
# rubocop:disable Style/AndOr
(handle_errors(@contact) and return) unless action.call
# rubocop:enable Style/AndOr
unless action.call
handle_errors(@contact)
return
end
if opt_addr?
@response_code = 1100
@ -134,24 +135,16 @@ module Epp
ident = params[:parsed_frame].css('ident')
if ident.present? && ident.attr('type').blank?
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'type')
}
epp_errors.add(:epp_errors,
code: '2003',
msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'type'))
end
if ident.present? && ident.text != 'birthday' && ident.attr('cc').blank?
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'cc')
}
epp_errors.add(:epp_errors,
code: '2003',
msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'cc'))
end
# if ident.present? && ident.attr('cc').blank?
# epp_errors << {
# code: '2003',
# msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'cc')
# }
# end
contact_org_disabled
fax_disabled
status_editing_disabled
@ -178,28 +171,25 @@ module Epp
return true if ENV['contact_org_enabled'] == 'true'
return true if params[:parsed_frame].css('postalInfo org').text.blank?
epp_errors << {
code: '2306',
msg: "#{I18n.t(:contact_org_error)}: postalInfo > org [org]"
}
epp_errors.add(:epp_errors,
code: '2306',
msg: "#{I18n.t(:contact_org_error)}: postalInfo > org [org]")
end
def fax_disabled
return true if ENV['fax_enabled'] == 'true'
return true if params[:parsed_frame].css('fax').text.blank?
epp_errors << {
code: '2306',
msg: "#{I18n.t(:contact_fax_error)}: fax [fax]"
}
epp_errors.add(:epp_errors,
code: '2306',
msg: "#{I18n.t(:contact_fax_error)}: fax [fax]")
end
def status_editing_disabled
return true if Setting.client_status_editing_enabled
return true if params[:parsed_frame].css('status').empty?
epp_errors << {
code: '2306',
msg: "#{I18n.t(:client_side_status_editing_error)}: status [status]"
}
epp_errors.add(:epp_errors,
code: '2306',
msg: "#{I18n.t(:client_side_status_editing_error)}: status [status]")
end
def address_given?

View file

@ -44,7 +44,10 @@ module Epp
update_params = ::Deserializers::Xml::DomainUpdate.new(params[:parsed_frame],
registrar_id).call
action = Actions::DomainUpdate.new(@domain, update_params, false)
(handle_errors(@domain) and return) unless action.call
unless action.call
handle_errors(@domain)
return
end
pending = @domain.epp_pending_update.present?
render_epp_response("/epp/domains/success#{'_pending' if pending}")
@ -90,10 +93,9 @@ module Epp
action = params[:parsed_frame].css('transfer').first[:op]
if @domain.non_transferable?
epp_errors << {
code: '2304',
msg: I18n.t(:object_status_prohibits_operation),
}
epp_errors.add(:epp_errors,
code: '2304',
msg: I18n.t(:object_status_prohibits_operation))
handle_errors
return
end
@ -102,10 +104,9 @@ module Epp
wrong_transfer_code = provided_transfer_code != @domain.transfer_code
if wrong_transfer_code
epp_errors << {
code: '2202',
msg: 'Invalid authorization information',
}
epp_errors.add(:epp_errors,
code: '2202',
msg: 'Invalid authorization information')
handle_errors
return
end
@ -120,10 +121,9 @@ module Epp
if @domain_transfer
render_epp_response '/epp/domains/transfer'
else
epp_errors << {
code: '2303',
msg: I18n.t('no_transfers_found')
}
epp_errors.add(:epp_errors,
code: '2303',
msg: I18n.t('no_transfers_found'))
handle_errors
end
end
@ -184,11 +184,10 @@ module Epp
def validate_transfer
# period element is disabled for now
if params[:parsed_frame].css('period').any?
epp_errors << {
code: '2307',
msg: I18n.t(:unimplemented_object_service),
value: { obj: 'period' }
}
epp_errors.add(:epp_errors,
code: '2307',
msg: I18n.t(:unimplemented_object_service),
value: { obj: 'period' })
end
requires 'transfer > transfer'
@ -217,10 +216,9 @@ module Epp
return true if Setting.client_status_editing_enabled
return true if check_client_hold
return true if params[:parsed_frame].css('status').empty?
epp_errors << {
code: '2306',
msg: "#{I18n.t(:client_side_status_editing_error)}: status [status]"
}
epp_errors.add(:epp_errors,
code: '2306',
msg: "#{I18n.t(:client_side_status_editing_error)}: status [status]")
end
def check_client_hold
@ -232,17 +230,15 @@ module Epp
@domain_pricelist = @domain.pricelist(operation, period.try(:to_i), unit)
if @domain_pricelist.try(:price) # checking if price list is not found
if current_user.registrar.balance < @domain_pricelist.price.amount
epp_errors << {
code: '2104',
msg: I18n.t('billing_failure_credit_balance_low')
}
epp_errors.add(:epp_errors,
code: '2104',
msg: I18n.t('billing_failure_credit_balance_low'))
return false
end
else
epp_errors << {
code: '2104',
msg: I18n.t(:active_price_missing_for_this_operation)
}
epp_errors.add(:epp_errors,
code: '2104',
msg: I18n.t(:active_price_missing_for_this_operation))
return false
end
true

View file

@ -3,12 +3,12 @@ module Epp
skip_authorization_check
def error
epp_errors << { code: params[:code], msg: params[:msg] }
epp_errors.add(:epp_errors, code: params[:code], msg: params[:msg])
render_epp_response '/epp/error'
end
def command_handler
epp_errors << { code: '2000', msg: 'Unknown command' }
epp_errors.add(:epp_errors, code: '2000', msg: 'Unknown command')
render_epp_response '/epp/error'
end
end

View file

@ -43,11 +43,11 @@ module Epp
@notification = current_user.unread_notifications.find_by(id: params[:parsed_frame].css('poll').first['msgID'])
unless @notification
epp_errors << {
code: '2303',
msg: I18n.t('message_was_not_found'),
value: { obj: 'msgID', val: params[:parsed_frame].css('poll').first['msgID'] }
}
epp_errors.add(:epp_errors,
code: '2303',
msg: I18n.t('message_was_not_found'),
value: { obj: 'msgID',
val: params[:parsed_frame].css('poll').first['msgID'] })
handle_errors and return
end

View file

@ -20,10 +20,10 @@ module Epp
server_md5 = Certificate.parse_md_from_string(File.read(ENV['cert_path']))
if client_md5 != server_md5
epp_errors << {
msg: 'Authentication error; server closing connection (certificate is not valid)',
code: '2501'
}
msg = 'Authentication error; server closing connection (certificate is not valid)'
epp_errors.add(:epp_errors,
msg: msg,
code: '2501')
success = false
end
@ -32,56 +32,56 @@ module Epp
if !Rails.env.development? && (!webclient_request && @api_user)
unless @api_user.pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'],
request.env['HTTP_SSL_CLIENT_S_DN_CN'])
epp_errors << {
msg: 'Authentication error; server closing connection (certificate is not valid)',
code: '2501'
}
msg = 'Authentication error; server closing connection (certificate is not valid)'
epp_errors.add(:epp_errors,
msg: msg,
code: '2501')
success = false
end
end
if success && !@api_user
epp_errors << {
msg: 'Authentication error; server closing connection (API user not found)',
code: '2501'
}
msg = 'Authentication error; server closing connection (API user not found)'
epp_errors.add(:epp_errors,
msg: msg,
code: '2501')
success = false
end
if success && !@api_user.try(:active)
epp_errors << {
msg: 'Authentication error; server closing connection (API user is not active)',
code: '2501'
}
msg = 'Authentication error; server closing connection (API user is not active)'
epp_errors.add(:epp_errors,
msg: msg,
code: '2501')
success = false
end
if success && @api_user.cannot?(:create, :epp_login)
epp_errors << {
msg: 'Authentication error; server closing connection (API user does not have epp role)',
code: '2501'
}
msg = 'Authentication error; server closing connection (API user does not have epp role)'
epp_errors.add(:epp_errors,
msg: msg,
code: '2501')
success = false
end
if success && !ip_white?
epp_errors << {
msg: 'Authentication error; server closing connection (IP is not whitelisted)',
code: '2501'
}
msg = 'Authentication error; server closing connection (IP is not whitelisted)'
epp_errors.add(:epp_errors,
msg: msg,
code: '2501')
success = false
end
if success && EppSession.limit_reached?(@api_user.registrar)
epp_errors << {
msg: 'Session limit exceeded; server closing connection (connection limit reached)',
code: '2502',
}
msg = 'Session limit exceeded; server closing connection (connection limit reached)'
epp_errors.add(:epp_errors,
msg: msg,
code: '2502')
success = false
end
@ -98,10 +98,9 @@ module Epp
already_authenticated = EppSession.exists?(session_id: epp_session_id)
if already_authenticated
epp_errors << {
msg: 'Command use error; Already authenticated',
code: 2002,
}
epp_errors.add(:epp_errors,
msg: 'Command use error; Already authenticated',
code: 2002)
handle_errors
return
end
@ -127,10 +126,9 @@ module Epp
def logout
unless signed_in?
epp_errors << {
code: 2201,
msg: 'Authorization error'
}
epp_errors.add(:epp_errors,
code: 2201,
msg: 'Authorization error')
handle_errors
return
end

View file

@ -5,7 +5,7 @@ class Registrar
def new
authorize! :manage, :repp
@expire_date = Time.zone.now.to_date
render file: 'registrar/bulk_change/new', locals: { active_tab: default_tab }
render 'registrar/bulk_change/new', locals: { active_tab: default_tab }
end
def bulk_renew
@ -21,7 +21,7 @@ class Registrar
flash[:notice] = nil
end
render file: 'registrar/bulk_change/new', locals: { active_tab: :bulk_renew }
render 'registrar/bulk_change/new', locals: { active_tab: :bulk_renew }
end
private
@ -45,7 +45,7 @@ class Registrar
redirect_to registrar_domains_url
else
@error = response.code == '404' ? 'Contact(s) not found' : parsed_response[:message]
render file: 'registrar/bulk_change/new', locals: { active_tab: active_tab }
render 'registrar/bulk_change/new', locals: { active_tab: active_tab }
end
end

View file

@ -43,9 +43,11 @@ class Registrar
send_data raw_csv, filename: 'contacts.csv', type: "#{Mime[:csv]}; charset=utf-8"
end
format.pdf do
view = ActionView::Base.new(ActionController::Base.view_paths, contacts: contacts)
view.class_eval { include ::ApplicationHelper }
raw_html = view.render(file: 'registrar/contacts/list_pdf', layout: false)
raw_html = ApplicationController.render(
template: 'registrar/contacts/list_pdf',
assigns: { contacts: contacts },
formats: [:html]
)
raw_pdf = contacts.pdf(raw_html)
send_data raw_pdf, filename: 'contacts.pdf'

View file

@ -36,7 +36,7 @@ class Registrar
redirect_to registrar_domains_url
else
@api_errors = parsed_response[:message]
render file: 'registrar/bulk_change/new', locals: { active_tab: :bulk_transfer }
render 'registrar/bulk_change/new', locals: { active_tab: :bulk_transfer }
end
else
params[:request] = true # EPP domain:transfer "op" attribute

View file

@ -27,7 +27,7 @@ class Registrar
flash: { notice: compose_notice_message(parsed_response) })
else
@api_errors = parsed_response[:message]
render file: 'registrar/bulk_change/new', locals: { active_tab: :nameserver }
render 'registrar/bulk_change/new', locals: { active_tab: :nameserver }
end
end

View file

@ -17,10 +17,10 @@ module Repp
@response = { code: 2303, message: 'Object does not exist' }
render(json: @response, status: :not_found)
rescue ActionController::ParameterMissing, Apipie::ParamMissing => e
@response = { code: 2003, message: e }
@response = { code: 2003, message: e.message.gsub(/\n/, '. ') }
render(json: @response, status: :bad_request)
rescue Apipie::ParamInvalid => e
@response = { code: 2005, message: e }
@response = { code: 2005, message: e.message.gsub(/\n/, '. ') }
render(json: @response, status: :bad_request)
ensure
create_repp_log
@ -60,40 +60,28 @@ module Repp
end
def epp_errors
@epp_errors ||= []
@epp_errors ||= ActiveModel::Errors.new(self)
end
def handle_errors(obj = nil, update: false)
@epp_errors ||= []
def handle_errors(obj = nil)
@epp_errors ||= ActiveModel::Errors.new(self)
obj&.construct_epp_errors
@epp_errors += obj.errors[:epp_errors] if obj
format_epp_errors if update
@epp_errors.uniq!
if obj
obj.construct_epp_errors
obj.errors.each { |error| @epp_errors.import error }
end
render_epp_error
end
def format_epp_errors
@epp_errors.each_with_index do |error, index|
blocked_by_delete_prohibited?(error, index)
end
end
def blocked_by_delete_prohibited?(error, index)
if error[:code] == 2304 && error[:value][:val] == DomainStatus::SERVER_DELETE_PROHIBITED &&
error[:value][:obj] == 'status'
@epp_errors[index][:value][:val] = DomainStatus::PENDING_UPDATE
end
end
def render_epp_error(status = :bad_request, data = {})
@epp_errors ||= []
@epp_errors << { code: 2304, msg: 'Command failed' } if data != {}
@epp_errors ||= ActiveModel::Errors.new(self)
@epp_errors.add(:epp_errors, msg: 'Command failed', code: '2304') if data != {}
@response = { code: @epp_errors[0][:code].to_i, message: @epp_errors[0][:msg], data: data }
error_options = @epp_errors.errors.uniq
.select { |error| error.options[:code].present? }[0].options
@response = { code: error_options[:code].to_i, message: error_options[:msg], data: data }
render(json: @response, status: status)
end

View file

@ -6,7 +6,9 @@ module Repp
super
unless @new_contact.identical_to?(@current_contact)
@epp_errors << { code: 2304, msg: 'Admin contacts must be identical' }
@epp_errors.add(:epp_errors,
msg: 'Admin contacts must be identical',
code: '2304')
end
return handle_errors if @epp_errors.any?

View file

@ -15,8 +15,12 @@ module Repp
end
def update
@epp_errors ||= []
@epp_errors << { code: 2304, msg: 'New contact must be valid' } if @new_contact.invalid?
@epp_errors ||= ActiveModel::Errors.new(self)
return unless @new_contact.invalid?
@epp_errors.add(:epp_errors,
msg: 'New contact must be valid',
code: '2304')
end
private

View file

@ -50,7 +50,9 @@ module Repp
super
if @new_contact == @current_contact
@epp_errors << { code: 2304, msg: 'New contact must be different from current' }
@epp_errors.add(:epp_errors,
msg: 'New contact must be different from current',
code: '2304')
end
return handle_errors if @epp_errors.any?

View file

@ -29,8 +29,8 @@ module Repp
renew = run_bulk_renew_task(@domains, bulk_renew_params[:renew_period])
return render_success(data: { updated_domains: @domains.map(&:name) }) if renew.valid?
@epp_errors << { code: 2002,
msg: renew.errors.keys.map { |k, _v| renew.errors[k] }.join(', ') }
msg = renew.errors.keys.map { |k, _v| renew.errors[k] }.join(', ')
@epp_errors.add(:epp_errors, msg: msg, code: '2002')
handle_errors
end
@ -41,20 +41,20 @@ module Repp
end
def validate_renew_period
@epp_errors ||= []
@epp_errors ||= ActiveModel::Errors.new(self)
periods = Depp::Domain::PERIODS.map { |p| p[1] }
return if periods.include? bulk_renew_params[:renew_period]
@epp_errors << { code: 2005, msg: 'Invalid renew period' }
@epp_errors.add(:epp_errors, msg: 'Invalid renew period', code: '2005')
end
def select_renewable_domains
@epp_errors ||= []
@epp_errors ||= ActiveModel::Errors.new(self)
if bulk_renew_params[:domains].instance_of?(Array)
@domains = bulk_renew_domains
else
@epp_errors << { code: 2005, msg: 'Domains attribute must be an array' }
@epp_errors.add(:epp_errors, msg: 'Domains attribute must be an array', code: '2005')
end
return handle_errors if @epp_errors.any?
@ -73,12 +73,16 @@ module Repp
end
def bulk_renew_domains
@epp_errors ||= []
@epp_errors ||= ActiveModel::Errors.new(self)
domains = []
bulk_renew_params[:domains].each do |idn|
domain = Epp::Domain.find_by(name: idn)
domains << domain if domain
@epp_errors << { code: 2304, msg: "Object does not exist: #{idn}" } unless domain
next if domain
@epp_errors.add(:epp_errors,
msg: "Object does not exist: #{idn}",
code: '2304')
end
domains

View file

@ -114,7 +114,6 @@ module Repp
transfer_params[:domain_transfers].each do |transfer|
initiate_transfer(transfer)
end
render_success(data: { success: @successful, failed: @errors })
end
@ -151,7 +150,7 @@ module Repp
@successful << { type: 'domain_transfer', domain_name: domain.name }
else
@errors << { type: 'domain_transfer', domain_name: domain.name,
errors: domain.errors[:epp_errors] }
errors: domain.errors.where(:epp_errors).first.options }
end
end
@ -187,7 +186,7 @@ module Repp
end
def set_authorized_domain
@epp_errors ||= []
@epp_errors ||= ActiveModel::Errors.new(self)
@domain = domain_from_url_hash
end
@ -195,7 +194,9 @@ module Repp
return if @domain.registrar == current_user.registrar
return if @domain.transfer_code.eql?(request.headers['Auth-Code'])
@epp_errors << { code: 2202, msg: I18n.t('errors.messages.epp_authorization_error') }
@epp_errors.add(:epp_errors,
code: 2202,
msg: I18n.t('errors.messages.epp_authorization_error'))
handle_errors
end

View file

@ -0,0 +1,32 @@
module SortedCountryHelper
def all_country_options(selected = nil)
quick_options = options_for_select(quick_list, selected: selected)
# no double select
selected = quick_list.map(&:second).include?(selected) ? '' : selected
all_options = options_for_select([['---', '---']] + all_sorted_truncated,
selected: selected, disabled: ['---'])
quick_options + all_options
end
def quick_list
[
%w[Estonia EE],
%w[Finland FI],
%w[Latvia LV],
%w[Lithuania LT],
['Russian Federation', 'RU'],
%w[Sweden SE],
['United States', 'US'],
]
end
def all_sorted
Country.all.sort_by(&:name)
end
def all_sorted_truncated
all_sorted.map { |country| [country.name.truncate(26), country.alpha2] }
end
end

View file

@ -13,8 +13,8 @@ module Actions
end
def call
return unless domain_exists?
return unless valid_transfer_code?
return false unless domain_exists?
return false unless valid_transfer_code?
run_validations

View file

@ -41,7 +41,7 @@ module Domains
end
def manage_errors(task)
task.errors.each { |k, v| errors.add(k, v) } unless task.valid?
task.errors.each { |task_error| errors.import task_error } unless task.valid?
errors.add(:domain, I18n.t('not_enough_funds')) unless task.result
end

View file

@ -20,12 +20,14 @@ module Domains
def calculate_total_price
@total_price = 0
domains.each do |domain|
task = Domains::CheckBalance::SingleDomain.run(domain: domain,
operation: 'renew',
period: period,
unit: unit)
task = Domains::CheckBalance::SingleDomain.run(domain: domain, operation: 'renew',
period: period, unit: unit)
task.valid? ? @total_price += task.result : errors.merge!(task.errors)
if task.valid?
@total_price += task.result
else
task.errors.each { |task_error| errors.import task_error }
end
end
end
end

View file

@ -1,5 +1,6 @@
module Billing
class Price < ApplicationRecord
attribute :duration, :interval
include Billing::Price::Expirable
include Versions
@ -8,33 +9,37 @@ module Billing
validates :price, :valid_from, :operation_category, :duration, presence: true
validates :operation_category, inclusion: { in: Proc.new { |price| price.class.operation_categories } }
validates :duration, inclusion: { in: Proc.new { |price| price.class.durations } }
validates :duration, inclusion: { in: Proc.new { |price| price.class.durations.values } }, if: :should_validate_duration?
alias_attribute :effect_time, :valid_from
alias_attribute :expire_time, :valid_to
monetize :price_cents, allow_nil: true, numericality: { greater_than_or_equal_to: 0 }
after_initialize :init_values
def should_validate_duration?
new_record? || duration_changed?
end
def self.operation_categories
%w[create renew]
end
def self.durations
[
'3 mons',
'6 mons',
'9 mons',
'1 year',
'2 years',
'3 years',
'4 years',
'5 years',
'6 years',
'7 years',
'8 years',
'9 years',
'10 years',
]
{
'3 months' => 3.months,
'6 months' => 6.months,
'9 months' => 9.months,
'1 year' => 1.year,
'2 years' => 2.years,
'3 years' => 3.years,
'4 years' => 4.years,
'5 years' => 5.years,
'6 years' => 6.years,
'7 years' => 7.years,
'8 years' => 8.years,
'9 years' => 9.years,
'10 years' => 10.years,
}
end
def self.statuses

View file

@ -1,38 +1,45 @@
module EppErrors
extend ActiveSupport::Concern
included do
attr_accessor :epp_errors
end
def construct_epp_errors
epp_errors = []
errors.messages.each do |attr, errors|
attr = attr.to_s.split('.')[0].to_sym
epp_errors = ActiveModel::Errors.new(self)
errors.each do |error|
attr = error.attribute.to_s.split('.')[0].to_sym
next if attr == :epp_errors
if self.class.reflect_on_association(attr)
epp_errors << collect_child_errors(attr)
collect_child_errors(attr).each do |child_error|
epp_errors.import child_error
end
end
if self.class.reflect_on_aggregation(attr)
aggregation = send(attr)
epp_errors << collect_aggregation_errors(aggregation)
collect_aggregation_errors(aggregation).each do |aggregation_error|
epp_errors.import aggregation_error
end
next
end
epp_errors << collect_parent_errors(attr, errors)
collect_parent_errors(attr, error.message).each do |parent_error|
epp_errors.import parent_error
end
end
errors.add(:epp_errors, epp_errors)
errors[:epp_errors].flatten!
epp_errors.each { |epp_error| errors.import epp_error }
errors
end
def collect_parent_errors(attr, errors)
errors = [errors] if errors.is_a?(String)
epp_errors = []
epp_errors = ActiveModel::Errors.new(self)
errors.each do |err|
code, value = find_epp_code_and_value(err)
next unless code
msg = attr.to_sym == :base ? err : "#{err} [#{attr}]"
epp_errors << { code: code, msg: msg, value: value }
epp_errors.add(attr, code: code, msg: msg, value: value)
end
epp_errors
end
@ -40,20 +47,24 @@ module EppErrors
def collect_child_errors(attr)
macro = self.class.reflect_on_association(attr).macro
multi = [:has_and_belongs_to_many, :has_many]
# single = [:belongs_to, :has_one]
epp_errors = []
send(attr).each do |x|
x.errors.messages.each do |attribute, errors|
epp_errors << x.collect_parent_errors(attribute, errors)
epp_errors = ActiveModel::Errors.new(self)
if multi.include?(macro)
send(attr).each do |x|
x.errors.each do |error|
x.collect_parent_errors(error.attribute, error.message).each do |parent_error|
epp_errors.import parent_error
end
end
end
end if multi.include?(macro)
end
epp_errors
end
def collect_aggregation_errors(aggregation)
epp_errors = []
epp_errors = ActiveModel::Errors.new(self)
aggregation.errors.details.each do |attr, error_details|
error_details.each do |error_detail|
@ -69,7 +80,7 @@ module EppErrors
message = "#{aggregation.model_name.human} #{message.camelize(:lower)}"
end
epp_errors << { code: epp_code, msg: message }
epp_errors.add(attr, code: epp_code, msg: message)
end
end
end
@ -105,11 +116,20 @@ module EppErrors
end
def add_epp_error(code, obj, val, msg)
errors[:epp_errors] ||= []
t = errors.generate_message(*msg) if msg.is_a?(Array)
t = msg if msg.is_a?(String)
err = { code: code, msg: t }
val = check_for_status(code, obj, val)
err[:value] = { val: val, obj: obj } if val.present?
errors[:epp_errors] << err
self.errors.add(:epp_errors, err)
end
def check_for_status(code, obj, val)
if code == '2304' && val.present? && val == DomainStatus::SERVER_DELETE_PROHIBITED &&
obj == 'status'
DomainStatus::PENDING_UPDATE
else
val
end
end
end

View file

@ -40,8 +40,8 @@ module Registrar::BookKeeping
def fetch_invoice_lines(activity, lines)
price = load_price(activity)
if price.duration.include? 'year'
price.duration.to_i.times do |duration|
if price.duration.in_years.to_i >= 1
price.duration.in_years.to_i.times do |duration|
lines << new_monthly_invoice_line(activity: activity, duration: duration + 1).as_json
end
else
@ -67,9 +67,9 @@ module Registrar::BookKeeping
end
def finalize_invoice_line(line, price:, activity:, duration:)
yearly = price.duration.include?('year')
yearly = price.duration.in_years.to_i >= 1
line['price'] = yearly ? (price.price.amount / price.duration.to_i) : price.price.amount
line['price'] = yearly ? (price.price.amount / price.duration.in_years.to_i) : price.price.amount
line['description'] = description_in_language(price: price, yearly: yearly)
if duration.present?
@ -90,7 +90,7 @@ module Registrar::BookKeeping
locale_string = "registrar.invoice_#{timeframe_string}_product_description"
I18n.with_locale(language == 'en' ? 'en' : 'et') do
I18n.t(locale_string, tld: ".#{price.zone_name}", length: price.duration.to_i)
I18n.t(locale_string, tld: ".#{price.zone_name}", length: price.duration.in_years.to_i)
end
end

View file

@ -60,19 +60,19 @@ class Dnskey < ApplicationRecord
def validate_algorithm
return if alg.blank?
return if ALGORITHMS.include?(alg.to_s)
errors.add(:alg, :invalid, values: ALGORITHMS.join(', '))
errors.add(:alg, :invalid, values: "Valid algorithms are: #{ALGORITHMS.join(', ')}")
end
def validate_protocol
return if protocol.blank?
return if PROTOCOLS.include?(protocol.to_s)
errors.add(:protocol, :invalid, values: PROTOCOLS.join(', '))
errors.add(:protocol, :invalid, values: "Valid protocols are: #{PROTOCOLS.join(', ')}")
end
def validate_flags
return if flags.blank?
return if FLAGS.include?(flags.to_s)
errors.add(:flags, :invalid, values: FLAGS.join(', '))
errors.add(:flags, :invalid, values: "Valid flags are: #{FLAGS.join(', ')}")
end
def generate_digest

View file

@ -14,9 +14,7 @@ class Invoice
private
def invoice_html
view = ActionView::Base.new(ActionController::Base.view_paths, invoice: invoice)
view.class_eval { include ApplicationHelper }
view.render(file: 'invoice/pdf', layout: false)
ApplicationController.render(template: 'invoice/pdf', assigns: { invoice: invoice })
end
end
end
end

View file

@ -1,40 +0,0 @@
class SortedCountry
class << self
include ActionView::Helpers
def all_options(selected = nil)
quick_options = options_for_select(quick_list, selected: selected)
# no double select
selected = quick_list.map(&:second).include?(selected) ? '' : selected
all_options = options_for_select([['---', '---']] + all_sorted_truncated,
selected: selected, disabled: ['---'])
quick_options + all_options
end
private
def quick_list
@quick_list ||=
[
%w[Estonia EE],
%w[Finland FI],
%w[Latvia LV],
%w[Lithuania LT],
['Russian Federation', 'RU'],
%w[Sweden SE],
['United States', 'US']
]
end
def all_sorted
@all_sorted ||= Country.all.sort_by(&:name)
end
def all_sorted_truncated
@all_sorted_truncated ||=
all_sorted.map { |country| [country.name.truncate(26), country.alpha2] }
end
end
end

View file

@ -35,14 +35,14 @@
.col-md-4.control-label
= f.label :country_code, t(:country), class: 'required'
.col-md-8
= f.select :country_code, SortedCountry.all_options(f.object.country_code), {}, required: true, class: 'form-control'
= f.select :country_code, ApplicationController.helpers.all_country_options(f.object.country_code), {}, required: true, class: 'form-control'
%hr
.form-group
.col-md-4.control-label
= f.label :role, nil, class: 'required'
.col-md-8
= select_tag 'admin_user[roles][]',
options_for_select(AdminUser::ROLES.map {|x| [t(x), x] },
= select_tag 'admin_user[roles][]',
options_for_select(AdminUser::ROLES.map {|x| [t(x), x] },
@admin_user.roles.try(:first)), class: 'form-control selectize'
%hr

View file

@ -1,6 +1,6 @@
<tr class="price">
<td><%= link_to price.zone_name, edit_admin_price_path(price), class: 'edit-price-btn' %></td>
<td><%= price.duration.sub('mons', 'months') %></td>
<td><%= price.duration %></td>
<td><%= price.operation_category %></td>
<td><%= number_to_currency price.price %></td>
<td><%= l price.valid_from, format: :date %></td>

View file

@ -28,7 +28,7 @@
.col-md-3
.form-group
= label_tag t(:country)
= select_tag '[q][country_code_eq]', SortedCountry.all_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
= select_tag '[q][country_code_eq]', ApplicationController.helpers.all_country_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
.col-md-6
.form-group
= label_tag t(:contact_type)

View file

@ -49,7 +49,7 @@
</div>
<div class="col-md-7">
<%= f.select :address_country_code,
SortedCountry.all_options(f.object.address_country_code), {},
ApplicationController.helpers.all_country_options(f.object.address_country_code), {},
required: true, class: 'form-control' %>
<span class="help-block"><%= t '.country_hint' %></span>
</div>
@ -59,4 +59,4 @@
</div>
</div>
</div>
</div>
</div>

View file

@ -1,6 +1,9 @@
xml.epp_head do
xml.response do
@errors.each do |x|
@errors.each do |error|
x = error&.options
next if x.empty? || x == { value: nil }
xml.result('code' => x[:code]) do
xml.msg(x[:msg], 'lang' => 'en')
model_name = resource ? resource.model_name.singular.sub('epp_','') : controller.controller_name.singularize

View file

@ -40,7 +40,7 @@
<div class="col-md-3">
<div class="form-group">
<%= label_tag t(:country) %>
<%= select_tag '[q][country_code_eq]', SortedCountry.all_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' } %>
<%= select_tag '[q][country_code_eq]', ApplicationController.helpers.all_country_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' } %>
</div>
</div>

View file

@ -31,6 +31,6 @@
= f.label :country_code, t(:country) + '*'
.col-md-7
- country_selected = f.object.persisted? ? f.object.country_code : 'EE'
= f.select(:country_code, SortedCountry.all_options(country_selected),
= f.select(:country_code, SApplicationController.helpers.all_country_options(country_selected),
{ include_blank: true }, required: true)

View file

@ -19,7 +19,7 @@
= Country.new(f.object.ident_country_code).try(:to_s)
= " [#{f.object.ident_country_code}]"
- else
= f.select(:ident_country_code, SortedCountry.all_options(country_selected), {},
= f.select(:ident_country_code, ApplicationController.helpers.all_country_options(country_selected), {},
class: 'js-ident-country-code', required: true)
.form-group

View file

@ -536,6 +536,43 @@ CREATE SEQUENCE public.certificates_id_seq
ALTER SEQUENCE public.certificates_id_seq OWNED BY public.certificates.id;
--
-- Name: contact_requests; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.contact_requests (
id integer NOT NULL,
whois_record_id integer NOT NULL,
secret character varying NOT NULL,
email character varying NOT NULL,
name character varying NOT NULL,
valid_to timestamp without time zone NOT NULL,
status character varying DEFAULT 'new'::character varying NOT NULL,
ip_address inet,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
message_id character varying
);
--
-- Name: contact_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.contact_requests_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: contact_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.contact_requests_id_seq OWNED BY public.contact_requests.id;
--
-- Name: contacts; Type: TABLE; Schema: public; Owner: -
--
@ -2735,6 +2772,13 @@ ALTER TABLE ONLY public.bounced_mail_addresses ALTER COLUMN id SET DEFAULT nextv
ALTER TABLE ONLY public.certificates ALTER COLUMN id SET DEFAULT nextval('public.certificates_id_seq'::regclass);
--
-- Name: contact_requests id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.contact_requests ALTER COLUMN id SET DEFAULT nextval('public.contact_requests_id_seq'::regclass);
--
-- Name: contacts id; Type: DEFAULT; Schema: public; Owner: -
--
@ -3193,6 +3237,14 @@ ALTER TABLE ONLY public.certificates
ADD CONSTRAINT certificates_pkey PRIMARY KEY (id);
--
-- Name: contact_requests contact_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.contact_requests
ADD CONSTRAINT contact_requests_pkey PRIMARY KEY (id);
--
-- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@ -3780,6 +3832,34 @@ CREATE INDEX index_accounts_on_registrar_id ON public.accounts USING btree (regi
CREATE INDEX index_certificates_on_api_user_id ON public.certificates USING btree (api_user_id);
--
-- Name: index_contact_requests_on_email; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_contact_requests_on_email ON public.contact_requests USING btree (email);
--
-- Name: index_contact_requests_on_ip_address; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_contact_requests_on_ip_address ON public.contact_requests USING btree (ip_address);
--
-- Name: index_contact_requests_on_secret; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_contact_requests_on_secret ON public.contact_requests USING btree (secret);
--
-- Name: index_contact_requests_on_whois_record_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_contact_requests_on_whois_record_id ON public.contact_requests USING btree (whois_record_id);
--
-- Name: index_contacts_on_code; Type: INDEX; Schema: public; Owner: -
--

View file

@ -1,5 +1,5 @@
create_one_month:
duration: 3 mons
duration: 3 months
price_cents: 100
operation_category: create
valid_from: 2010-07-05
@ -7,7 +7,7 @@ create_one_month:
zone: one
renew_one_month:
duration: 1 mons
duration: 1 month
price_cents: 100
operation_category: renew
valid_from: 2010-07-05

View file

@ -75,7 +75,7 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
data: { success: [],
failed: [{ type: "domain_transfer",
domain_name: "shop.test",
errors: [{:code=>"2304", :msg=>"Object status prohibits operation"}] }],
errors: {:code=>"2304", :msg=>"Object status prohibits operation"} }],
}}),
JSON.parse(response.body, symbolize_names: true)
end

View file

@ -100,7 +100,7 @@ class APINameserversPutTest < ApplicationIntegrationTest
assert_response 400
assert_equal ({ code: 2003,
message: 'param is missing or the value is empty: hostname' }),
message: 'param is missing or the value is empty: hostname. Did you mean? hostname' }),
JSON.parse(response.body, symbolize_names: true)
end

View file

@ -92,7 +92,10 @@ class ReppV1DomainsBulkRenewTest < ActionDispatch::IntegrationTest
end
def test_throws_error_when_not_enough_balance
billing_prices(:renew_one_year).update(price_cents: 99999999)
price = Billing::Price.last
price.price_cents = 99999999
price.save(validate: false)
payload = {
"domains": [
'invalid.test',
@ -106,7 +109,7 @@ class ReppV1DomainsBulkRenewTest < ActionDispatch::IntegrationTest
assert_response :bad_request
assert_equal 2002, json[:code]
assert_equal 'Domain Billing failure - credit balance low', json[:message]
assert_equal 'Billing failure - credit balance low', json[:message]
end
end
@ -128,7 +131,7 @@ class ReppV1DomainsBulkRenewTest < ActionDispatch::IntegrationTest
private
def set_status_for_domain(domain, statuses)
def set_status_for_domain(domain, statuses)
domain.update(statuses: statuses)
if statuses.size > 1
@ -148,7 +151,7 @@ class ReppV1DomainsBulkRenewTest < ActionDispatch::IntegrationTest
def assert_renew_prohibited_domains(domains, payload)
assert_no_changes -> { Domain.where(name: domains).pluck(:valid_to) } do
json = bulk_renew(payload)
assert_response :bad_request
assert_equal 2002, json[:code]
assert domains.all? do |domain|

View file

@ -78,7 +78,7 @@ class ReppV1DomainsTransferTest < ActionDispatch::IntegrationTest
assert_equal 1000, json[:code]
assert_equal 'Command completed successfully', json[:message]
assert_equal 'Object status prohibits operation', json[:data][:failed][0][:errors][0][:msg]
assert_equal 'Object status prohibits operation', json[:data][:failed][0][:errors][:msg]
@domain.reload
@ -100,7 +100,7 @@ class ReppV1DomainsTransferTest < ActionDispatch::IntegrationTest
assert_equal 1000, json[:code]
assert_equal 'Command completed successfully', json[:message]
assert_equal "Invalid authorization information", json[:data][:failed][0][:errors][0][:msg]
assert_equal "Invalid authorization information", json[:data][:failed][0][:errors][:msg]
end
def test_does_not_transfer_domain_to_same_registrar
@ -121,7 +121,7 @@ class ReppV1DomainsTransferTest < ActionDispatch::IntegrationTest
assert_equal 1000, json[:code]
assert_equal 'Command completed successfully', json[:message]
assert_equal 'Domain already belongs to the querying registrar', json[:data][:failed][0][:errors][0][:msg]
assert_equal 'Domain already belongs to the querying registrar', json[:data][:failed][0][:errors][:msg]
@domain.reload
@ -146,7 +146,7 @@ class ReppV1DomainsTransferTest < ActionDispatch::IntegrationTest
assert_equal 1000, json[:code]
assert_equal 'Command completed successfully', json[:message]
assert_equal 'Object is not eligible for transfer', json[:data][:failed][0][:errors][0][:msg]
assert_equal 'Object is not eligible for transfer', json[:data][:failed][0][:errors][:msg]
@domain.reload

View file

@ -13,8 +13,9 @@ class ActiveJobQueuingTest < ActiveJob::TestCase
def test_job_retried_after_error
assert_no_enqueued_jobs
assert_raises StandardError do
assert_performed_jobs 3 do
assert_performed_jobs 3 do
assert_raises StandardError do
TestRetriedJob.perform_later
end
end

View file

@ -110,7 +110,7 @@ class DirectoInvoiceForwardJobTest < ActiveSupport::TestCase
def test_multi_year_purchases_have_duration_assigned
activity = account_activities(:one)
price = billing_prices(:create_one_year)
price.update(duration: '3 years')
price.update(duration: 3.years)
activity.update(activity_type: 'create', price: price)
response = <<-XML
@ -157,7 +157,7 @@ class DirectoInvoiceForwardJobTest < ActiveSupport::TestCase
activity = account_activities(:one)
price = billing_prices(:create_one_year)
price.update(duration: '3 years')
price.update(duration: 3.years)
activity.update(activity_type: 'create', price: price)
# Creating account activity for second action

View file

@ -65,7 +65,7 @@ class Billing::PriceTest < ActiveSupport::TestCase
price.duration = 'invalid'
assert price.invalid?
price.duration = Billing::Price.durations.first
price.duration = Billing::Price.durations.values.first
assert price.valid?
end
@ -75,21 +75,21 @@ class Billing::PriceTest < ActiveSupport::TestCase
end
def test_returns_durations
durations = [
'3 mons',
'6 mons',
'9 mons',
'1 year',
'2 years',
'3 years',
'4 years',
'5 years',
'6 years',
'7 years',
'8 years',
'9 years',
'10 years',
]
durations = {
'3 months' => 3.months,
'6 months' => 6.months,
'9 months' => 9.months,
'1 year' => 1.year,
'2 years'=> 2.years,
'3 years'=> 3.years,
'4 years'=> 4.years,
'5 years'=> 5.years,
'6 years'=> 6.years,
'7 years'=> 7.years,
'8 years'=> 8.years,
'9 years'=> 9.years,
'10 years'=> 10.years,
}
assert_equal durations, Billing::Price.durations
end

View file

@ -15,29 +15,29 @@ class DnskeyTest < ActiveSupport::TestCase
dns.protocol = 3
dns.alg = 8
dns.public_key = @dnskey
assert dns.save
end
def test_invalid_algrorithm
dns = Dnskey.new
dns.alg = 666
errors = dns.validate_algorithm
assert_equal errors, ['Valid algorithms are: 3, 5, 6, 7, 8, 10, 13, 14']
errors = dns.validate_algorithm.options[:values]
assert_equal errors, 'Valid algorithms are: 3, 5, 6, 7, 8, 10, 13, 14'
end
def test_invalid_protocol
dns = Dnskey.new
dns.protocol = 666
errors = dns.validate_protocol
assert_equal errors, ['Valid protocols are: 3']
errors = dns.validate_protocol.options[:values]
assert_equal errors, 'Valid protocols are: 3'
end
def test_invalid_flags
dns = Dnskey.new
dns.flags = 666
errors = dns.validate_flags
assert_equal errors, ['Valid flags are: 0, 256, 257']
errors = dns.validate_flags.options[:values]
assert_equal errors, 'Valid flags are: 0, 256, 257'
end
def test_ds_digest_type_one
@ -49,10 +49,10 @@ class DnskeyTest < ActiveSupport::TestCase
dns.protocol = 3
dns.alg = 8
dns.public_key = @dnskey
assert dns.save
assert_equal dns.ds_digest_type, 1
assert_equal dns.ds_digest, '640D173A44D9AF2856FBE282EE64CE11A76DBB84'
end
end
end

View file

@ -16,7 +16,7 @@ class RegistrantVerificationTest < ActiveSupport::TestCase
random_action = "random#{rand(100)}"
assert_difference -> { Version::RegistrantVerificationVersion.count } do
registrant_verification.update_attributes!(action: random_action)
registrant_verification.update!(action: random_action)
end
end

View file

@ -20,7 +20,6 @@ class AdminAreaPricesTest < ApplicationSystemTestCase
fill_in 'Valid from', with: effective_date
click_on 'Create price'
assert_text 'Price has been created'
assert_text I18n.localize(effective_date)
end