mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 03:58:27 +02:00
Merge branch 'master' into 1795-validation-contacts-name
This commit is contained in:
commit
aaedc31457
34 changed files with 467 additions and 56 deletions
|
@ -59,7 +59,6 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
|
||||
invoice = Invoice.find_by(number: invoice_no)
|
||||
errors.add(:base, I18n.t('invoice_was_not_found')) unless invoice
|
||||
validate_invoice_data(invoice)
|
||||
return if errors.any?
|
||||
|
||||
|
@ -68,6 +67,11 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
|
||||
def validate_invoice_data(invoice)
|
||||
unless invoice
|
||||
errors.add(:base, I18n.t('invoice_was_not_found'))
|
||||
return
|
||||
end
|
||||
|
||||
if invoice.paid?
|
||||
errors.add(:base, I18n.t('invoice_is_already_binded'))
|
||||
return
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
module Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
||||
module Domain::ForceDelete
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
FORCE_DELETE_STATUSES = [DomainStatus::FORCE_DELETE,
|
||||
DomainStatus::SERVER_RENEW_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED].freeze
|
||||
|
||||
included do
|
||||
store_accessor :force_delete_data,
|
||||
:force_delete_type,
|
||||
|
|
|
@ -36,9 +36,10 @@ module Domain::RegistryLockable
|
|||
|
||||
transaction do
|
||||
LOCK_STATUSES.each do |domain_status|
|
||||
statuses.delete(domain_status)
|
||||
statuses.delete([domain_status])
|
||||
end
|
||||
self.locked_by_registrant_at = nil
|
||||
self.statuses = admin_store_statuses_history || []
|
||||
alert_registrar_lock_changes!(lock: false)
|
||||
|
||||
save!
|
||||
|
|
|
@ -28,9 +28,6 @@ class Contact < ApplicationRecord
|
|||
.where('success = false and verified_at IS NOT NULL')
|
||||
}
|
||||
|
||||
NAME_REGEXP = /([\u00A1-\u00B3\u00B5-\u00BF\u0021-\u0026\u0028-\u002C\u003A-\u0040]|
|
||||
[\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x.freeze
|
||||
|
||||
validates :name, :email, presence: true
|
||||
validates :name, format: { without: NAME_REGEXP, message: :invalid }, if: -> { priv? }
|
||||
|
||||
|
|
|
@ -13,20 +13,22 @@ class Contact::Ident
|
|||
validates :type, presence: true, inclusion: { in: proc { types } }
|
||||
validates :country_code, presence: true, iso31661_alpha2: true
|
||||
validates_with MismatchValidator
|
||||
validates_with BirthDateValidator, if: :birthday?
|
||||
|
||||
def self.epp_code_map
|
||||
{
|
||||
'2003' => [
|
||||
[:code, :blank],
|
||||
[:type, :blank],
|
||||
[:country_code, :blank]
|
||||
%i[code blank],
|
||||
%i[type blank],
|
||||
%i[country_code blank],
|
||||
],
|
||||
'2005' => [
|
||||
[:base, :mismatch],
|
||||
[:code, :invalid_national_id],
|
||||
[:code, :invalid_reg_no],
|
||||
[:code, :invalid_iso8601_date],
|
||||
[:country_code, :invalid_iso31661_alpha2]
|
||||
%i[base mismatch],
|
||||
%i[code invalid_national_id],
|
||||
%i[code invalid_reg_no],
|
||||
%i[code invalid_iso8601_date],
|
||||
%i[code invalid_birth_date],
|
||||
%i[country_code invalid_iso31661_alpha2],
|
||||
]
|
||||
}
|
||||
end
|
||||
|
|
|
@ -22,6 +22,10 @@ class Domain < ApplicationRecord
|
|||
alias_attribute :auth_info, :transfer_code # Old attribute name; for PaperTrail
|
||||
alias_attribute :registered_at, :created_at
|
||||
|
||||
store_accessor :json_statuses_history,
|
||||
:force_delete_domain_statuses_history,
|
||||
:admin_store_statuses_history
|
||||
|
||||
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
|
||||
# TODO: most inputs should be trimmed before validatation, probably some global logic?
|
||||
|
||||
|
@ -549,8 +553,22 @@ class Domain < ApplicationRecord
|
|||
statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
end
|
||||
|
||||
def update_unless_locked_by_registrant(update)
|
||||
update(admin_store_statuses_history: update) unless locked_by_registrant?
|
||||
end
|
||||
|
||||
def update_not_by_locked_statuses(update)
|
||||
return unless locked_by_registrant?
|
||||
|
||||
result = update.reject { |status| RegistryLockable::LOCK_STATUSES.include? status }
|
||||
update(admin_store_statuses_history: result)
|
||||
end
|
||||
|
||||
# special handling for admin changing status
|
||||
def admin_status_update(update)
|
||||
update_unless_locked_by_registrant(update)
|
||||
|
||||
update_not_by_locked_statuses(update)
|
||||
# check for deleted status
|
||||
statuses.each do |s|
|
||||
unless update.include? s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue