mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 01:03:35 +02:00
Merge branch 'master' into story/115762063-show-historical-nested
This commit is contained in:
commit
368b9978ef
70 changed files with 1096 additions and 467 deletions
|
@ -49,7 +49,8 @@ module Repp
|
||||||
response_code: status,
|
response_code: status,
|
||||||
api_user_name: current_user.try(:username),
|
api_user_name: current_user.try(:username),
|
||||||
api_user_registrar: current_user.try(:registrar).try(:to_s),
|
api_user_registrar: current_user.try(:registrar).try(:to_s),
|
||||||
ip: request.ip
|
ip: request.ip,
|
||||||
|
uuid: request.try(:uuid)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,13 @@ $(document).on 'page:change', ->
|
||||||
$('.js-contact-form').trigger('restoreDefault')
|
$('.js-contact-form').trigger('restoreDefault')
|
||||||
|
|
||||||
$('[data-legal-document]').each (i, fileInput)->
|
$('[data-legal-document]').each (i, fileInput)->
|
||||||
minSize = 8 * 1024 # 8kB
|
minSize = 3 * 1024 # 3kB
|
||||||
maxSize = 8 * 1024 * 1024; # 8 MB
|
maxSize = 8 * 1024 * 1024; # 8 MB
|
||||||
$(fileInput).closest('form').submit (e) ->
|
$(fileInput).closest('form').submit (e) ->
|
||||||
if (files = fileInput.files).length
|
if (files = fileInput.files).length
|
||||||
fileSize = files[0].size
|
fileSize = files[0].size
|
||||||
if fileSize < minSize
|
if fileSize < minSize
|
||||||
alert 'Document size should be more than 8kB'
|
alert 'Document size should be more than 3kB'
|
||||||
return false
|
return false
|
||||||
else if fileSize > maxSize
|
else if fileSize > maxSize
|
||||||
alert 'Document size should be less than 8MB'
|
alert 'Document size should be less than 8MB'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class Admin::AccountActivitiesController < AdminController
|
class Admin::AccountActivitiesController < AdminController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
before_action :set_default_dates, only: [:index]
|
||||||
|
|
||||||
def index # rubocop: disable Metrics/AbcSize
|
def index # rubocop: disable Metrics/AbcSize
|
||||||
params[:q] ||= {}
|
|
||||||
|
|
||||||
ca_cache = params[:q][:created_at_lteq]
|
ca_cache = params[:q][:created_at_lteq]
|
||||||
begin
|
begin
|
||||||
|
@ -41,4 +41,20 @@ class Admin::AccountActivitiesController < AdminController
|
||||||
|
|
||||||
params[:q][:created_at_lteq] = ca_cache
|
params[:q][:created_at_lteq] = ca_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_default_dates
|
||||||
|
params[:q] ||= {}
|
||||||
|
|
||||||
|
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||||
|
|
||||||
|
default_date = params[:created_after]
|
||||||
|
|
||||||
|
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||||
|
default_date = 'today'
|
||||||
|
end
|
||||||
|
|
||||||
|
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,22 +10,22 @@ class Admin::ContactsController < AdminController
|
||||||
search_params[:registrant_domains_id_not_null] = 1
|
search_params[:registrant_domains_id_not_null] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@q = Contact.includes(:registrar).search(search_params)
|
@q = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params)
|
||||||
@contacts = @q.result(distinct: :true).page(params[:page])
|
@contacts = @q.result(distinct: :true).page(params[:page])
|
||||||
|
|
||||||
if params[:statuses_contains]
|
if params[:statuses_contains]
|
||||||
contacts = Contact.includes(:registrar).where(
|
contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').where(
|
||||||
"contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
"contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
contacts = Contact.includes(:registrar)
|
contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name')
|
||||||
end
|
end
|
||||||
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
|
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
|
||||||
|
|
||||||
|
|
||||||
normalize_search_parameters do
|
normalize_search_parameters do
|
||||||
@q = contacts.search(search_params)
|
@q = contacts.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params)
|
||||||
@contacts = @q.result(distinct: :true).page(params[:page])
|
@contacts = @q.result.uniq.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Admin::DomainsController < AdminController
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
if params[:statuses_contains]
|
if params[:statuses_contains]
|
||||||
domains = Domain.includes(:registrar, :registrant).where(
|
domains = Domain.includes(:registrar, :registrant).where(
|
||||||
"statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
"domains.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
domains = Domain.includes(:registrar, :registrant)
|
domains = Domain.includes(:registrar, :registrant)
|
||||||
|
|
|
@ -1,13 +1,33 @@
|
||||||
class Admin::EppLogsController < AdminController
|
class Admin::EppLogsController < AdminController
|
||||||
load_and_authorize_resource class: ApiLog::EppLog
|
load_and_authorize_resource class: ApiLog::EppLog
|
||||||
|
before_action :set_default_dates, only: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = ApiLog::EppLog.search(params[:q])
|
@q = ApiLog::EppLog.search(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
@epp_logs = @q.result.page(params[:page])
|
|
||||||
|
@epp_logs = @q.result
|
||||||
|
@epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
||||||
|
@epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
||||||
|
@epp_logs = @epp_logs.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@epp_log = ApiLog::EppLog.find(params[:id])
|
@epp_log = ApiLog::EppLog.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_default_dates
|
||||||
|
params[:q] ||= {}
|
||||||
|
|
||||||
|
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||||
|
default_date = params[:created_after]
|
||||||
|
|
||||||
|
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||||
|
default_date = 'today'
|
||||||
|
end
|
||||||
|
|
||||||
|
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Admin::RegistrarsController < AdminController
|
||||||
def registrar_params
|
def registrar_params
|
||||||
params.require(:registrar).permit(
|
params.require(:registrar).permit(
|
||||||
:name, :reg_no, :vat_no, :street, :city, :state, :zip, :billing_address,
|
:name, :reg_no, :vat_no, :street, :city, :state, :zip, :billing_address,
|
||||||
:country_code, :email, :phone, :billing_email, :code
|
:country_code, :email, :phone, :billing_email, :code, :test_registrar
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,34 @@
|
||||||
class Admin::ReppLogsController < AdminController
|
class Admin::ReppLogsController < AdminController
|
||||||
load_and_authorize_resource class: ApiLog::ReppLog
|
load_and_authorize_resource class: ApiLog::ReppLog
|
||||||
|
before_action :set_default_dates, only: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = ApiLog::ReppLog.search(params[:q])
|
@q = ApiLog::ReppLog.search(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
@repp_logs = @q.result.page(params[:page])
|
|
||||||
|
@repp_logs = @q.result
|
||||||
|
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
||||||
|
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
||||||
|
@repp_logs = @repp_logs.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@repp_log = ApiLog::ReppLog.find(params[:id])
|
@repp_log = ApiLog::ReppLog.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_default_dates
|
||||||
|
params[:q] ||= {}
|
||||||
|
|
||||||
|
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||||
|
|
||||||
|
default_date = params[:created_after]
|
||||||
|
|
||||||
|
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||||
|
default_date = 'today'
|
||||||
|
end
|
||||||
|
|
||||||
|
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,6 +55,10 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def info_for_paper_trail
|
||||||
|
{ uuid: request.uuid }
|
||||||
|
end
|
||||||
|
|
||||||
def user_for_paper_trail
|
def user_for_paper_trail
|
||||||
user_log_str(current_user)
|
user_log_str(current_user)
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,6 +19,8 @@ class Epp::ContactsController < EppController
|
||||||
authorize! :create, Epp::Contact
|
authorize! :create, Epp::Contact
|
||||||
@contact = Epp::Contact.new(params[:parsed_frame], current_user.registrar)
|
@contact = Epp::Contact.new(params[:parsed_frame], current_user.registrar)
|
||||||
|
|
||||||
|
@contact.add_legal_file_to_new(params[:parsed_frame])
|
||||||
|
|
||||||
if @contact.save
|
if @contact.save
|
||||||
render_epp_response '/epp/contacts/create'
|
render_epp_response '/epp/contacts/create'
|
||||||
else
|
else
|
||||||
|
@ -29,7 +31,7 @@ class Epp::ContactsController < EppController
|
||||||
def update
|
def update
|
||||||
authorize! :update, @contact, @password
|
authorize! :update, @contact, @password
|
||||||
|
|
||||||
if @contact.update_attributes(params[:parsed_frame])
|
if @contact.update_attributes(params[:parsed_frame], current_user)
|
||||||
render_epp_response 'epp/contacts/update'
|
render_epp_response 'epp/contacts/update'
|
||||||
else
|
else
|
||||||
handle_errors(@contact)
|
handle_errors(@contact)
|
||||||
|
@ -39,7 +41,7 @@ class Epp::ContactsController < EppController
|
||||||
def delete
|
def delete
|
||||||
authorize! :delete, @contact, @password
|
authorize! :delete, @contact, @password
|
||||||
|
|
||||||
if @contact.destroy_and_clean
|
if @contact.destroy_and_clean(params[:parsed_frame])
|
||||||
render_epp_response '/epp/contacts/delete'
|
render_epp_response '/epp/contacts/delete'
|
||||||
else
|
else
|
||||||
handle_errors(@contact)
|
handle_errors(@contact)
|
||||||
|
|
|
@ -30,6 +30,8 @@ class Epp::DomainsController < EppController
|
||||||
handle_errors and return unless balance_ok?('create') # loads pricelist in this method
|
handle_errors and return unless balance_ok?('create') # loads pricelist in this method
|
||||||
|
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
|
@domain.add_legal_file_to_new(params[:parsed_frame])
|
||||||
|
|
||||||
if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain?
|
if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain?
|
||||||
current_user.registrar.debit!({
|
current_user.registrar.debit!({
|
||||||
sum: @domain_pricelist.price.amount,
|
sum: @domain_pricelist.price.amount,
|
||||||
|
|
|
@ -361,7 +361,7 @@ class EppController < ApplicationController
|
||||||
if request_command == 'login' && frame.present?
|
if request_command == 'login' && frame.present?
|
||||||
frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]</')
|
frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]</')
|
||||||
end
|
end
|
||||||
trimmed_request = frame.gsub(/<eis:legalDocument([^>]+)>([^<])+<\/eis:legalDocument>/, "<eis:legalDocument>[FILTERED]</eis:legalDocument>")
|
trimmed_request = frame.gsub(/<eis:legalDocument([^>]+)>([^<])+<\/eis:legalDocument>/, "<eis:legalDocument>[FILTERED]</eis:legalDocument>") if frame.present?
|
||||||
|
|
||||||
ApiLog::EppLog.create({
|
ApiLog::EppLog.create({
|
||||||
request: trimmed_request,
|
request: trimmed_request,
|
||||||
|
@ -371,7 +371,8 @@ class EppController < ApplicationController
|
||||||
response: @response,
|
response: @response,
|
||||||
api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public',
|
api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public',
|
||||||
api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s),
|
api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s),
|
||||||
ip: request.ip
|
ip: request.ip,
|
||||||
|
uuid: request.uuid
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
# rubocop: enable Metrics/CyclomaticComplexity
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
|
|
|
@ -22,18 +22,18 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
|
||||||
verification_token: params[:token])
|
verification_token: params[:token])
|
||||||
if params[:rejected]
|
if params[:rejected]
|
||||||
if @registrant_verification.domain_registrant_delete_reject!
|
if @registrant_verification.domain_registrant_delete_reject!
|
||||||
flash[:notice] = t(:registrant_domain_verification_rejected)
|
flash[:notice] = t(:registrant_domain_delete_rejected)
|
||||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true)
|
redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true)
|
||||||
else
|
else
|
||||||
flash[:alert] = t(:registrant_domain_verification_rejected_failed)
|
flash[:alert] = t(:registrant_domain_delete_rejected_failed)
|
||||||
return render 'show'
|
return render 'show'
|
||||||
end
|
end
|
||||||
elsif params[:confirmed]
|
elsif params[:confirmed]
|
||||||
if @registrant_verification.domain_registrant_delete_confirm!
|
if @registrant_verification.domain_registrant_delete_confirm!
|
||||||
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
flash[:notice] = t(:registrant_domain_delete_confirmed)
|
||||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true)
|
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true)
|
||||||
else
|
else
|
||||||
flash[:alert] = t(:registrant_domain_verification_confirmed_failed)
|
flash[:alert] = t(:registrant_domain_delete_confirmed_failed)
|
||||||
return render 'show'
|
return render 'show'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,17 +3,30 @@ class DomainDeleteConfirmJob < Que::Job
|
||||||
# it's recommended to keep transaction against job table as short as possible.
|
# it's recommended to keep transaction against job table as short as possible.
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
domain = Epp::Domain.find(domain_id)
|
domain = Epp::Domain.find(domain_id)
|
||||||
|
|
||||||
case action
|
case action
|
||||||
when RegistrantVerification::CONFIRMED
|
when RegistrantVerification::CONFIRMED
|
||||||
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
||||||
domain.apply_pending_delete!
|
domain.apply_pending_delete!
|
||||||
|
raise_errors!(domain)
|
||||||
|
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
DomainMailer.pending_delete_rejected_notification(domain_id, true).deliver
|
|
||||||
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||||
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
||||||
|
|
||||||
domain.cancel_pending_delete
|
domain.cancel_pending_delete
|
||||||
|
domain.save(validate: false)
|
||||||
|
raise_errors!(domain)
|
||||||
|
|
||||||
|
DomainMailer.pending_delete_rejected_notification(domain_id, true).deliver
|
||||||
end
|
end
|
||||||
|
|
||||||
destroy # it's best to destroy the job in the same transaction
|
destroy # it's best to destroy the job in the same transaction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def raise_errors!(domain)
|
||||||
|
throw "domain #{domain.name} failed with errors #{domain.errors.full_messages}" if domain.errors.any?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
17
app/jobs/domain_delete_job.rb
Normal file
17
app/jobs/domain_delete_job.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
class DomainDeleteJob < Que::Job
|
||||||
|
|
||||||
|
def run(domain_id)
|
||||||
|
domain = Domain.find(domain_id)
|
||||||
|
|
||||||
|
::PaperTrail.whodunnit = "job - #{self.class.name}"
|
||||||
|
WhoisRecord.where(domain_id: domain.id).destroy_all
|
||||||
|
|
||||||
|
domain.destroy
|
||||||
|
bye_bye = domain.versions.last
|
||||||
|
domain.registrar.messages.create!(
|
||||||
|
body: "#{I18n.t(:domain_deleted)}: #{domain.name}",
|
||||||
|
attached_obj_id: bye_bye.id,
|
||||||
|
attached_obj_type: bye_bye.class.to_s
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
10
app/jobs/domain_set_delete_candidate_job.rb
Normal file
10
app/jobs/domain_set_delete_candidate_job.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
class DomainSetDeleteCandidateJob < Que::Job
|
||||||
|
|
||||||
|
def run(domain_id)
|
||||||
|
domain = Domain.find(domain_id)
|
||||||
|
domain.statuses << DomainStatus::DELETE_CANDIDATE
|
||||||
|
::PaperTrail.whodunnit = "job - #{self.class.name}"
|
||||||
|
domain.save(validate: false)
|
||||||
|
DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
|
||||||
|
end
|
||||||
|
end
|
|
@ -7,8 +7,13 @@ class DomainUpdateConfirmJob < Que::Job
|
||||||
case action
|
case action
|
||||||
when RegistrantVerification::CONFIRMED
|
when RegistrantVerification::CONFIRMED
|
||||||
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
|
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
|
||||||
|
raise_errors!(domain)
|
||||||
|
|
||||||
domain.apply_pending_update!
|
domain.apply_pending_update!
|
||||||
|
raise_errors!(domain)
|
||||||
|
|
||||||
domain.clean_pendings!
|
domain.clean_pendings!
|
||||||
|
raise_errors!(domain)
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
domain.send_mail :pending_update_rejected_notification_for_new_registrant
|
domain.send_mail :pending_update_rejected_notification_for_new_registrant
|
||||||
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
||||||
|
@ -17,4 +22,8 @@ class DomainUpdateConfirmJob < Que::Job
|
||||||
destroy # it's best to destroy the job in the same transaction
|
destroy # it's best to destroy the job in the same transaction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def raise_errors!(domain)
|
||||||
|
throw "domain #{domain.name} failed with errors #{domain.errors.full_messages}" if domain.errors.any?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,11 @@ class ContactMailer < ApplicationMailer
|
||||||
def email_updated(old_email, email, contact_id, should_deliver)
|
def email_updated(old_email, email, contact_id, should_deliver)
|
||||||
@contact = Contact.find_by(id: contact_id)
|
@contact = Contact.find_by(id: contact_id)
|
||||||
@old_email = old_email
|
@old_email = old_email
|
||||||
|
unless @contact
|
||||||
|
Rails.logger.info "Cannot send email in #{self.class.name}##{__method__} with contact_id #{contact_id}. It cannot be found"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return unless email || @contact
|
return unless email || @contact
|
||||||
return if delivery_off?(@contact, should_deliver)
|
return if delivery_off?(@contact, should_deliver)
|
||||||
|
|
|
@ -9,12 +9,34 @@ class DomainMailer < ApplicationMailer
|
||||||
compose_from(params)
|
compose_from(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrant_updated_notification_for_new_registrant(params)
|
|
||||||
compose_from(params)
|
def registrant_updated_notification_for_new_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver)
|
||||||
|
@domain = Domain.find_by(id: domain_id)
|
||||||
|
return unless @domain
|
||||||
|
return if delivery_off?(@domain, should_deliver)
|
||||||
|
|
||||||
|
@old_registrant = Registrant.find(old_registrant_id)
|
||||||
|
@new_registrant = Registrant.find(new_registrant_id)
|
||||||
|
|
||||||
|
return if whitelist_blocked?(@new_registrant.email)
|
||||||
|
mail(to: format(@new_registrant.email),
|
||||||
|
subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject,
|
||||||
|
name: @domain.name)} [#{@domain.name}]")
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrant_updated_notification_for_old_registrant(params)
|
|
||||||
compose_from(params)
|
def registrant_updated_notification_for_old_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver)
|
||||||
|
@domain = Domain.find_by(id: domain_id)
|
||||||
|
return unless @domain
|
||||||
|
return if delivery_off?(@domain, should_deliver)
|
||||||
|
|
||||||
|
@old_registrant = Registrant.find(old_registrant_id)
|
||||||
|
@new_registrant = Registrant.find(new_registrant_id)
|
||||||
|
|
||||||
|
return if whitelist_blocked?(@old_registrant.email)
|
||||||
|
mail(to: format(@old_registrant.email),
|
||||||
|
subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject,
|
||||||
|
name: @domain.name)} [#{@domain.name}]")
|
||||||
end
|
end
|
||||||
|
|
||||||
def pending_update_rejected_notification_for_new_registrant(params)
|
def pending_update_rejected_notification_for_new_registrant(params)
|
||||||
|
|
|
@ -6,7 +6,6 @@ class AccountActivity < ActiveRecord::Base
|
||||||
belongs_to :bank_transaction
|
belongs_to :bank_transaction
|
||||||
belongs_to :invoice
|
belongs_to :invoice
|
||||||
|
|
||||||
attr_accessor :registrar
|
|
||||||
|
|
||||||
CREATE = 'create'
|
CREATE = 'create'
|
||||||
RENEW = 'renew'
|
RENEW = 'renew'
|
||||||
|
@ -24,14 +23,15 @@ class AccountActivity < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_csv
|
def to_csv
|
||||||
attributes = %w(registrar description activity_type created_at sum)
|
attributes = %w(description activity_type created_at sum)
|
||||||
|
|
||||||
CSV.generate(headers: true) do |csv|
|
CSV.generate(headers: true) do |csv|
|
||||||
csv << %w(registrar description activity_type receipt_date sum)
|
csv << %w(registrar description activity_type receipt_date sum)
|
||||||
|
|
||||||
all.each do |x| # rubocop:disable Rails/FindEach
|
all.each do |x| # rubocop:disable Rails/FindEach
|
||||||
x.registrar = Registrar.find(x.account_id).try(:code)
|
attrs = [x.account.registrar.try(:code)]
|
||||||
csv << attributes.map { |attr| x.send(attr) }
|
attrs += attributes.map { |attr| x.send(attr) }
|
||||||
|
csv << attrs
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,6 @@ class BankTransaction < ActiveRecord::Base
|
||||||
include Versions
|
include Versions
|
||||||
belongs_to :bank_statement
|
belongs_to :bank_statement
|
||||||
has_one :account_activity
|
has_one :account_activity
|
||||||
has_many :directo_records, as: :item, class_name: 'Directo'# Deprecated
|
|
||||||
|
|
||||||
scope :unbinded, lambda {
|
scope :unbinded, lambda {
|
||||||
where('id NOT IN (SELECT bank_transaction_id FROM account_activities where bank_transaction_id IS NOT NULL)')
|
where('id NOT IN (SELECT bank_transaction_id FROM account_activities where bank_transaction_id IS NOT NULL)')
|
||||||
|
|
|
@ -12,6 +12,10 @@ class Contact < ActiveRecord::Base
|
||||||
# TODO: remove later
|
# TODO: remove later
|
||||||
has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy
|
has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy
|
||||||
|
|
||||||
|
has_paper_trail class_name: "ContactVersion", meta: { children: :children_log }
|
||||||
|
|
||||||
|
attr_accessor :legal_document_id
|
||||||
|
|
||||||
accepts_nested_attributes_for :legal_documents
|
accepts_nested_attributes_for :legal_documents
|
||||||
|
|
||||||
validates :name, :phone, :email, :ident, :ident_type,
|
validates :name, :phone, :email, :ident, :ident_type,
|
||||||
|
@ -32,6 +36,7 @@ class Contact < ActiveRecord::Base
|
||||||
validate :val_ident_valid_format?
|
validate :val_ident_valid_format?
|
||||||
validate :uniq_statuses?
|
validate :uniq_statuses?
|
||||||
validate :validate_html
|
validate :validate_html
|
||||||
|
validate :val_country_code
|
||||||
|
|
||||||
after_initialize do
|
after_initialize do
|
||||||
self.statuses = [] if statuses.nil?
|
self.statuses = [] if statuses.nil?
|
||||||
|
@ -39,7 +44,7 @@ class Contact < ActiveRecord::Base
|
||||||
self.ident_updated_at = Time.zone.now if new_record? && ident_updated_at.blank?
|
self.ident_updated_at = Time.zone.now if new_record? && ident_updated_at.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
before_validation :set_ident_country_code
|
before_validation :to_upcase_country_code
|
||||||
before_validation :prefix_code
|
before_validation :prefix_code
|
||||||
before_create :generate_auth_info
|
before_create :generate_auth_info
|
||||||
|
|
||||||
|
@ -76,7 +81,7 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
ORG = 'org'
|
ORG = 'org'
|
||||||
PRIV = 'priv'
|
PRIV = 'priv'
|
||||||
BIRTHDAY = 'birthday'
|
BIRTHDAY = 'birthday'.freeze
|
||||||
PASSPORT = 'passport'
|
PASSPORT = 'passport'
|
||||||
|
|
||||||
IDENT_TYPES = [
|
IDENT_TYPES = [
|
||||||
|
@ -247,6 +252,8 @@ class Contact < ActiveRecord::Base
|
||||||
if ident.size != 8 || !(ident =~/\A[0-9]{8}\z/)
|
if ident.size != 8 || !(ident =~/\A[0-9]{8}\z/)
|
||||||
errors.add(:ident, err_msg)
|
errors.add(:ident, err_msg)
|
||||||
end
|
end
|
||||||
|
when BIRTHDAY
|
||||||
|
errors.add(:ident, err_msg) if id.blank? # only for create action right now. Later for all of them
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -279,6 +286,10 @@ class Contact < ActiveRecord::Base
|
||||||
!org?
|
!org?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def birthday?
|
||||||
|
ident_type == BIRTHDAY
|
||||||
|
end
|
||||||
|
|
||||||
def generate_auth_info
|
def generate_auth_info
|
||||||
return if @generate_auth_info_disabled
|
return if @generate_auth_info_disabled
|
||||||
return if auth_info.present?
|
return if auth_info.present?
|
||||||
|
@ -330,22 +341,36 @@ class Contact < ActiveRecord::Base
|
||||||
# TODO: refactor, it should not allow to destroy with normal destroy,
|
# TODO: refactor, it should not allow to destroy with normal destroy,
|
||||||
# no need separate method
|
# no need separate method
|
||||||
# should use only in transaction
|
# should use only in transaction
|
||||||
def destroy_and_clean
|
def destroy_and_clean frame
|
||||||
if domains_present?
|
if domains_present?
|
||||||
errors.add(:domains, :exist)
|
errors.add(:domains, :exist)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame)
|
||||||
|
|
||||||
|
if legal_document_data
|
||||||
|
|
||||||
|
doc = LegalDocument.create(
|
||||||
|
documentable_type: Contact,
|
||||||
|
document_type: legal_document_data[:type],
|
||||||
|
body: legal_document_data[:body]
|
||||||
|
)
|
||||||
|
self.legal_documents = [doc]
|
||||||
|
self.legal_document_id = doc.id
|
||||||
|
self.save
|
||||||
|
end
|
||||||
destroy
|
destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_ident_country_code
|
def to_upcase_country_code
|
||||||
return true unless ident_country_code_changed? && ident_country_code.present?
|
self.ident_country_code = ident_country_code.upcase if ident_country_code
|
||||||
code = Country.new(ident_country_code)
|
self.country_code = country_code.upcase if country_code
|
||||||
if code
|
end
|
||||||
self.ident_country_code = code.alpha2
|
|
||||||
else
|
def val_country_code
|
||||||
errors.add(:ident, :invalid_country_code)
|
errors.add(:ident, :invalid_country_code) unless Country.new(ident_country_code)
|
||||||
end
|
errors.add(:ident, :invalid_country_code) unless Country.new(country_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
def related_domain_descriptions
|
def related_domain_descriptions
|
||||||
|
@ -525,9 +550,15 @@ class Contact < ActiveRecord::Base
|
||||||
]).present?
|
]).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_related_whois_records
|
def update_related_whois_records
|
||||||
names = related_domain_descriptions.keys
|
names = related_domain_descriptions.keys
|
||||||
UpdateWhoisRecordJob.enqueue(names, :domain) if names.present?
|
UpdateWhoisRecordJob.enqueue(names, :domain) if names.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def children_log
|
||||||
|
log = HashWithIndifferentAccess.new
|
||||||
|
log[:legal_documents]= [legal_document_id]
|
||||||
|
log
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
24
app/models/counter.rb
Normal file
24
app/models/counter.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
class Counter
|
||||||
|
def initialize value = 0
|
||||||
|
@value = value
|
||||||
|
end
|
||||||
|
attr_accessor :value
|
||||||
|
def method_missing *args, &blk
|
||||||
|
@value.send(*args, &blk)
|
||||||
|
end
|
||||||
|
def to_s
|
||||||
|
@value.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
def now
|
||||||
|
@value
|
||||||
|
end
|
||||||
|
|
||||||
|
# pre-increment ".+" when x not present
|
||||||
|
def next(x = 1)
|
||||||
|
@value += x
|
||||||
|
end
|
||||||
|
def prev(x = 1)
|
||||||
|
@value -= x
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,4 +1,5 @@
|
||||||
class Directo < ActiveRecord::Base
|
class Directo < ActiveRecord::Base
|
||||||
|
DOMAIN_TO_PRODUCT = {"ee" => "01EE", "com.ee" => "02COM", "pri.ee" => "03PRI", "fie.ee"=>"04FIE", "med.ee" => "05MED"}.freeze
|
||||||
belongs_to :item, polymorphic: true
|
belongs_to :item, polymorphic: true
|
||||||
|
|
||||||
def self.send_receipts
|
def self.send_receipts
|
||||||
|
@ -52,9 +53,127 @@ class Directo < ActiveRecord::Base
|
||||||
def self.dump_result_to_db mappers, xml
|
def self.dump_result_to_db mappers, xml
|
||||||
Nokogiri::XML(xml).css("Result").each do |res|
|
Nokogiri::XML(xml).css("Result").each do |res|
|
||||||
obj = mappers[res.attributes["docid"].value.to_i]
|
obj = mappers[res.attributes["docid"].value.to_i]
|
||||||
obj.directo_records.create!(response: res.as_json.to_h)
|
obj.directo_records.create!(response: res.as_json.to_h, invoice_number: obj.number)
|
||||||
obj.update_columns(in_directo: true)
|
obj.update_columns(in_directo: true)
|
||||||
Rails.logger.info("[DIRECTO] Invoice #{res.attributes["docid"].value} was pushed and return is #{res.as_json.to_h.inspect}")
|
Rails.logger.info("[DIRECTO] Invoice #{res.attributes["docid"].value} was pushed and return is #{res.as_json.to_h.inspect}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def self.send_monthly_invoices(debug: false)
|
||||||
|
@debug = debug
|
||||||
|
I18n.locale = :et
|
||||||
|
month = Time.now - 1.month
|
||||||
|
invoices_until = month.end_of_month
|
||||||
|
date_format = "%Y-%m-%d"
|
||||||
|
invoice_counter= Counter.new
|
||||||
|
|
||||||
|
min_directo = Setting.directo_monthly_number_min.presence.try(:to_i)
|
||||||
|
max_directo = Setting.directo_monthly_number_max.presence.try(:to_i)
|
||||||
|
last_directo = [Setting.directo_monthly_number_last.presence.try(:to_i), min_directo].compact.max || 0
|
||||||
|
if max_directo && max_directo <= last_directo
|
||||||
|
raise "Directo counter is out of period (max allowed number is smaller than last counter number)"
|
||||||
|
end
|
||||||
|
|
||||||
|
directo_next = last_directo
|
||||||
|
Registrar.where.not(test_registrar: true).find_each do |registrar|
|
||||||
|
unless registrar.cash_account
|
||||||
|
Rails.logger.info("[DIRECTO] Monthly invoice for registrar #{registrar.id} has been skipped as it doesn't has cash_account")
|
||||||
|
next
|
||||||
|
end
|
||||||
|
counter = Counter.new(1)
|
||||||
|
items = {}
|
||||||
|
registrar_activities = AccountActivity.where(account_id: registrar.account_ids).where("created_at BETWEEN ? AND ?",month.beginning_of_month, month.end_of_month)
|
||||||
|
|
||||||
|
# adding domains items
|
||||||
|
registrar_activities.where(activity_type: [AccountActivity::CREATE, AccountActivity::RENEW]).each do |activity|
|
||||||
|
pricelist = load_activity_pricelist(activity)
|
||||||
|
unless pricelist
|
||||||
|
Rails.logger.error("[DIRECTO] Skipping activity #{activity.id} as pricelist not found")
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
pricelist.years_amount.times do |i|
|
||||||
|
year = i+1
|
||||||
|
hash = {
|
||||||
|
"ProductID" => DOMAIN_TO_PRODUCT[pricelist.category],
|
||||||
|
"Unit" => "tk",
|
||||||
|
"ProductName" => ".#{pricelist.category} registreerimine: #{pricelist.years_amount} aasta",
|
||||||
|
"UnitPriceWoVAT" => pricelist.price_decimal/pricelist.years_amount
|
||||||
|
}
|
||||||
|
hash["StartDate"] = (activity.created_at + (year-1).year).end_of_month.strftime(date_format) if year > 1
|
||||||
|
hash["EndDate"] = (activity.created_at + (year-1).year + 1).end_of_month.strftime(date_format) if year > 1
|
||||||
|
|
||||||
|
if items.has_key?(hash)
|
||||||
|
items[hash]["Quantity"] += 1
|
||||||
|
else
|
||||||
|
items[hash] = {"RN"=>counter.next, "RR" => counter.now - i, "Quantity"=> 1}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#adding prepaiments
|
||||||
|
if items.any?
|
||||||
|
total = 0
|
||||||
|
items.each{ |key, val| total += val["Quantity"] * key["UnitPriceWoVAT"] }
|
||||||
|
hash = {"ProductID" => Setting.directo_receipt_product_name, "Unit" => "tk", "ProductName" => "Domeenide ettemaks", "UnitPriceWoVAT"=>total}
|
||||||
|
items[hash] = {"RN"=>counter.next, "RR" => counter.now, "Quantity"=> -1}
|
||||||
|
end
|
||||||
|
|
||||||
|
# generating XML
|
||||||
|
if items.any?
|
||||||
|
directo_next += 1
|
||||||
|
invoice_counter.next
|
||||||
|
|
||||||
|
builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
|
||||||
|
xml.invoices{
|
||||||
|
xml.invoice("Number" =>directo_next,
|
||||||
|
"InvoiceDate" =>invoices_until.strftime(date_format),
|
||||||
|
"PaymentTerm" =>Setting.directo_receipt_payment_term,
|
||||||
|
"CustomerCode"=>registrar.directo_handle,
|
||||||
|
"Language" =>"",
|
||||||
|
"Currency" =>registrar_activities.first.currency,
|
||||||
|
"SalesAgent" =>Setting.directo_sales_agent){
|
||||||
|
xml.line("RN" => 1, "RR"=>1, "ProductName"=> "Domeenide registreerimine - #{I18n.l(invoices_until, format: "%B %Y").titleize}")
|
||||||
|
items.each do |line, val|
|
||||||
|
xml.line(val.merge(line))
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
data = builder.to_xml.gsub("\n",'')
|
||||||
|
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s
|
||||||
|
if @debug
|
||||||
|
STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n"
|
||||||
|
else
|
||||||
|
Setting.directo_monthly_number_last = directo_next
|
||||||
|
Nokogiri::XML(response).css("Result").each do |res|
|
||||||
|
Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next)
|
||||||
|
Rails.logger.info("[DIRECTO] Invoice #{res.attributes["docid"].value} was pushed and return is #{res.as_json.to_h.inspect}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Rails.logger.info("[DIRECTO] Registrar #{registrar.id} has nothing to be sent to Directo")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
STDOUT << "#{Time.zone.now.utc} - Directo invoices sending finished. #{invoice_counter.now} are sent\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def self.load_activity_pricelist activity
|
||||||
|
@pricelists ||= {}
|
||||||
|
return @pricelists[activity.log_pricelist_id] if @pricelists.has_key?(activity.log_pricelist_id)
|
||||||
|
|
||||||
|
pricelist = Pricelist.find_by(id: activity.log_pricelist_id) || PricelistVersion.find_by(item_id: activity.log_pricelist_id).try(:reify)
|
||||||
|
unless pricelist
|
||||||
|
@pricelists[activity.log_pricelist_id] = nil
|
||||||
|
Rails.logger.info("[DIRECTO] AccountActivity #{activity.id} cannot be sent as pricelist wasn't found #{activity.log_pricelist_id}")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
@pricelists[activity.log_pricelist_id] = pricelist.version_at(activity.created_at) || pricelist
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
attr_accessor :roles
|
attr_accessor :roles
|
||||||
|
|
||||||
|
attr_accessor :legal_document_id
|
||||||
|
|
||||||
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
|
# 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?
|
# TODO: most inputs should be trimmed before validatation, probably some global logic?
|
||||||
|
|
||||||
|
@ -345,7 +347,8 @@ class Domain < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# state change shouln't be
|
# state changes may be done low-level - no validation
|
||||||
|
# in this metod we still save PaperTrail log.
|
||||||
def clean_pendings_lowlevel
|
def clean_pendings_lowlevel
|
||||||
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||||
statuses.delete(DomainStatus::PENDING_UPDATE)
|
statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||||
|
@ -354,13 +357,23 @@ class Domain < ActiveRecord::Base
|
||||||
status_notes[DomainStatus::PENDING_UPDATE] = ''
|
status_notes[DomainStatus::PENDING_UPDATE] = ''
|
||||||
status_notes[DomainStatus::PENDING_DELETE] = ''
|
status_notes[DomainStatus::PENDING_DELETE] = ''
|
||||||
|
|
||||||
update_columns(
|
hash = {
|
||||||
registrant_verification_token: nil,
|
registrant_verification_token: nil,
|
||||||
registrant_verification_asked_at: nil,
|
registrant_verification_asked_at: nil,
|
||||||
pending_json: {},
|
pending_json: {},
|
||||||
status_notes: status_notes,
|
status_notes: status_notes,
|
||||||
statuses: statuses.presence || [DomainStatus::OK]
|
statuses: statuses.presence || [DomainStatus::OK],
|
||||||
)
|
# need this column in order to update PaperTrail version properly
|
||||||
|
updated_at: Time.now.utc
|
||||||
|
}
|
||||||
|
|
||||||
|
# PaperTrail
|
||||||
|
self.attributes = hash
|
||||||
|
record_update
|
||||||
|
clear_version_instance!
|
||||||
|
reset_transaction_id
|
||||||
|
|
||||||
|
update_columns(hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pending_update!
|
def pending_update!
|
||||||
|
@ -384,6 +397,7 @@ class Domain < ActiveRecord::Base
|
||||||
self.registrant_verification_token = token
|
self.registrant_verification_token = token
|
||||||
self.registrant_verification_asked_at = asked_at
|
self.registrant_verification_asked_at = asked_at
|
||||||
set_pending_update
|
set_pending_update
|
||||||
|
touch_always_version
|
||||||
pending_json['new_registrant_id'] = new_registrant_id
|
pending_json['new_registrant_id'] = new_registrant_id
|
||||||
pending_json['new_registrant_email'] = new_registrant_email
|
pending_json['new_registrant_email'] = new_registrant_email
|
||||||
pending_json['new_registrant_name'] = new_registrant_name
|
pending_json['new_registrant_name'] = new_registrant_name
|
||||||
|
@ -449,19 +463,14 @@ class Domain < ActiveRecord::Base
|
||||||
period_i ||= period
|
period_i ||= period
|
||||||
unit ||= period_unit
|
unit ||= period_unit
|
||||||
|
|
||||||
|
# TODO: test if name.scan(/\.(.+)\z/).first.first is faster
|
||||||
zone = name.split('.').drop(1).join('.')
|
zone = name.split('.').drop(1).join('.')
|
||||||
|
|
||||||
p = period_i / 365 if unit == 'd'
|
p = period_i / 365 if unit == 'd'
|
||||||
p = period_i / 12 if unit == 'm'
|
p = period_i / 12 if unit == 'm'
|
||||||
p = period_i if unit == 'y'
|
p = period_i if unit == 'y'
|
||||||
|
|
||||||
if p > 1
|
Pricelist.pricelist_for(zone, operation, "#{p}year".pluralize(p))
|
||||||
p = "#{p}years"
|
|
||||||
else
|
|
||||||
p = "#{p}year"
|
|
||||||
end
|
|
||||||
|
|
||||||
Pricelist.pricelist_for(zone, operation, p)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
### VALIDATIONS ###
|
### VALIDATIONS ###
|
||||||
|
@ -566,7 +575,7 @@ class Domain < ActiveRecord::Base
|
||||||
statuses << DomainStatus::SERVER_MANUAL_INZONE
|
statuses << DomainStatus::SERVER_MANUAL_INZONE
|
||||||
end
|
end
|
||||||
|
|
||||||
self.force_delete_at = Time.zone.now + Setting.redemption_grace_period.days unless force_delete_at
|
self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day unless force_delete_at
|
||||||
transaction do
|
transaction do
|
||||||
save!(validate: false)
|
save!(validate: false)
|
||||||
registrar.messages.create!(
|
registrar.messages.create!(
|
||||||
|
@ -595,7 +604,7 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
def set_graceful_expired
|
def set_graceful_expired
|
||||||
self.outzone_at = valid_to + Setting.expire_warning_period.days
|
self.outzone_at = valid_to + Setting.expire_warning_period.days
|
||||||
self.delete_at = outzone_at + Setting.redemption_grace_period.days
|
self.delete_at = (outzone_at + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day
|
||||||
self.statuses |= [DomainStatus::EXPIRED]
|
self.statuses |= [DomainStatus::EXPIRED]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -603,7 +612,7 @@ class Domain < ActiveRecord::Base
|
||||||
# TODO: currently valid_to attribute update logic is open
|
# TODO: currently valid_to attribute update logic is open
|
||||||
# self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
|
# self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
|
||||||
self.outzone_at = Time.zone.now + Setting.expire_warning_period.days
|
self.outzone_at = Time.zone.now + Setting.expire_warning_period.days
|
||||||
self.delete_at = Time.zone.now + Setting.redemption_grace_period.days
|
self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day
|
||||||
statuses << DomainStatus::EXPIRED
|
statuses << DomainStatus::EXPIRED
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -725,17 +734,14 @@ class Domain < ActiveRecord::Base
|
||||||
# rubocop: enable Metrics/CyclomaticComplexity
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
# rubocop: enable Metrics/PerceivedComplexity
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
|
||||||
|
|
||||||
# small optimization that we'are using to_a if it was done already
|
|
||||||
# otherwise just getting ids
|
|
||||||
def children_log
|
def children_log
|
||||||
log = HashWithIndifferentAccess.new
|
log = HashWithIndifferentAccess.new
|
||||||
log[:admin_contacts] = admin_contact_ids
|
log[:admin_contacts] = admin_contact_ids
|
||||||
log[:tech_contacts] = tech_contact_ids
|
log[:tech_contacts] = tech_contact_ids
|
||||||
log[:nameservers] = nameserver_ids
|
log[:nameservers] = nameserver_ids
|
||||||
log[:domain_statuses]= domain_status_ids
|
log[:legal_documents]= [legal_document_id]
|
||||||
log[:dnskeys] = dnskey_ids
|
|
||||||
log[:registrant] = [registrant_id]
|
log[:registrant] = [registrant_id]
|
||||||
|
log[:domain_statuses] = domain_status_ids
|
||||||
log
|
log
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -65,46 +65,55 @@ class DomainCron
|
||||||
marked
|
marked
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.start_delete_period
|
#doing nothing, deprecated
|
||||||
begin
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
|
|
||||||
|
|
||||||
d = Domain.where('delete_at <= ?', Time.zone.now)
|
def self.start_delete_period
|
||||||
marked = 0
|
# begin
|
||||||
real = 0
|
# STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
|
||||||
d.each do |domain|
|
#
|
||||||
next unless domain.delete_candidateable?
|
# d = Domain.where('delete_at <= ?', Time.zone.now)
|
||||||
real += 1
|
# marked = 0
|
||||||
domain.statuses << DomainStatus::DELETE_CANDIDATE
|
# real = 0
|
||||||
STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
|
# d.each do |domain|
|
||||||
domain.save(validate: false) and marked += 1
|
# next unless domain.delete_candidateable?
|
||||||
end
|
# real += 1
|
||||||
ensure # the operator should see what was accomplished
|
# domain.statuses << DomainStatus::DELETE_CANDIDATE
|
||||||
STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{real} successfully set\n" unless Rails.env.test?
|
# STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test?
|
||||||
end
|
# ::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
marked
|
# domain.save(validate: false) and marked += 1
|
||||||
|
# end
|
||||||
|
# ensure # the operator should see what was accomplished
|
||||||
|
# STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{real} successfully set\n" unless Rails.env.test?
|
||||||
|
# end
|
||||||
|
# marked
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.destroy_delete_candidates
|
def self.destroy_delete_candidates
|
||||||
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
|
||||||
|
|
||||||
c = 0
|
c = 0
|
||||||
Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x|
|
|
||||||
WhoisRecord.where(domain_id: x.id).destroy_all
|
|
||||||
destroy_with_message x
|
|
||||||
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by deleteCandidate ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
|
||||||
|
|
||||||
c += 1
|
Domain.where('delete_at <= ?', Time.zone.now).each do |x|
|
||||||
|
next unless x.delete_candidateable?
|
||||||
|
|
||||||
|
x.statuses << DomainStatus::DELETE_CANDIDATE
|
||||||
|
|
||||||
|
# If domain successfully saved, add it to delete schedule
|
||||||
|
if x.save(validate: false)
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
|
DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
|
||||||
|
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: job added by deleteCandidate status ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
||||||
|
c += 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
|
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
|
||||||
WhoisRecord.where(domain_id: x.id).destroy_all
|
DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
|
||||||
destroy_with_message x
|
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
||||||
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
|
||||||
c += 1
|
c += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Job destroy added for #{c} domains\n" unless Rails.env.test?
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop: enable Metrics/AbcSize
|
# rubocop: enable Metrics/AbcSize
|
||||||
|
|
|
@ -21,27 +21,6 @@ class DomainMailModel
|
||||||
compose
|
compose
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrant_updated_notification_for_new_registrant
|
|
||||||
registrant
|
|
||||||
subject(:registrant_updated_notification_for_new_registrant_subject)
|
|
||||||
domain_info
|
|
||||||
compose
|
|
||||||
end
|
|
||||||
|
|
||||||
def registrant_updated_notification_for_old_registrant
|
|
||||||
registrant_pending
|
|
||||||
registrant_old
|
|
||||||
subject(:registrant_updated_notification_for_old_registrant_subject)
|
|
||||||
new_registrant = Registrant.find @domain.pending_json['new_registrant_id']
|
|
||||||
@params[:registrant_name] = new_registrant.name
|
|
||||||
@params[:registrant_ident] = new_registrant.ident
|
|
||||||
@params[:registrant_priv] = new_registrant.priv?
|
|
||||||
@params[:registrant_email] = new_registrant.email
|
|
||||||
@params[:registrant_street] = new_registrant.street
|
|
||||||
@params[:registrant_city] = new_registrant.city
|
|
||||||
@params[:registrant_country] = new_registrant.country.name
|
|
||||||
compose
|
|
||||||
end
|
|
||||||
|
|
||||||
def pending_update_rejected_notification_for_new_registrant
|
def pending_update_rejected_notification_for_new_registrant
|
||||||
registrant_pending
|
registrant_pending
|
||||||
|
|
|
@ -37,10 +37,7 @@ class Epp::Contact < Contact
|
||||||
at[:country_code] = f.css('postalInfo addr cc').text if f.css('postalInfo addr cc').present?
|
at[:country_code] = f.css('postalInfo addr cc').text if f.css('postalInfo addr cc').present?
|
||||||
at[:auth_info] = f.css('authInfo pw').text if f.css('authInfo pw').present?
|
at[:auth_info] = f.css('authInfo pw').text if f.css('authInfo pw').present?
|
||||||
|
|
||||||
legal_frame = f.css('legalDocument').first
|
|
||||||
if legal_frame.present?
|
|
||||||
at[:legal_documents_attributes] = legal_document_attrs(legal_frame)
|
|
||||||
end
|
|
||||||
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
||||||
at
|
at
|
||||||
end
|
end
|
||||||
|
@ -104,6 +101,7 @@ class Epp::Contact < Contact
|
||||||
|
|
||||||
res
|
res
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
delegate :ident_attr_valid?, to: :class
|
delegate :ident_attr_valid?, to: :class
|
||||||
|
|
||||||
|
@ -143,7 +141,7 @@ class Epp::Contact < Contact
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/AbcSize
|
# rubocop:disable Metrics/AbcSize
|
||||||
def update_attributes(frame)
|
def update_attributes(frame, current_user)
|
||||||
return super if frame.blank?
|
return super if frame.blank?
|
||||||
at = {}.with_indifferent_access
|
at = {}.with_indifferent_access
|
||||||
at.deep_merge!(self.class.attrs_from(frame.css('chg'), new_record: false))
|
at.deep_merge!(self.class.attrs_from(frame.css('chg'), new_record: false))
|
||||||
|
@ -152,8 +150,14 @@ class Epp::Contact < Contact
|
||||||
at[:statuses] = statuses - statuses_attrs(frame.css('rem'), 'rem') + statuses_attrs(frame.css('add'), 'add')
|
at[:statuses] = statuses - statuses_attrs(frame.css('rem'), 'rem') + statuses_attrs(frame.css('add'), 'add')
|
||||||
end
|
end
|
||||||
|
|
||||||
legal_frame = frame.css('legalDocument').first
|
# legal_frame = frame.css('legalDocument').first
|
||||||
at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame)
|
# at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame)
|
||||||
|
|
||||||
|
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
||||||
|
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||||
|
self.legal_document_id = doc.id
|
||||||
|
end
|
||||||
|
|
||||||
self.deliver_emails = true # turn on email delivery for epp
|
self.deliver_emails = true # turn on email delivery for epp
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,6 +173,8 @@ class Epp::Contact < Contact
|
||||||
elsif ident_type == "birthday" && !ident[/\A\d{4}-\d{2}-\d{2}\z/] && (Date.parse(ident) rescue false)
|
elsif ident_type == "birthday" && !ident[/\A\d{4}-\d{2}-\d{2}\z/] && (Date.parse(ident) rescue false)
|
||||||
at.merge!(ident: ident_frame.text)
|
at.merge!(ident: ident_frame.text)
|
||||||
at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present?
|
at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present?
|
||||||
|
elsif ident_type == "birthday" && ident_country_code.blank?
|
||||||
|
at.merge!(ident_country_code: ident_frame.attr('cc'))
|
||||||
elsif ident_type.blank? && ident_country_code.blank?
|
elsif ident_type.blank? && ident_country_code.blank?
|
||||||
at.merge!(ident_type: ident_frame.attr('type'))
|
at.merge!(ident_type: ident_frame.attr('type'))
|
||||||
at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present?
|
at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present?
|
||||||
|
@ -180,6 +186,9 @@ class Epp::Contact < Contact
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.upid = current_user.registrar.id if current_user.registrar
|
||||||
|
self.up_date = Time.zone.now
|
||||||
|
|
||||||
super(at)
|
super(at)
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/AbcSize
|
# rubocop:enable Metrics/AbcSize
|
||||||
|
@ -217,4 +226,29 @@ class Epp::Contact < Contact
|
||||||
|
|
||||||
status_list
|
status_list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def attach_legal_document(legal_document_data)
|
||||||
|
return unless legal_document_data
|
||||||
|
|
||||||
|
legal_documents.create(
|
||||||
|
document_type: legal_document_data[:type],
|
||||||
|
body: legal_document_data[:body]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_legal_file_to_new frame
|
||||||
|
legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame)
|
||||||
|
return unless legal_document_data
|
||||||
|
|
||||||
|
doc = LegalDocument.create(
|
||||||
|
documentable_type: Contact,
|
||||||
|
document_type: legal_document_data[:type],
|
||||||
|
body: legal_document_data[:body]
|
||||||
|
)
|
||||||
|
self.legal_documents = [doc]
|
||||||
|
|
||||||
|
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||||
|
self.legal_document_id = doc.id
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -133,7 +133,8 @@ class Epp::Domain < Domain
|
||||||
[:base, :ds_data_not_allowed],
|
[:base, :ds_data_not_allowed],
|
||||||
[:base, :key_data_not_allowed],
|
[:base, :key_data_not_allowed],
|
||||||
[:period, :not_a_number],
|
[:period, :not_a_number],
|
||||||
[:period, :not_an_integer]
|
[:period, :not_an_integer],
|
||||||
|
[:registrant, :cannot_be_missing]
|
||||||
],
|
],
|
||||||
'2308' => [
|
'2308' => [
|
||||||
[:base, :domain_name_blocked, { value: { obj: 'name', val: name_dirty } }]
|
[:base, :domain_name_blocked, { value: { obj: 'name', val: name_dirty } }]
|
||||||
|
@ -155,7 +156,8 @@ class Epp::Domain < Domain
|
||||||
def attrs_from(frame, current_user, action = nil)
|
def attrs_from(frame, current_user, action = nil)
|
||||||
at = {}.with_indifferent_access
|
at = {}.with_indifferent_access
|
||||||
|
|
||||||
code = frame.css('registrant').first.try(:text)
|
registrant_frame = frame.css('registrant').first
|
||||||
|
code = registrant_frame.try(:text)
|
||||||
if code.present?
|
if code.present?
|
||||||
if action == 'chg' && registrant_change_prohibited?
|
if action == 'chg' && registrant_change_prohibited?
|
||||||
add_epp_error('2304', nil, DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
add_epp_error('2304', nil, DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
||||||
|
@ -166,7 +168,10 @@ class Epp::Domain < Domain
|
||||||
else
|
else
|
||||||
add_epp_error('2303', 'registrant', code, [:registrant, :not_found])
|
add_epp_error('2303', 'registrant', code, [:registrant, :not_found])
|
||||||
end
|
end
|
||||||
end
|
else
|
||||||
|
add_epp_error('2306', nil, nil, [:registrant, :cannot_be_missing])
|
||||||
|
end if registrant_frame
|
||||||
|
|
||||||
|
|
||||||
at[:name] = frame.css('name').text if new_record?
|
at[:name] = frame.css('name').text if new_record?
|
||||||
at[:registrar_id] = current_user.registrar.try(:id)
|
at[:registrar_id] = current_user.registrar.try(:id)
|
||||||
|
@ -195,9 +200,27 @@ class Epp::Domain < Domain
|
||||||
end
|
end
|
||||||
|
|
||||||
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
|
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
|
||||||
at[:legal_documents_attributes] = legal_document_from(frame)
|
|
||||||
at
|
at
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# Adding legal doc to domain and
|
||||||
|
# if something goes wrong - raise Rollback error
|
||||||
|
def add_legal_file_to_new frame
|
||||||
|
legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame)
|
||||||
|
return unless legal_document_data
|
||||||
|
|
||||||
|
doc = LegalDocument.create(
|
||||||
|
documentable_type: Domain,
|
||||||
|
document_type: legal_document_data[:type],
|
||||||
|
body: legal_document_data[:body]
|
||||||
|
)
|
||||||
|
self.legal_documents = [doc]
|
||||||
|
|
||||||
|
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||||
|
self.legal_document_id = doc.id
|
||||||
|
end
|
||||||
# rubocop: enable Metrics/PerceivedComplexity
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
# rubocop: enable Metrics/CyclomaticComplexity
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
# rubocop: enable Metrics/MethodLength
|
# rubocop: enable Metrics/MethodLength
|
||||||
|
@ -457,15 +480,6 @@ class Epp::Domain < Domain
|
||||||
status_list
|
status_list
|
||||||
end
|
end
|
||||||
|
|
||||||
def legal_document_from(frame)
|
|
||||||
ld = frame.css('legalDocument').first
|
|
||||||
return [] unless ld
|
|
||||||
|
|
||||||
[{
|
|
||||||
body: ld.text,
|
|
||||||
document_type: ld['type']
|
|
||||||
}]
|
|
||||||
end
|
|
||||||
|
|
||||||
# rubocop: disable Metrics/AbcSize
|
# rubocop: disable Metrics/AbcSize
|
||||||
# rubocop: disable Metrics/CyclomaticComplexity
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
|
@ -477,6 +491,7 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
||||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||||
|
self.legal_document_id = doc.id
|
||||||
end
|
end
|
||||||
|
|
||||||
at_add = attrs_from(frame.css('add'), current_user, 'add')
|
at_add = attrs_from(frame.css('add'), current_user, 'add')
|
||||||
|
@ -489,6 +504,11 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
# at[:statuses] += at_add[:domain_statuses_attributes]
|
# at[:statuses] += at_add[:domain_statuses_attributes]
|
||||||
|
|
||||||
|
if errors.empty? && verify
|
||||||
|
self.upid = current_user.registrar.id if current_user.registrar
|
||||||
|
self.up_date = Time.zone.now
|
||||||
|
end
|
||||||
|
|
||||||
if registrant_id && registrant.code == frame.css('registrant')
|
if registrant_id && registrant.code == frame.css('registrant')
|
||||||
|
|
||||||
throw :epp_error, {
|
throw :epp_error, {
|
||||||
|
@ -515,19 +535,23 @@ class Epp::Domain < Domain
|
||||||
preclean_pendings
|
preclean_pendings
|
||||||
user = ApiUser.find(pending_json['current_user_id'])
|
user = ApiUser.find(pending_json['current_user_id'])
|
||||||
frame = Nokogiri::XML(pending_json['frame'])
|
frame = Nokogiri::XML(pending_json['frame'])
|
||||||
|
old_registrant_id = registrant_id
|
||||||
|
|
||||||
self.deliver_emails = true # turn on email delivery
|
self.deliver_emails = true # turn on email delivery
|
||||||
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||||
|
self.upid = user.registrar.id if user.registrar
|
||||||
|
self.up_date = Time.zone.now
|
||||||
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
||||||
|
|
||||||
send_mail :registrant_updated_notification_for_old_registrant
|
|
||||||
return unless update(frame, user, false)
|
return unless update(frame, user, false)
|
||||||
clean_pendings!
|
clean_pendings!
|
||||||
|
|
||||||
send_mail :registrant_updated_notification_for_new_registrant
|
|
||||||
WhoisRecord.find_by(domain_id: id).save # need to reload model
|
|
||||||
|
|
||||||
save! # for notification if everything fails
|
save! # for notification if everything fails
|
||||||
|
|
||||||
|
WhoisRecord.find_by(domain_id: id).save # need to reload model
|
||||||
|
DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, true).deliver
|
||||||
|
DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, true).deliver
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -576,7 +600,7 @@ class Epp::Domain < Domain
|
||||||
msg: I18n.t(:object_status_prohibits_operation)
|
msg: I18n.t(:object_status_prohibits_operation)
|
||||||
} unless pending_deletable?
|
} unless pending_deletable?
|
||||||
|
|
||||||
self.delete_at = Time.zone.now + Setting.redemption_grace_period.days
|
self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day
|
||||||
set_pending_delete
|
set_pending_delete
|
||||||
set_server_hold if server_holdable?
|
set_server_hold if server_holdable?
|
||||||
save(validate: false)
|
save(validate: false)
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
class LegalDocument < ActiveRecord::Base
|
class LegalDocument < ActiveRecord::Base
|
||||||
|
include EppErrors
|
||||||
|
MIN_BODY_SIZE = (1.37 * 3.kilobytes).ceil
|
||||||
|
|
||||||
if ENV['legal_document_types'].present?
|
if ENV['legal_document_types'].present?
|
||||||
TYPES = ENV['legal_document_types'].split(',').map(&:strip)
|
TYPES = ENV['legal_document_types'].split(',').map(&:strip)
|
||||||
else
|
else
|
||||||
|
@ -10,11 +13,22 @@ class LegalDocument < ActiveRecord::Base
|
||||||
belongs_to :documentable, polymorphic: true
|
belongs_to :documentable, polymorphic: true
|
||||||
|
|
||||||
|
|
||||||
validates :body, length: { minimum: (1.37 * 8.kilobytes).ceil }, if: ->(file){ file.path.blank? && !Rails.env.staging?}
|
validate :val_body_length, if: ->(file){ file.path.blank? && !Rails.env.staging?}
|
||||||
|
|
||||||
before_create :add_creator
|
before_create :add_creator
|
||||||
before_save :save_to_filesystem
|
before_save :save_to_filesystem
|
||||||
|
|
||||||
|
def epp_code_map
|
||||||
|
{
|
||||||
|
'2306' => [
|
||||||
|
[:body, :length]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def val_body_length
|
||||||
|
errors.add(:body, :length) if body.nil? || body.size < MIN_BODY_SIZE
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def save_to_filesystem
|
def save_to_filesystem
|
||||||
|
|
|
@ -8,6 +8,8 @@ class Pricelist < ActiveRecord::Base
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope :valid_at, ->(time){ where("valid_from IS NULL OR valid_from <= ?", time).where("valid_to IS NULL OR valid_to >= ?", time) }
|
||||||
|
|
||||||
monetize :price_cents
|
monetize :price_cents
|
||||||
|
|
||||||
validates :price_cents, :price_currency, :price,
|
validates :price_cents, :price_currency, :price,
|
||||||
|
@ -27,6 +29,14 @@ class Pricelist < ActiveRecord::Base
|
||||||
"#{operation_category} #{category}"
|
"#{operation_category} #{category}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def years_amount
|
||||||
|
duration.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def price_decimal
|
||||||
|
price_cents / BigDecimal.new('100')
|
||||||
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def pricelist_for(zone, operation, period)
|
def pricelist_for(zone, operation, period)
|
||||||
lists = valid.where(category: zone, operation_category: operation, duration: period)
|
lists = valid.where(category: zone, operation_category: operation, duration: period)
|
||||||
|
|
|
@ -30,10 +30,20 @@ class RegistrantUser < User
|
||||||
return false if issuer_organization != ACCEPTED_ISSUER
|
return false if issuer_organization != ACCEPTED_ISSUER
|
||||||
|
|
||||||
idc_data.force_encoding('UTF-8')
|
idc_data.force_encoding('UTF-8')
|
||||||
identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first
|
|
||||||
country = idc_data.scan(/^\/C=(.{2})/).flatten.first
|
# handling here new and old mode
|
||||||
first_name = idc_data.scan(%r{/GN=(.+)/serialNumber}).flatten.first
|
if idc_data.starts_with?("/")
|
||||||
last_name = idc_data.scan(%r{/SN=(.+)/GN}).flatten.first
|
identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first
|
||||||
|
country = idc_data.scan(/^\/C=(.{2})/).flatten.first
|
||||||
|
first_name = idc_data.scan(%r{/GN=(.+)/serialNumber}).flatten.first
|
||||||
|
last_name = idc_data.scan(%r{/SN=(.+)/GN}).flatten.first
|
||||||
|
else
|
||||||
|
parse_str = "," + idc_data
|
||||||
|
identity_code = parse_str.scan(/,serialNumber=(\d+)/).flatten.first
|
||||||
|
country = parse_str.scan(/,C=(.{2})/).flatten.first
|
||||||
|
first_name = parse_str.scan(/,GN=([^,]+)/).flatten.first
|
||||||
|
last_name = parse_str.scan(/,SN=([^,]+)/).flatten.first
|
||||||
|
end
|
||||||
|
|
||||||
u = where(registrant_ident: "#{country}-#{identity_code}").first_or_create
|
u = where(registrant_ident: "#{country}-#{identity_code}").first_or_create
|
||||||
u.username = "#{first_name} #{last_name}"
|
u.username = "#{first_name} #{last_name}"
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{class: 'col-xs-2'}
|
%th{class: 'col-xs-2'}
|
||||||
= sort_link(@q, 'registrar')
|
= sort_link(@q, 'account_registrar_code', t(:registrar))
|
||||||
%th{class: 'col-xs-3'}
|
%th{class: 'col-xs-3'}
|
||||||
= sort_link(@q, 'description')
|
= sort_link(@q, 'description')
|
||||||
%th{class: 'col-xs-2'}
|
%th{class: 'col-xs-2'}
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:created_after)
|
= f.label t(:created_after)
|
||||||
= f.search_field :created_at_gteq, class: 'form-control', placeholder: t(:created_after), autocomplete: 'off'
|
= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control datepicker', placeholder: t(:created_after), autocomplete: 'off'
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:created_before)
|
= f.label t(:created_before)
|
||||||
= f.search_field :created_at_lteq, class: 'form-control', placeholder: t(:created_before), autocomplete: 'off'
|
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:created_before), autocomplete: 'off'
|
||||||
.col-md-3{style: 'padding-top: 25px;'}
|
.col-md-3{style: 'padding-top: 25px;'}
|
||||||
%button.btn.btn-primary
|
%button.btn.btn-primary
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,11 @@
|
||||||
= f.label :code
|
= f.label :code
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.text_field(:code, class: 'form-control', disabled: !f.object.new_record?)
|
= f.text_field(:code, class: 'form-control', disabled: !f.object.new_record?)
|
||||||
|
.form-group
|
||||||
|
.col-md-4.control-label
|
||||||
|
= f.label :test_registrar
|
||||||
|
.col-md-7
|
||||||
|
= f.check_box :test_registrar, class: 'form-control'
|
||||||
|
|
||||||
%hr
|
%hr
|
||||||
.row
|
.row
|
||||||
|
|
|
@ -14,12 +14,15 @@
|
||||||
= sort_link(@q, 'reg_no', t(:reg_no))
|
= sort_link(@q, 'reg_no', t(:reg_no))
|
||||||
%th{class: 'col-xs-4'}
|
%th{class: 'col-xs-4'}
|
||||||
= t(:credit_balance)
|
= t(:credit_balance)
|
||||||
|
%th{class: 'col-xs-4'}
|
||||||
|
= t(:test_registrar)
|
||||||
%tbody
|
%tbody
|
||||||
- @registrars.each do |x|
|
- @registrars.each do |x|
|
||||||
%tr
|
%tr
|
||||||
%td= link_to(x, [:admin, x])
|
%td= link_to(x, [:admin, x])
|
||||||
%td= x.reg_no
|
%td= x.reg_no
|
||||||
%td= "#{x.balance}"
|
%td= "#{x.balance}"
|
||||||
|
%td= "#{x.test_registrar}"
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= paginate @registrars
|
= paginate @registrars
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
= link_to(t(:edit), edit_admin_registrar_path(@registrar), class: 'btn btn-primary')
|
= link_to(t(:edit), edit_admin_registrar_path(@registrar), class: 'btn btn-primary')
|
||||||
= link_to(t(:delete), admin_registrar_path(@registrar),
|
= link_to(t(:delete), admin_registrar_path(@registrar),
|
||||||
method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger')
|
method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger')
|
||||||
|
- content_for :page_name do
|
||||||
|
= @registrar.name
|
||||||
|
- if @registrar.test_registrar?
|
||||||
|
%span{style: "color: #c9302c;"} (test)
|
||||||
= render 'shared/title', name: @registrar.name
|
= render 'shared/title', name: @registrar.name
|
||||||
|
|
||||||
- if @registrar.errors.any?
|
- if @registrar.errors.any?
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:created_after)
|
= f.label t(:created_after)
|
||||||
= f.search_field :created_at_gteq, class: 'form-control', placeholder: t(:created_after), autocomplete: 'off'
|
= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control datepicker', placeholder: t(:created_after), autocomplete: 'off'
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:created_before)
|
= f.label t(:created_before)
|
||||||
= f.search_field :created_at_lteq, class: 'form-control', placeholder: t(:created_before), autocomplete: 'off'
|
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:created_before), autocomplete: 'off'
|
||||||
.col-md-3{style: 'padding-top: 25px;'}
|
.col-md-3{style: 'padding-top: 25px;'}
|
||||||
%button.btn.btn-primary
|
%button.btn.btn-primary
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,9 @@
|
||||||
%tbody
|
%tbody
|
||||||
= render 'setting_row', var: :invoice_number_min
|
= render 'setting_row', var: :invoice_number_min
|
||||||
= render 'setting_row', var: :invoice_number_max
|
= render 'setting_row', var: :invoice_number_max
|
||||||
|
= render 'setting_row', var: :directo_monthly_number_min
|
||||||
|
= render 'setting_row', var: :directo_monthly_number_max
|
||||||
|
= render 'setting_row', var: :directo_monthly_number_last
|
||||||
= render 'setting_row', var: :days_to_keep_invoices_active
|
= render 'setting_row', var: :days_to_keep_invoices_active
|
||||||
= render 'setting_row', var: :days_to_keep_overdue_invoices_active
|
= render 'setting_row', var: :days_to_keep_overdue_invoices_active
|
||||||
= render 'setting_row', var: :minimum_deposit
|
= render 'setting_row', var: :minimum_deposit
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
%li= link_to t(:pricelists), admin_pricelists_path
|
%li= link_to t(:pricelists), admin_pricelists_path
|
||||||
%li= link_to t(:bank_statements), admin_bank_statements_path
|
%li= link_to t(:bank_statements), admin_bank_statements_path
|
||||||
%li= link_to t(:invoices), admin_invoices_path
|
%li= link_to t(:invoices), admin_invoices_path
|
||||||
%li= link_to t(:account_activities), admin_account_activities_path
|
%li= link_to t(:account_activities), admin_account_activities_path(created_after: 'today')
|
||||||
%li.divider
|
%li.divider
|
||||||
%li.dropdown-header= t(:archive)
|
%li.dropdown-header= t(:archive)
|
||||||
%li= link_to t(:domains_history), admin_domain_versions_path
|
%li= link_to t(:domains_history), admin_domain_versions_path
|
||||||
|
@ -68,8 +68,8 @@
|
||||||
%li= link_to t(:reserved_domains), admin_reserved_domains_path
|
%li= link_to t(:reserved_domains), admin_reserved_domains_path
|
||||||
%li= link_to t(:mail_templates), admin_mail_templates_path
|
%li= link_to t(:mail_templates), admin_mail_templates_path
|
||||||
-# %li= link_to t(:domains_history), admin_domain_versions_path
|
-# %li= link_to t(:domains_history), admin_domain_versions_path
|
||||||
%li= link_to t(:epp_logs), admin_epp_logs_path
|
%li= link_to t(:epp_logs), admin_epp_logs_path(created_after: 'today')
|
||||||
%li= link_to t(:repp_logs), admin_repp_logs_path
|
%li= link_to t(:repp_logs), admin_repp_logs_path(created_after: 'today')
|
||||||
%li= link_to t(:que), '/admin/que'
|
%li= link_to t(:que), '/admin/que'
|
||||||
|
|
||||||
- if signed_in?
|
- if signed_in?
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
Tere <%= @contact.name %>
|
Tere <%= @contact.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Kontakti <%= @contact.name %> eposti aadress on muudetud<br>
|
Kontakti <%= @contact.name %> e-posti aadress on muudetud<br>
|
||||||
endine aadress: <%= @old_email %><br>
|
endine aadress: <%= @old_email %><br>
|
||||||
uus aadress: <%= @contact.email %>
|
uus aadress: <%= @contact.email %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
E-posti aadressile saadetakse domeeni toimingutega seotud infot, seal hulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
<% if @contact.related_domain_descriptions.present? %>
|
<% if @contact.related_domain_descriptions.present? %>
|
||||||
Muudatusega seotud domeenid:<br>
|
Muudatusega seotud domeenid:<br>
|
||||||
|
@ -16,7 +16,7 @@ Muudatusega seotud domeenid:<br>
|
||||||
Kontaktandmed:<br>
|
Kontaktandmed:<br>
|
||||||
Nimi: <%= @contact.name %><br>
|
Nimi: <%= @contact.name %><br>
|
||||||
Isikukood: <%= @contact.ident %><br>
|
Isikukood: <%= @contact.ident %><br>
|
||||||
Epost: <%= @contact.email %><br>
|
E-post: <%= @contact.email %><br>
|
||||||
Tel: <%= @contact.phone %><br>
|
Tel: <%= @contact.phone %><br>
|
||||||
Tänav: <%= @contact.street %><br>
|
Tänav: <%= @contact.street %><br>
|
||||||
Linn: <%= @contact.city %><br>
|
Linn: <%= @contact.city %><br>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
Tere <%= @contact.name %>
|
Tere <%= @contact.name %>
|
||||||
|
|
||||||
Kontakti <%= @contact.name %> eposti aadress on muudetud
|
Kontakti <%= @contact.name %> e-posti aadress on muudetud
|
||||||
endine aadress: <%= @old_email %>
|
endine aadress: <%= @old_email %>
|
||||||
uus aadress: <%= @contact.email %>
|
uus aadress: <%= @contact.email %>
|
||||||
|
|
||||||
Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
E-posti aadressile saadetakse domeeni toimingutega seotud infot, seal hulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
||||||
|
|
||||||
<% if @contact.related_domain_descriptions.present? %>
|
<% if @contact.related_domain_descriptions.present? %>
|
||||||
Muudatusega seotud domeenid:
|
Muudatusega seotud domeenid:
|
||||||
|
@ -16,7 +16,7 @@ Muudatusega seotud domeenid:
|
||||||
Kontaktandmed:
|
Kontaktandmed:
|
||||||
Nimi: <%= @contact.name %>
|
Nimi: <%= @contact.name %>
|
||||||
Isikukood: <%= @contact.ident %>
|
Isikukood: <%= @contact.ident %>
|
||||||
Epost: <%= @contact.email %>
|
E-post: <%= @contact.email %>
|
||||||
Tel: <%= @contact.phone %>
|
Tel: <%= @contact.phone %>
|
||||||
Tänav: <%= @contact.street %>
|
Tänav: <%= @contact.street %>
|
||||||
Linn: <%= @contact.city %>
|
Linn: <%= @contact.city %>
|
||||||
|
|
|
@ -15,9 +15,9 @@ Tänav: <%= @params[:registrant_street] %><br>
|
||||||
Linn: <%= @params[:registrant_city] %><br>
|
Linn: <%= @params[:registrant_city] %><br>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @params[:registrant_country] %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiaks lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @params[:old_registrant_name] %> omanikuvahetuse tähtaegselt kinnitab.
|
Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiakse lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @params[:old_registrant_name] %> omanikuvahetuse tähtaegselt kinnitab.
|
||||||
<br><br>
|
<br><br>
|
||||||
Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahtuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse.
|
Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahetuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse.
|
||||||
<br><br>
|
<br><br>
|
||||||
Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
|
Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
|
@ -15,9 +15,9 @@ Tänav: <%= @params[:registrant_street] %>
|
||||||
Linn: <%= @params[:registrant_city] %>
|
Linn: <%= @params[:registrant_city] %>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @params[:registrant_country] %>
|
||||||
|
|
||||||
Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiaks lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @params[:old_registrant_name] %> omanikuvahetuse tähtaegselt kinnitab.
|
Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiakse lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @params[:old_registrant_name] %> omanikuvahetuse tähtaegselt kinnitab.
|
||||||
|
|
||||||
Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahtuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse.
|
Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahetuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse.
|
||||||
|
|
||||||
Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
|
Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
Tere,
|
Tere,
|
||||||
<br><br>
|
<br><br>
|
||||||
Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
||||||
<br><br>
|
<br><br>
|
||||||
Uue registreerija andmed:<br>
|
Uue registreerija andmed:<br>
|
||||||
Nimi: <%= @params[:registrant_name] %><br>
|
Nimi: <%= @new_registrant.name %><br>
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Isikukood: <%= @params[:registrant_ident] %><br>
|
Isikukood: <%= @new_registrant.ident %><br>
|
||||||
<% else %>
|
<% else %>
|
||||||
Äriregistrikood: <%= @params[:registrant_ident] %><br>
|
Äriregistrikood: <%= @new_registrant.ident %><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
Epost: <%= @params[:registrant_email] %><br>
|
Epost: <%= @new_registrant.email %><br>
|
||||||
Tänav: <%= @params[:registrant_street] %><br>
|
Tänav: <%= @new_registrant.street %><br>
|
||||||
Linn: <%= @params[:registrant_city] %><br>
|
Linn: <%= @new_registrant.city %><br>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @new_registrant.country.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Lugupidamisega<br>
|
Lugupidamisega<br>
|
||||||
Eesti Interneti SA
|
Eesti Interneti SA
|
||||||
|
@ -21,19 +21,19 @@ Eesti Interneti SA
|
||||||
<br><br>
|
<br><br>
|
||||||
Hi,
|
Hi,
|
||||||
<br><br>
|
<br><br>
|
||||||
Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated.
|
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
|
||||||
<br><br>
|
<br><br>
|
||||||
New registrant:<br>
|
New registrant:<br>
|
||||||
Name: <%= @params[:registrant_name] %><br>
|
Name: <%= @new_registrant.name %><br>
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Personal code: <%= @params[:registrant_ident] %><br>
|
Personal code: <%= @new_registrant.ident %><br>
|
||||||
<% else %>
|
<% else %>
|
||||||
Business Registry code: <%= @params[:registrant_ident] %><br>
|
Business Registry code: <%= @new_registrant.ident %><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
E-mail: <%= @params[:registrant_email] %><br>
|
E-mail: <%= @new_registrant.email %><br>
|
||||||
Street: <%= @params[:registrant_street] %><br>
|
Street: <%= @new_registrant.street %><br>
|
||||||
City: <%= @params[:registrant_city] %><br>
|
City: <%= @new_registrant.city %><br>
|
||||||
Country: <%= @params[:registrant_country] %>
|
Country: <%= @new_registrant.country.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Best Regards,<br>
|
Best Regards,<br>
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
Tere,
|
Tere,
|
||||||
|
|
||||||
Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
||||||
|
|
||||||
Uue registreerija andmed:
|
Uue registreerija andmed:
|
||||||
Nimi: <%= @params[:registrant_name] %>
|
Nimi: <%= @new_registrant.name %>
|
||||||
<% if @params[:registrant_priv] %>
|
|
||||||
Isikukood: <%= @params[:registrant_ident] %>
|
<% if @new_registrant.priv? %>
|
||||||
|
Isikukood: <%= @new_registrant.ident %>
|
||||||
<% else %>
|
<% else %>
|
||||||
Äriregistrikood: <%= @params[:registrant_ident] %>
|
Äriregistrikood: <%= @new_registrant.ident %>
|
||||||
<% end %>
|
<% end %>
|
||||||
Epost: <%= @params[:registrant_email] %>
|
Epost: <%= @new_registrant.email %>
|
||||||
Tänav: <%= @params[:registrant_street] %>
|
Tänav: <%= @new_registrant.street %>
|
||||||
Linn: <%= @params[:registrant_city] %>
|
Linn: <%= @new_registrant.city %>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @new_registrant.country.name %>
|
||||||
|
|
||||||
Lugupidamisega
|
Lugupidamisega
|
||||||
Eesti Interneti SA
|
Eesti Interneti SA
|
||||||
|
@ -21,19 +22,20 @@ Eesti Interneti SA
|
||||||
|
|
||||||
Hi,
|
Hi,
|
||||||
|
|
||||||
Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated.
|
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
|
||||||
|
|
||||||
New registrant:
|
New registrant:
|
||||||
Name: <%= @params[:registrant_name] %>
|
Name: <%= @new_registrant.name %>
|
||||||
<% if @params[:registrant_priv] %>
|
|
||||||
Personal code: <%= @params[:registrant_ident] %>
|
<% if @new_registrant.priv? %>
|
||||||
|
Personal code: <%= @new_registrant.ident %>
|
||||||
<% else %>
|
<% else %>
|
||||||
Business Registry code: <%= @params[:registrant_ident] %>
|
Business Registry code: <%= @new_registrant.ident %>
|
||||||
<% end %>
|
<% end %>
|
||||||
E-mail: <%= @params[:registrant_email] %>
|
E-mail: <%= @new_registrant.email %>
|
||||||
Street: <%= @params[:registrant_street] %>
|
Street: <%= @new_registrant.street %>
|
||||||
City: <%= @params[:registrant_city] %>
|
City: <%= @new_registrant.city %>
|
||||||
Country: <%= @params[:registrant_country] %>
|
Country: <%= @new_registrant.country.name %>
|
||||||
|
|
||||||
Best Regards,
|
Best Regards,
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
Tere,
|
Tere,
|
||||||
<br><br>
|
<br><br>
|
||||||
Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
||||||
<br><br>
|
<br><br>
|
||||||
Uue registreerija andmed:<br>
|
Uue registreerija andmed:<br>
|
||||||
Nimi: <%= @params[:new_registrant_name] %><br>
|
Nimi: <%= @new_registrant.name %><br>
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Isikukood: <%= @params[:registrant_ident] %><br>
|
Isikukood: <%= @new_registrant.ident %><br>
|
||||||
<% else %>
|
<% else %>
|
||||||
Äriregistrikood: <%= @params[:registrant_ident] %><br>
|
Äriregistrikood: <%= @new_registrant.ident %><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
Epost: <%= @params[:registrant_email] %><br>
|
Epost: <%= @new_registrant.email %><br>
|
||||||
Tänav: <%= @params[:registrant_street] %><br>
|
Tänav: <%= @new_registrant.street %><br>
|
||||||
Linn: <%= @params[:registrant_city] %><br>
|
Linn: <%= @new_registrant.city %><br>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @new_registrant.country.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Lugupidamisega<br>
|
Lugupidamisega<br>
|
||||||
Eesti Interneti SA
|
Eesti Interneti SA
|
||||||
|
@ -21,19 +21,19 @@ Eesti Interneti SA
|
||||||
<br><br>
|
<br><br>
|
||||||
Hi,
|
Hi,
|
||||||
<br><br>
|
<br><br>
|
||||||
Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated.
|
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
|
||||||
<br><br>
|
<br><br>
|
||||||
New registrant:<br>
|
New registrant:<br>
|
||||||
Name: <%= @params[:new_registrant_name] %><br>
|
Name: <%= @new_registrant.name %><br>
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Personal code: <%= @params[:registrant_ident] %><br>
|
Personal code: <%= @new_registrant.ident %><br>
|
||||||
<% else %>
|
<% else %>
|
||||||
Business Registry code: <%= @params[:registrant_ident] %><br>
|
Business Registry code: <%= @new_registrant.ident %><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
E-mail: <%= @params[:registrant_email] %><br>
|
E-mail: <%= @new_registrant.email %><br>
|
||||||
Street: <%= @params[:registrant_street] %><br>
|
Street: <%= @new_registrant.street %><br>
|
||||||
City: <%= @params[:registrant_city] %><br>
|
City: <%= @new_registrant.city %><br>
|
||||||
Country: <%= @params[:registrant_country] %>
|
Country: <%= @new_registrant.country.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Best Regards,<br>
|
Best Regards,<br>
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
Tere,
|
Tere,
|
||||||
|
|
||||||
Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
||||||
|
|
||||||
Uue registreerija andmed:
|
Uue registreerija andmed:
|
||||||
Nimi: <%= @params[:new_registrant_name] %>
|
Nimi: <%= @new_registrant.name %>
|
||||||
|
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Isikukood: <%= @params[:registrant_ident] %>
|
Isikukood: <%= @new_registrant.ident %>
|
||||||
<% else %>
|
<% else %>
|
||||||
Äriregistrikood: <%= @params[:registrant_ident] %>
|
Äriregistrikood: <%= @new_registrant.ident %>
|
||||||
<% end %>
|
<% end %>
|
||||||
Epost: <%= @params[:registrant_email] %>
|
Epost: <%= @new_registrant.email %>
|
||||||
Tänav: <%= @params[:registrant_street] %>
|
Tänav: <%= @new_registrant.street %>
|
||||||
Linn: <%= @params[:registrant_city] %>
|
Linn: <%= @new_registrant.city %>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @new_registrant.country.name %>
|
||||||
|
|
||||||
Lugupidamisega
|
Lugupidamisega
|
||||||
Eesti Interneti SA
|
Eesti Interneti SA
|
||||||
|
@ -22,20 +22,20 @@ Eesti Interneti SA
|
||||||
|
|
||||||
Hi,
|
Hi,
|
||||||
|
|
||||||
Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated.
|
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
|
||||||
|
|
||||||
New registrant:
|
New registrant:
|
||||||
Name: <%= @params[:new_registrant_name] %>
|
Name: <%= @new_registrant.name %>
|
||||||
|
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Personal code: <%= @params[:registrant_ident] %>
|
Personal code: <%= @new_registrant.ident %>
|
||||||
<% else %>
|
<% else %>
|
||||||
Business Registry code: <%= @params[:registrant_ident] %>
|
Business Registry code: <%= @new_registrant.ident %>
|
||||||
<% end %>
|
<% end %>
|
||||||
E-mail: <%= @params[:registrant_email] %>
|
E-mail: <%= @new_registrant.email %>
|
||||||
Street: <%= @params[:registrant_street] %>
|
Street: <%= @new_registrant.street %>
|
||||||
City: <%= @params[:registrant_city] %>
|
City: <%= @new_registrant.city %>
|
||||||
Country: <%= @params[:registrant_country] %>
|
Country: <%= @new_registrant.country.name %>
|
||||||
|
|
||||||
Best Regards,
|
Best Regards,
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
||||||
|
|
|
@ -6,10 +6,12 @@
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{class: 'col-xs-4'}= t(:type)
|
%th{class: 'col-xs-4'}= t(:type)
|
||||||
%th{class: 'col-xs-8'}= t(:id)
|
%th{class: 'col-xs-4'}= t(:name)
|
||||||
|
%th{class: 'col-xs-4'}= t(:id)
|
||||||
%tbody
|
%tbody
|
||||||
- @data.css('contact').each do |x|
|
- @data.css('contact').each do |x|
|
||||||
|
- registrant = Contact.find_by_code(x.text)
|
||||||
%tr
|
%tr
|
||||||
%td= x['type']
|
%td= x['type']
|
||||||
|
%td= registrant.name
|
||||||
%td= x.text
|
%td= x.text
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
%dt= t(:registrar)
|
%dt= t(:registrar)
|
||||||
%dd= @data.css('clID').text
|
%dd= @data.css('clID').text
|
||||||
|
|
||||||
|
- registrant = Contact.find_by_code(@data.css('registrant').text)
|
||||||
%dt= t(:registrant)
|
%dt= t(:registrant)
|
||||||
%dd= @data.css('registrant').text
|
%dd= "#{registrant.name} (#{@data.css('registrant').text})"
|
||||||
|
|
||||||
%dt= t(:registered)
|
%dt= t(:registered)
|
||||||
%dd= @data.css('crDate').text
|
%dd= @data.css('crDate').text
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
.row
|
.row
|
||||||
.col-sm-6
|
.col-sm-6
|
||||||
%h1.text-center-xs
|
%h1.text-center-xs
|
||||||
= truncate(name, length: 35)
|
= content_for?(:page_name) ? yield(:page_name) : truncate(name, length: 35)
|
||||||
.col-sm-6
|
.col-sm-6
|
||||||
%h1.text-right.text-center-xs
|
%h1.text-right.text-center-xs
|
||||||
= yield :actions
|
= yield :actions
|
||||||
|
|
|
@ -32,6 +32,9 @@ if con.present? && con.table_exists?('settings')
|
||||||
|
|
||||||
Setting.save_default(:invoice_number_min, 131050)
|
Setting.save_default(:invoice_number_min, 131050)
|
||||||
Setting.save_default(:invoice_number_max, 149999)
|
Setting.save_default(:invoice_number_max, 149999)
|
||||||
|
Setting.save_default(:directo_monthly_number_min, 309901)
|
||||||
|
Setting.save_default(:directo_monthly_number_max, 309999)
|
||||||
|
Setting.save_default(:directo_monthly_number_last, 309901)
|
||||||
Setting.save_default(:days_to_keep_invoices_active, 30)
|
Setting.save_default(:days_to_keep_invoices_active, 30)
|
||||||
Setting.save_default(:days_to_keep_overdue_invoices_active, 30)
|
Setting.save_default(:days_to_keep_overdue_invoices_active, 30)
|
||||||
Setting.save_default(:minimum_deposit, 0.0)
|
Setting.save_default(:minimum_deposit, 0.0)
|
||||||
|
|
|
@ -77,6 +77,7 @@ en:
|
||||||
registrant:
|
registrant:
|
||||||
blank: 'Registrant is missing'
|
blank: 'Registrant is missing'
|
||||||
not_found: 'Registrant not found'
|
not_found: 'Registrant not found'
|
||||||
|
cannot_be_missing: 'Parameter value policy error: registrant cannot be missing'
|
||||||
domain_contacts:
|
domain_contacts:
|
||||||
invalid: 'Contacts are invalid'
|
invalid: 'Contacts are invalid'
|
||||||
not_found: 'Contact was not found'
|
not_found: 'Contact was not found'
|
||||||
|
@ -206,6 +207,10 @@ en:
|
||||||
blank: 'Algorithm is missing'
|
blank: 'Algorithm is missing'
|
||||||
auth_info_pw:
|
auth_info_pw:
|
||||||
blank: 'Password is missing'
|
blank: 'Password is missing'
|
||||||
|
legal_document:
|
||||||
|
attributes:
|
||||||
|
body:
|
||||||
|
length: 'Parameter value policy error: legalDocument size should be more than 3kB'
|
||||||
|
|
||||||
|
|
||||||
attributes:
|
attributes:
|
||||||
|
@ -355,6 +360,7 @@ en:
|
||||||
contact: 'Contact'
|
contact: 'Contact'
|
||||||
credit_balance: 'Credit balance'
|
credit_balance: 'Credit balance'
|
||||||
starting_balance: 'Starting balance'
|
starting_balance: 'Starting balance'
|
||||||
|
destroyed: 'Destroyed'
|
||||||
|
|
||||||
domain_transfer_requested: 'Domain transfer requested!'
|
domain_transfer_requested: 'Domain transfer requested!'
|
||||||
domain_transfer_approved: 'Domain transfer approved!'
|
domain_transfer_approved: 'Domain transfer approved!'
|
||||||
|
@ -821,16 +827,20 @@ en:
|
||||||
domain_registrant_change_confirmed_body: 'You have successfully submitted domain registrant change confirmation. You will receive email confirmation.'
|
domain_registrant_change_confirmed_body: 'You have successfully submitted domain registrant change confirmation. You will receive email confirmation.'
|
||||||
registrant_domain_verification_confirmed: 'Domain registrant change has successfully received.'
|
registrant_domain_verification_confirmed: 'Domain registrant change has successfully received.'
|
||||||
registrant_domain_verification_confirmed_failed: 'Something went wrong.'
|
registrant_domain_verification_confirmed_failed: 'Something went wrong.'
|
||||||
domain_registrant_change_rejected_title: 'Domain registrant change has been rejected'
|
domain_registrant_change_rejected_title: 'Domain registrant change rejection has been received'
|
||||||
domain_registrant_change_rejected_body: 'You have rejected domain registrant change.'
|
domain_registrant_change_rejected_body: 'You have rejected domain registrant change. You will receive confirmation by email.'
|
||||||
registrant_domain_verification_rejected: 'Domain registrant change has been rejected successfully.'
|
registrant_domain_verification_rejected: 'Domain registrant change has been rejected successfully.'
|
||||||
registrant_domain_verification_rejected_failed: 'Something went wrong.'
|
registrant_domain_verification_rejected_failed: 'Something went wrong.'
|
||||||
domain_delete_title: 'Please confirm or reject domain deletation'
|
domain_delete_title: 'Please confirm or reject domain deletion'
|
||||||
domain_delete_body: 'There is a request to delete a domain. Before doing it we need your confirmation.'
|
domain_delete_body: 'There is a request to delete a domain. Before doing it we need your confirmation.'
|
||||||
|
registrant_domain_delete_confirmed: 'Setting the domain up for deletion...'
|
||||||
|
registrant_domain_delete_confirmed_failed: 'Something went wrong.'
|
||||||
domain_delete_confirmed_title: 'Domain deletion has been received successfully'
|
domain_delete_confirmed_title: 'Domain deletion has been received successfully'
|
||||||
domain_delete_confirmed_body: 'You have successfully submitted delete confirmation. You will receive registry final confirmation to email.'
|
domain_delete_confirmed_body: 'You have successfully submitted delete confirmation. You will receive registry final confirmation to email.'
|
||||||
domain_delete_rejected_title: 'Domain deletion has been rejected successfully'
|
registrant_domain_delete_rejected: 'Rejecting the domain deletion...'
|
||||||
domain_delete_rejected_body: 'You have rejected domain deletion.'
|
registrant_domain_delete_rejected_failed: 'Something went wrong.'
|
||||||
|
domain_delete_rejected_title: 'Domain deletion rejection has been received successfully'
|
||||||
|
domain_delete_rejected_body: 'You have rejected pending domain deletion. You will receive confirmation by email.'
|
||||||
no_permission: 'No permission'
|
no_permission: 'No permission'
|
||||||
access_denied: 'Access denied'
|
access_denied: 'Access denied'
|
||||||
common_name: 'Common name'
|
common_name: 'Common name'
|
||||||
|
@ -941,3 +951,4 @@ en:
|
||||||
add_blocked_domain: 'Add domain to blocked list'
|
add_blocked_domain: 'Add domain to blocked list'
|
||||||
edit_pw: 'Edit Pw'
|
edit_pw: 'Edit Pw'
|
||||||
optional: 'Optional'
|
optional: 'Optional'
|
||||||
|
test_registrar: "Test registrar"
|
||||||
|
|
5
db/migrate/20160225113801_add_up_id_value_to_domain.rb
Normal file
5
db/migrate/20160225113801_add_up_id_value_to_domain.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddUpIdValueToDomain < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :domains, :upid, :integer
|
||||||
|
end
|
||||||
|
end
|
5
db/migrate/20160225113812_add_up_id_value_to_contact.rb
Normal file
5
db/migrate/20160225113812_add_up_id_value_to_contact.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddUpIdValueToContact < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :contacts, :upid, :integer
|
||||||
|
end
|
||||||
|
end
|
5
db/migrate/20160226132045_add_up_date_value_to_domain.rb
Normal file
5
db/migrate/20160226132045_add_up_date_value_to_domain.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddUpDateValueToDomain < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :domains, :up_date, :timestamp
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddUpDateValueToContact < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :contacts, :up_date, :timestamp
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddInvoiceNumberToDirecto < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :directos, :invoice_number, :string
|
||||||
|
execute "UPDATE directos d SET invoice_number=i.number FROM invoices i WHERE d.item_type='Invoice' AND d.item_id=i.id"
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddTestRegistrarToRegistrar < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :registrars, :test_registrar, :boolean, default: false
|
||||||
|
end
|
||||||
|
end
|
5
db/migrate/20160405131315_add_request_to_directo.rb
Normal file
5
db/migrate/20160405131315_add_request_to_directo.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddRequestToDirecto < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :directos, :request, :text
|
||||||
|
end
|
||||||
|
end
|
15
db/migrate/20160411140719_add_matching_column.rb
Normal file
15
db/migrate/20160411140719_add_matching_column.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
class AddMatchingColumn < ActiveRecord::Migration
|
||||||
|
|
||||||
|
def change
|
||||||
|
tables = [:log_account_activities, :log_accounts, :log_addresses, :log_api_users, :log_bank_statements,
|
||||||
|
:log_bank_transactions, :log_blocked_domains, :log_certificates, :log_contact_statuses, :log_contacts,
|
||||||
|
:log_countries, :log_dnskeys, :log_domain_contacts, :log_domain_statuses, :log_domain_transfers,
|
||||||
|
:log_domains, :log_invoice_items, :log_invoices, :log_keyrelays, :log_messages, :log_nameservers,
|
||||||
|
:log_pricelists, :log_registrars, :log_reserved_domains, :log_settings, :log_users, :log_white_ips,
|
||||||
|
:log_zonefile_settings]
|
||||||
|
|
||||||
|
tables.each do |table|
|
||||||
|
add_column table, :uuid, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddTimeIndexingToEppLog < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
ApiLog::EppLog.connection.execute( "CREATE INDEX CONCURRENTLY epp_logs_created_at ON epp_logs USING btree (extract(epoch from created_at));")
|
||||||
|
ApiLog::ReppLog.connection.execute("CREATE INDEX CONCURRENTLY repp_logs_created_at ON repp_logs USING btree (extract(epoch from created_at));")
|
||||||
|
end
|
||||||
|
end
|
9
db/migrate/20160421074023_add_log_matching_column.rb
Normal file
9
db/migrate/20160421074023_add_log_matching_column.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
class AddLogMatchingColumn < ActiveRecord::Migration
|
||||||
|
|
||||||
|
def change
|
||||||
|
|
||||||
|
ApiLog::EppLog.connection.execute("ALTER TABLE epp_logs ADD COLUMN uuid varchar;")
|
||||||
|
ApiLog::ReppLog.connection.execute("ALTER TABLE repp_logs ADD COLUMN uuid varchar;")
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,11 +11,12 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160108135436) do
|
ActiveRecord::Schema.define(version: 20160304125933) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
enable_extension "hstore"
|
enable_extension "hstore"
|
||||||
|
enable_extension "btree_gist"
|
||||||
|
|
||||||
create_table "account_activities", force: :cascade do |t|
|
create_table "account_activities", force: :cascade do |t|
|
||||||
t.integer "account_id"
|
t.integer "account_id"
|
||||||
|
@ -108,6 +109,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "creator_str"
|
t.string "creator_str"
|
||||||
t.string "updator_str"
|
t.string "updator_str"
|
||||||
|
t.boolean "in_directo", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "banklink_transactions", force: :cascade do |t|
|
create_table "banklink_transactions", force: :cascade do |t|
|
||||||
|
@ -144,6 +146,17 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
|
|
||||||
add_index "blocked_domains", ["name"], name: "index_blocked_domains_on_name", using: :btree
|
add_index "blocked_domains", ["name"], name: "index_blocked_domains_on_name", using: :btree
|
||||||
|
|
||||||
|
create_table "business_registry_caches", force: :cascade do |t|
|
||||||
|
t.string "ident"
|
||||||
|
t.string "ident_country_code"
|
||||||
|
t.datetime "retrieved_on"
|
||||||
|
t.string "associated_businesses", array: true
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "business_registry_caches", ["ident"], name: "index_business_registry_caches_on_ident", using: :btree
|
||||||
|
|
||||||
create_table "cached_nameservers", id: false, force: :cascade do |t|
|
create_table "cached_nameservers", id: false, force: :cascade do |t|
|
||||||
t.string "hostname", limit: 255
|
t.string "hostname", limit: 255
|
||||||
t.string "ipv4", limit: 255
|
t.string "ipv4", limit: 255
|
||||||
|
@ -241,6 +254,17 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "directos", force: :cascade do |t|
|
||||||
|
t.integer "item_id"
|
||||||
|
t.string "item_type"
|
||||||
|
t.json "response"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.string "invoice_number"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "directos", ["item_type", "item_id"], name: "index_directos_on_item_type_and_item_id", using: :btree
|
||||||
|
|
||||||
create_table "dnskeys", force: :cascade do |t|
|
create_table "dnskeys", force: :cascade do |t|
|
||||||
t.integer "domain_id"
|
t.integer "domain_id"
|
||||||
t.integer "flags"
|
t.integer "flags"
|
||||||
|
@ -345,6 +369,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
add_index "domains", ["registrant_verification_asked_at"], name: "index_domains_on_registrant_verification_asked_at", using: :btree
|
add_index "domains", ["registrant_verification_asked_at"], name: "index_domains_on_registrant_verification_asked_at", using: :btree
|
||||||
add_index "domains", ["registrant_verification_token"], name: "index_domains_on_registrant_verification_token", using: :btree
|
add_index "domains", ["registrant_verification_token"], name: "index_domains_on_registrant_verification_token", using: :btree
|
||||||
add_index "domains", ["registrar_id"], name: "index_domains_on_registrar_id", using: :btree
|
add_index "domains", ["registrar_id"], name: "index_domains_on_registrar_id", using: :btree
|
||||||
|
add_index "domains", ["statuses"], name: "index_domains_on_statuses", using: :gin
|
||||||
|
|
||||||
create_table "epp_sessions", force: :cascade do |t|
|
create_table "epp_sessions", force: :cascade do |t|
|
||||||
t.string "session_id"
|
t.string "session_id"
|
||||||
|
@ -372,20 +397,20 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
add_index "invoice_items", ["invoice_id"], name: "index_invoice_items_on_invoice_id", using: :btree
|
add_index "invoice_items", ["invoice_id"], name: "index_invoice_items_on_invoice_id", using: :btree
|
||||||
|
|
||||||
create_table "invoices", force: :cascade do |t|
|
create_table "invoices", force: :cascade do |t|
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.string "invoice_type", null: false
|
t.string "invoice_type", null: false
|
||||||
t.datetime "due_date", null: false
|
t.datetime "due_date", null: false
|
||||||
t.string "payment_term"
|
t.string "payment_term"
|
||||||
t.string "currency", null: false
|
t.string "currency", null: false
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.string "reference_no"
|
t.string "reference_no"
|
||||||
t.decimal "vat_prc", precision: 10, scale: 2, null: false
|
t.decimal "vat_prc", precision: 10, scale: 2, null: false
|
||||||
t.datetime "paid_at"
|
t.datetime "paid_at"
|
||||||
t.integer "seller_id"
|
t.integer "seller_id"
|
||||||
t.string "seller_name", null: false
|
t.string "seller_name", null: false
|
||||||
t.string "seller_reg_no"
|
t.string "seller_reg_no"
|
||||||
t.string "seller_iban", null: false
|
t.string "seller_iban", null: false
|
||||||
t.string "seller_bank"
|
t.string "seller_bank"
|
||||||
t.string "seller_swift"
|
t.string "seller_swift"
|
||||||
t.string "seller_vat_no"
|
t.string "seller_vat_no"
|
||||||
|
@ -399,7 +424,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
t.string "seller_email"
|
t.string "seller_email"
|
||||||
t.string "seller_contact_name"
|
t.string "seller_contact_name"
|
||||||
t.integer "buyer_id"
|
t.integer "buyer_id"
|
||||||
t.string "buyer_name", null: false
|
t.string "buyer_name", null: false
|
||||||
t.string "buyer_reg_no"
|
t.string "buyer_reg_no"
|
||||||
t.string "buyer_country_code"
|
t.string "buyer_country_code"
|
||||||
t.string "buyer_state"
|
t.string "buyer_state"
|
||||||
|
@ -414,6 +439,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
t.integer "number"
|
t.integer "number"
|
||||||
t.datetime "cancelled_at"
|
t.datetime "cancelled_at"
|
||||||
t.decimal "sum_cache", precision: 10, scale: 2
|
t.decimal "sum_cache", precision: 10, scale: 2
|
||||||
|
t.boolean "in_directo", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "invoices", ["buyer_id"], name: "index_invoices_on_buyer_id", using: :btree
|
add_index "invoices", ["buyer_id"], name: "index_invoices_on_buyer_id", using: :btree
|
||||||
|
@ -592,7 +618,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
t.integer "item_id", null: false
|
t.integer "item_id", null: false
|
||||||
t.string "event", null: false
|
t.string "event", null: false
|
||||||
t.string "whodunnit"
|
t.string "whodunnit"
|
||||||
t.json "object"
|
t.jsonb "object"
|
||||||
t.json "object_changes"
|
t.json "object_changes"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.string "session"
|
t.string "session"
|
||||||
|
@ -623,7 +649,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
t.integer "item_id", null: false
|
t.integer "item_id", null: false
|
||||||
t.string "event", null: false
|
t.string "event", null: false
|
||||||
t.string "whodunnit"
|
t.string "whodunnit"
|
||||||
t.json "object"
|
t.jsonb "object"
|
||||||
t.json "object_changes"
|
t.json "object_changes"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.string "session"
|
t.string "session"
|
||||||
|
@ -683,7 +709,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
t.integer "item_id", null: false
|
t.integer "item_id", null: false
|
||||||
t.string "event", null: false
|
t.string "event", null: false
|
||||||
t.string "whodunnit"
|
t.string "whodunnit"
|
||||||
t.json "object"
|
t.jsonb "object"
|
||||||
t.json "object_changes"
|
t.json "object_changes"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.text "nameserver_ids", default: [], array: true
|
t.text "nameserver_ids", default: [], array: true
|
||||||
|
@ -761,7 +787,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
t.integer "item_id", null: false
|
t.integer "item_id", null: false
|
||||||
t.string "event", null: false
|
t.string "event", null: false
|
||||||
t.string "whodunnit"
|
t.string "whodunnit"
|
||||||
t.json "object"
|
t.jsonb "object"
|
||||||
t.json "object_changes"
|
t.json "object_changes"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.string "session"
|
t.string "session"
|
||||||
|
@ -897,10 +923,10 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
|
|
||||||
create_table "nameservers", force: :cascade do |t|
|
create_table "nameservers", force: :cascade do |t|
|
||||||
t.string "hostname"
|
t.string "hostname"
|
||||||
t.string "ipv4", default: [], array: true
|
t.string "ipv4", array: true
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "ipv6", default: [], array: true
|
t.string "ipv6", array: true
|
||||||
t.integer "domain_id"
|
t.integer "domain_id"
|
||||||
t.string "creator_str"
|
t.string "creator_str"
|
||||||
t.string "updator_str"
|
t.string "updator_str"
|
||||||
|
@ -992,6 +1018,7 @@ ActiveRecord::Schema.define(version: 20160108135436) do
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "registrars", ["code"], name: "index_registrars_on_code", using: :btree
|
add_index "registrars", ["code"], name: "index_registrars_on_code", using: :btree
|
||||||
|
add_index "registrars", ["legacy_id"], name: "index_registrars_on_legacy_id", using: :btree
|
||||||
|
|
||||||
create_table "reserved_domains", force: :cascade do |t|
|
create_table "reserved_domains", force: :cascade do |t|
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
|
|
422
db/structure.sql
422
db/structure.sql
|
@ -23,6 +23,20 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||||
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: hstore; Type: EXTENSION; Schema: -; Owner: -
|
-- Name: hstore; Type: EXTENSION; Schema: -; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -39,140 +53,6 @@ COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs
|
||||||
|
|
||||||
SET search_path = public, pg_catalog;
|
SET search_path = public, pg_catalog;
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: change_ident_country(); Type: FUNCTION; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE FUNCTION change_ident_country() RETURNS boolean
|
|
||||||
LANGUAGE plpgsql
|
|
||||||
AS $_$
|
|
||||||
DECLARE
|
|
||||||
changed BOOLEAN;
|
|
||||||
multiplier INT [];
|
|
||||||
multiplier2 INT [];
|
|
||||||
multiplier3 INT [];
|
|
||||||
multiplier4 INT [];
|
|
||||||
r RECORD;
|
|
||||||
control TEXT;
|
|
||||||
total INT;
|
|
||||||
i INT;
|
|
||||||
mod INT;
|
|
||||||
counter INT;
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
multiplier := ARRAY [1, 2, 3, 4, 5, 6, 7, 8, 9, 1];
|
|
||||||
|
|
||||||
multiplier2 := ARRAY [3, 4, 5, 6, 7, 8, 9, 1, 2, 3];
|
|
||||||
|
|
||||||
multiplier3 := ARRAY [1, 2, 3, 4, 5, 6, 7];
|
|
||||||
|
|
||||||
multiplier4 := ARRAY [3, 4, 5, 6, 7, 8, 9];
|
|
||||||
|
|
||||||
FOR r IN SELECT id, ident FROM contacts WHERE ident_type = 'priv' /*AND ident_country_code IS NULL*/
|
|
||||||
LOOP
|
|
||||||
IF (length(r.ident) = 11 AND (r.ident ~ '^[0-9]+$') AND (substring(r.ident, 1, 1) = '3' OR substring(r.ident, 1, 1) = '4' OR substring(r.ident, 1, 1) = '5' OR substring(r.ident, 1, 1) = '6'))
|
|
||||||
THEN
|
|
||||||
total := 0;
|
|
||||||
counter := 1;
|
|
||||||
FOREACH i IN ARRAY multiplier
|
|
||||||
LOOP
|
|
||||||
total := (total + (i * to_number(substring(r.ident, counter, 1), '9')));
|
|
||||||
counter := (counter + 1);
|
|
||||||
END LOOP;
|
|
||||||
mod := (total % 11);
|
|
||||||
counter := 1;
|
|
||||||
|
|
||||||
IF (mod >= 10)
|
|
||||||
THEN
|
|
||||||
total = 0;
|
|
||||||
FOREACH i IN ARRAY multiplier2
|
|
||||||
LOOP
|
|
||||||
total := (total + (i * to_number(substring(r.ident, counter, 1), '9')));
|
|
||||||
counter := (counter + 1);
|
|
||||||
END LOOP;
|
|
||||||
mod := (total % 11);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF (mod < 10 AND substring(r.ident, 11, 1) = to_char(mod, 'FM999MI'))
|
|
||||||
THEN
|
|
||||||
UPDATE contacts SET ident_country_code = 'EE' WHERE id = r.id;
|
|
||||||
END IF;
|
|
||||||
total = 0;
|
|
||||||
END IF;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
FOR r IN SELECT id, ident FROM contacts WHERE ident_type = 'org'
|
|
||||||
LOOP
|
|
||||||
IF (length(r.ident) = 8 AND (r.ident ~ '^[0-9]+$') AND (substring(r.ident, 1, 1) = '1' OR substring(r.ident, 1, 1) = '8' OR substring(r.ident, 1, 1) = '9'))
|
|
||||||
THEN
|
|
||||||
total := 0;
|
|
||||||
counter := 1;
|
|
||||||
FOREACH i IN ARRAY multiplier3
|
|
||||||
LOOP
|
|
||||||
total := (total + (i * to_number(substring(r.ident, counter, 1), '9')));
|
|
||||||
counter := (counter + 1);
|
|
||||||
END LOOP;
|
|
||||||
mod := total % 11;
|
|
||||||
total = 0;
|
|
||||||
counter := 1;
|
|
||||||
|
|
||||||
IF (mod >= 10)
|
|
||||||
THEN
|
|
||||||
total = 0;
|
|
||||||
FOREACH i IN ARRAY multiplier4
|
|
||||||
LOOP
|
|
||||||
total := (total + (i * to_number(substring(r.ident, counter, 1), '9')));
|
|
||||||
counter := (counter + 1);
|
|
||||||
END LOOP;
|
|
||||||
mod := (total % 11);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF (mod < 10 AND (substring(r.ident, 8, 1) = to_char(mod, 'FM999MI')))
|
|
||||||
THEN
|
|
||||||
UPDATE contacts SET ident_country_code = 'EE' WHERE id = r.id;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RETURN changed;
|
|
||||||
END;
|
|
||||||
$_$;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: change_ident_country(integer, text); Type: FUNCTION; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE FUNCTION change_ident_country(id integer, type text) RETURNS boolean
|
|
||||||
LANGUAGE plpgsql
|
|
||||||
AS $_$
|
|
||||||
DECLARE
|
|
||||||
changed BOOLEAN;
|
|
||||||
multiplier int[];
|
|
||||||
multiplier2 int[];
|
|
||||||
code int;
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
multiplier := ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 1];
|
|
||||||
|
|
||||||
multiplier2 := ARRAY[3, 4, 5, 6, 7, 8, 9, 1, 2, 3];
|
|
||||||
|
|
||||||
code := (SELECT code FROM contacts WHERE id = 208 AND ident_country_code = 'EE');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UPDATE contacts
|
|
||||||
SET ident = ''
|
|
||||||
WHERE id = $1 and ident_type = $2 AND ident_country_code = 'EE'
|
|
||||||
AND ident = '';
|
|
||||||
|
|
||||||
RETURN changed;
|
|
||||||
END;
|
|
||||||
$_$;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: fill_ident_country(); Type: FUNCTION; Schema: public; Owner: -
|
-- Name: fill_ident_country(); Type: FUNCTION; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -222,12 +102,10 @@ CREATE FUNCTION fill_ident_country() RETURNS boolean
|
||||||
END LOOP;
|
END LOOP;
|
||||||
mod := (total % 11);
|
mod := (total % 11);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF (mod = 10)
|
IF (mod = 10)
|
||||||
THEN
|
THEN
|
||||||
mod := 0;
|
mod := 0;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF (substring(r.ident, 11, 1) = to_char(mod, 'FM999MI'))
|
IF (substring(r.ident, 11, 1) = to_char(mod, 'FM999MI'))
|
||||||
THEN
|
THEN
|
||||||
UPDATE contacts SET ident_country_code = 'EE' WHERE id = r.id;
|
UPDATE contacts SET ident_country_code = 'EE' WHERE id = r.id;
|
||||||
|
@ -291,7 +169,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
||||||
ret text;
|
ret text;
|
||||||
BEGIN
|
BEGIN
|
||||||
-- define filters
|
-- define filters
|
||||||
include_filter = '%' || i_origin;
|
include_filter = '%.' || i_origin;
|
||||||
|
|
||||||
-- for %.%.%
|
-- for %.%.%
|
||||||
IF i_origin ~ '\.' THEN
|
IF i_origin ~ '\.' THEN
|
||||||
|
@ -318,6 +196,10 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
||||||
|
|
||||||
ret = concat(tmp_var, chr(10), chr(10));
|
ret = concat(tmp_var, chr(10), chr(10));
|
||||||
|
|
||||||
|
-- origin ns records
|
||||||
|
SELECT ns_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||||
|
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10));
|
||||||
|
|
||||||
-- ns records
|
-- ns records
|
||||||
SELECT array_to_string(
|
SELECT array_to_string(
|
||||||
array(
|
array(
|
||||||
|
@ -325,26 +207,17 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
||||||
FROM domains d
|
FROM domains d
|
||||||
JOIN nameservers ns ON ns.domain_id = d.id
|
JOIN nameservers ns ON ns.domain_id = d.id
|
||||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||||
|
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||||
ORDER BY d.name
|
ORDER BY d.name
|
||||||
),
|
),
|
||||||
chr(10)
|
chr(10)
|
||||||
) INTO tmp_var;
|
) INTO tmp_var;
|
||||||
|
|
||||||
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10), chr(10));
|
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||||
|
|
||||||
-- a glue records for origin nameservers
|
-- origin a glue records
|
||||||
SELECT array_to_string(
|
SELECT a_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||||
array(
|
ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
|
||||||
SELECT concat(ns.hostname, '. IN A ', ns.ipv4)
|
|
||||||
FROM nameservers ns
|
|
||||||
JOIN domains d ON d.id = ns.domain_id
|
|
||||||
WHERE d.name = i_origin
|
|
||||||
AND ns.hostname LIKE '%.' || d.name
|
|
||||||
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
|
|
||||||
), chr(10)
|
|
||||||
) INTO tmp_var;
|
|
||||||
|
|
||||||
ret := concat(ret, '; Zone A Records', chr(10), tmp_var);
|
|
||||||
|
|
||||||
-- a glue records for other nameservers
|
-- a glue records for other nameservers
|
||||||
SELECT array_to_string(
|
SELECT array_to_string(
|
||||||
|
@ -355,44 +228,16 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
||||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||||
AND ns.hostname LIKE '%.' || d.name
|
AND ns.hostname LIKE '%.' || d.name
|
||||||
AND d.name <> i_origin
|
AND d.name <> i_origin
|
||||||
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
|
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> '{}'
|
||||||
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods
|
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||||
SELECT 1 FROM nameservers nsi
|
|
||||||
JOIN domains di ON nsi.domain_id = di.id
|
|
||||||
WHERE di.name = i_origin
|
|
||||||
AND nsi.hostname = ns.hostname
|
|
||||||
)
|
|
||||||
), chr(10)
|
), chr(10)
|
||||||
) INTO tmp_var;
|
) INTO tmp_var;
|
||||||
|
|
||||||
-- TODO This is a possible subtitition to the previous query, stress testing is needed to see which is faster
|
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||||
|
|
||||||
-- SELECT ns.*
|
-- origin aaaa glue records
|
||||||
-- FROM nameservers ns
|
SELECT a4_records FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||||
-- JOIN domains d ON d.id = ns.domain_id
|
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
|
||||||
-- WHERE d.name LIKE '%ee' AND d.name NOT LIKE '%pri.ee'
|
|
||||||
-- AND ns.hostname LIKE '%.' || d.name
|
|
||||||
-- AND d.name <> 'ee'
|
|
||||||
-- AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
|
|
||||||
-- AND ns.hostname NOT IN (
|
|
||||||
-- SELECT ns.hostname FROM domains d JOIN nameservers ns ON d.id = ns.domain_id WHERE d.name = 'ee'
|
|
||||||
-- )
|
|
||||||
|
|
||||||
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10));
|
|
||||||
|
|
||||||
-- aaaa glue records for origin nameservers
|
|
||||||
SELECT array_to_string(
|
|
||||||
array(
|
|
||||||
SELECT concat(ns.hostname, '. IN AAAA ', ns.ipv6)
|
|
||||||
FROM nameservers ns
|
|
||||||
JOIN domains d ON d.id = ns.domain_id
|
|
||||||
WHERE d.name = i_origin
|
|
||||||
AND ns.hostname LIKE '%.' || d.name
|
|
||||||
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
|
|
||||||
), chr(10)
|
|
||||||
) INTO tmp_var;
|
|
||||||
|
|
||||||
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var);
|
|
||||||
|
|
||||||
-- aaaa glue records for other nameservers
|
-- aaaa glue records for other nameservers
|
||||||
SELECT array_to_string(
|
SELECT array_to_string(
|
||||||
|
@ -403,17 +248,12 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
||||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||||
AND ns.hostname LIKE '%.' || d.name
|
AND ns.hostname LIKE '%.' || d.name
|
||||||
AND d.name <> i_origin
|
AND d.name <> i_origin
|
||||||
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
|
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> '{}'
|
||||||
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods
|
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||||
SELECT 1 FROM nameservers nsi
|
|
||||||
JOIN domains di ON nsi.domain_id = di.id
|
|
||||||
WHERE di.name = i_origin
|
|
||||||
AND nsi.hostname = ns.hostname
|
|
||||||
)
|
|
||||||
), chr(10)
|
), chr(10)
|
||||||
) INTO tmp_var;
|
) INTO tmp_var;
|
||||||
|
|
||||||
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10));
|
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||||
|
|
||||||
-- ds records
|
-- ds records
|
||||||
SELECT array_to_string(
|
SELECT array_to_string(
|
||||||
|
@ -424,7 +264,8 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
||||||
)
|
)
|
||||||
FROM domains d
|
FROM domains d
|
||||||
JOIN dnskeys dk ON dk.domain_id = d.id
|
JOIN dnskeys dk ON dk.domain_id = d.id
|
||||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter AND dk.flags = 257
|
||||||
|
AND NOT ('{serverHold,clientHold}' && d.statuses)
|
||||||
),
|
),
|
||||||
chr(10)
|
chr(10)
|
||||||
) INTO tmp_var;
|
) INTO tmp_var;
|
||||||
|
@ -652,7 +493,8 @@ CREATE TABLE bank_transactions (
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone,
|
||||||
creator_str character varying,
|
creator_str character varying,
|
||||||
updator_str character varying
|
updator_str character varying,
|
||||||
|
in_directo boolean DEFAULT false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -757,6 +599,40 @@ CREATE SEQUENCE blocked_domains_id_seq
|
||||||
ALTER SEQUENCE blocked_domains_id_seq OWNED BY blocked_domains.id;
|
ALTER SEQUENCE blocked_domains_id_seq OWNED BY blocked_domains.id;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: business_registry_caches; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE business_registry_caches (
|
||||||
|
id integer NOT NULL,
|
||||||
|
ident character varying,
|
||||||
|
ident_country_code character varying,
|
||||||
|
retrieved_on timestamp without time zone,
|
||||||
|
associated_businesses character varying[],
|
||||||
|
created_at timestamp without time zone NOT NULL,
|
||||||
|
updated_at timestamp without time zone NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: business_registry_caches_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE business_registry_caches_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: business_registry_caches_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER SEQUENCE business_registry_caches_id_seq OWNED BY business_registry_caches.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: cached_nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: cached_nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -1000,6 +876,40 @@ CREATE SEQUENCE depricated_versions_id_seq
|
||||||
ALTER SEQUENCE depricated_versions_id_seq OWNED BY depricated_versions.id;
|
ALTER SEQUENCE depricated_versions_id_seq OWNED BY depricated_versions.id;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: directos; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE directos (
|
||||||
|
id integer NOT NULL,
|
||||||
|
item_id integer,
|
||||||
|
item_type character varying,
|
||||||
|
response json,
|
||||||
|
created_at timestamp without time zone NOT NULL,
|
||||||
|
updated_at timestamp without time zone NOT NULL,
|
||||||
|
invoice_number character varying
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: directos_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE directos_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: directos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER SEQUENCE directos_id_seq OWNED BY directos.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dnskeys; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: dnskeys; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -1328,7 +1238,8 @@ CREATE TABLE invoices (
|
||||||
updator_str character varying,
|
updator_str character varying,
|
||||||
number integer,
|
number integer,
|
||||||
cancelled_at timestamp without time zone,
|
cancelled_at timestamp without time zone,
|
||||||
sum_cache numeric(10,2)
|
sum_cache numeric(10,2),
|
||||||
|
in_directo boolean DEFAULT false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1771,7 +1682,7 @@ CREATE TABLE log_contacts (
|
||||||
item_id integer NOT NULL,
|
item_id integer NOT NULL,
|
||||||
event character varying NOT NULL,
|
event character varying NOT NULL,
|
||||||
whodunnit character varying,
|
whodunnit character varying,
|
||||||
object json,
|
object jsonb,
|
||||||
object_changes json,
|
object_changes json,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
session character varying,
|
session character varying,
|
||||||
|
@ -1846,7 +1757,7 @@ CREATE TABLE log_dnskeys (
|
||||||
item_id integer NOT NULL,
|
item_id integer NOT NULL,
|
||||||
event character varying NOT NULL,
|
event character varying NOT NULL,
|
||||||
whodunnit character varying,
|
whodunnit character varying,
|
||||||
object json,
|
object jsonb,
|
||||||
object_changes json,
|
object_changes json,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
session character varying,
|
session character varying,
|
||||||
|
@ -1994,7 +1905,7 @@ CREATE TABLE log_domains (
|
||||||
item_id integer NOT NULL,
|
item_id integer NOT NULL,
|
||||||
event character varying NOT NULL,
|
event character varying NOT NULL,
|
||||||
whodunnit character varying,
|
whodunnit character varying,
|
||||||
object json,
|
object jsonb,
|
||||||
object_changes json,
|
object_changes json,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
nameserver_ids text[] DEFAULT '{}'::text[],
|
nameserver_ids text[] DEFAULT '{}'::text[],
|
||||||
|
@ -2182,7 +2093,7 @@ CREATE TABLE log_nameservers (
|
||||||
item_id integer NOT NULL,
|
item_id integer NOT NULL,
|
||||||
event character varying NOT NULL,
|
event character varying NOT NULL,
|
||||||
whodunnit character varying,
|
whodunnit character varying,
|
||||||
object json,
|
object jsonb,
|
||||||
object_changes json,
|
object_changes json,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
session character varying,
|
session character varying,
|
||||||
|
@ -2548,10 +2459,10 @@ ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
|
||||||
CREATE TABLE nameservers (
|
CREATE TABLE nameservers (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
hostname character varying,
|
hostname character varying,
|
||||||
ipv4 character varying[] DEFAULT '{}'::character varying[],
|
ipv4 character varying[],
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone,
|
||||||
ipv6 character varying[] DEFAULT '{}'::character varying[],
|
ipv6 character varying[],
|
||||||
domain_id integer,
|
domain_id integer,
|
||||||
creator_str character varying,
|
creator_str character varying,
|
||||||
updator_str character varying,
|
updator_str character varying,
|
||||||
|
@ -3118,6 +3029,13 @@ ALTER TABLE ONLY banklink_transactions ALTER COLUMN id SET DEFAULT nextval('bank
|
||||||
ALTER TABLE ONLY blocked_domains ALTER COLUMN id SET DEFAULT nextval('blocked_domains_id_seq'::regclass);
|
ALTER TABLE ONLY blocked_domains ALTER COLUMN id SET DEFAULT nextval('blocked_domains_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY business_registry_caches ALTER COLUMN id SET DEFAULT nextval('business_registry_caches_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -3160,6 +3078,13 @@ ALTER TABLE ONLY delegation_signers ALTER COLUMN id SET DEFAULT nextval('delegat
|
||||||
ALTER TABLE ONLY depricated_versions ALTER COLUMN id SET DEFAULT nextval('depricated_versions_id_seq'::regclass);
|
ALTER TABLE ONLY depricated_versions ALTER COLUMN id SET DEFAULT nextval('depricated_versions_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY directos ALTER COLUMN id SET DEFAULT nextval('directos_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -3595,6 +3520,14 @@ ALTER TABLE ONLY blocked_domains
|
||||||
ADD CONSTRAINT blocked_domains_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT blocked_domains_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: business_registry_caches_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY business_registry_caches
|
||||||
|
ADD CONSTRAINT business_registry_caches_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -3643,6 +3576,14 @@ ALTER TABLE ONLY depricated_versions
|
||||||
ADD CONSTRAINT depricated_versions_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT depricated_versions_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: directos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY directos
|
||||||
|
ADD CONSTRAINT directos_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -4109,6 +4050,13 @@ CREATE INDEX index_api_users_on_registrar_id ON api_users USING btree (registrar
|
||||||
CREATE INDEX index_blocked_domains_on_name ON blocked_domains USING btree (name);
|
CREATE INDEX index_blocked_domains_on_name ON blocked_domains USING btree (name);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_business_registry_caches_on_ident; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_business_registry_caches_on_ident ON business_registry_caches USING btree (ident);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_cached_nameservers_on_hostname_and_ipv4_and_ipv6; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_cached_nameservers_on_hostname_and_ipv4_and_ipv6; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -4158,6 +4106,13 @@ CREATE INDEX index_contacts_on_registrar_id_and_ident_type ON contacts USING btr
|
||||||
CREATE INDEX index_delegation_signers_on_domain_id ON delegation_signers USING btree (domain_id);
|
CREATE INDEX index_delegation_signers_on_domain_id ON delegation_signers USING btree (domain_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_directos_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_directos_on_item_type_and_item_id ON directos USING btree (item_type, item_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_dnskeys_on_delegation_signer_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_dnskeys_on_delegation_signer_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -4256,6 +4211,13 @@ CREATE INDEX index_domains_on_registrant_verification_token ON domains USING btr
|
||||||
CREATE INDEX index_domains_on_registrar_id ON domains USING btree (registrar_id);
|
CREATE INDEX index_domains_on_registrar_id ON domains USING btree (registrar_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_domains_on_statuses; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_domains_on_statuses ON domains USING gin (statuses);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_epp_sessions_on_session_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_epp_sessions_on_session_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -4732,6 +4694,13 @@ CREATE INDEX index_registrant_verifications_on_domain_id ON registrant_verificat
|
||||||
CREATE INDEX index_registrars_on_code ON registrars USING btree (code);
|
CREATE INDEX index_registrars_on_code ON registrars USING btree (code);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_registrars_on_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_registrars_on_legacy_id ON registrars USING btree (legacy_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_reserved_domains_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_reserved_domains_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -4774,6 +4743,41 @@ CREATE INDEX index_whois_records_on_domain_id ON whois_records USING btree (doma
|
||||||
CREATE INDEX index_whois_records_on_registrar_id ON whois_records USING btree (registrar_id);
|
CREATE INDEX index_whois_records_on_registrar_id ON whois_records USING btree (registrar_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_contacts_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX log_contacts_object_legacy_id ON log_contacts USING btree ((((object ->> 'legacy_id'::text))::integer));
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_contacts_object_legacy_id1; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX log_contacts_object_legacy_id1 ON log_contacts USING btree ((((object ->> 'legacy_id'::text))::integer));
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_dnskeys_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX log_dnskeys_object_legacy_id ON log_contacts USING btree ((((object ->> 'legacy_domain_id'::text))::integer));
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_domains_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX log_domains_object_legacy_id ON log_contacts USING btree ((((object ->> 'legacy_id'::text))::integer));
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_nameservers_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX log_nameservers_object_legacy_id ON log_contacts USING btree ((((object ->> 'legacy_domain_id'::text))::integer));
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: unique_data_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: unique_data_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -5196,7 +5200,19 @@ INSERT INTO schema_migrations (version) VALUES ('20151130175654');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20151202123506');
|
INSERT INTO schema_migrations (version) VALUES ('20151202123506');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20160106092052');
|
INSERT INTO schema_migrations (version) VALUES ('20151209122816');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20160106101725');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20160108135436');
|
INSERT INTO schema_migrations (version) VALUES ('20160108135436');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20160113143447');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20160118092453');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20160118092454');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20160218102355');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20160304125933');
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ Domain name mapping protocol short version:
|
||||||
<secDNS:keyData> 1-n
|
<secDNS:keyData> 1-n
|
||||||
<secDNS:flags> 1 Allowed values: 0, 256, 257
|
<secDNS:flags> 1 Allowed values: 0, 256, 257
|
||||||
<secDNS:protocol> 1 Allowed values: 3
|
<secDNS:protocol> 1 Allowed values: 3
|
||||||
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 252, 253, 254, 255
|
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14
|
||||||
<secDNS:pubKey> 1 Public key
|
<secDNS:pubKey> 1 Public key
|
||||||
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
|
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
|
||||||
<eis:legalDocument> 1 Base64 encoded document.
|
<eis:legalDocument> 1 Base64 encoded document.
|
||||||
|
@ -81,7 +81,7 @@ Domain name mapping protocol short version:
|
||||||
<secDNS:keyData> 1-n
|
<secDNS:keyData> 1-n
|
||||||
<secDNS:flags> 1 Allowed values: 0, 256, 257
|
<secDNS:flags> 1 Allowed values: 0, 256, 257
|
||||||
<secDNS:protocol> 1 Allowed values: 3
|
<secDNS:protocol> 1 Allowed values: 3
|
||||||
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 252, 253, 254, 255
|
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14
|
||||||
<secDNS:pubKey> 1 Public key
|
<secDNS:pubKey> 1 Public key
|
||||||
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
|
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
|
||||||
<eis:legalDocument> 0-1 Base64 encoded document. Required if registrant is changing.
|
<eis:legalDocument> 0-1 Base64 encoded document. Required if registrant is changing.
|
||||||
|
|
|
@ -11,7 +11,7 @@ NB! Keyrelay not implemented.
|
||||||
<ext:keyData> 1
|
<ext:keyData> 1
|
||||||
<secDNS:flags> 1 Allowed values: 0, 256, 257
|
<secDNS:flags> 1 Allowed values: 0, 256, 257
|
||||||
<secDNS:protocol> 1 Allowed values: 3
|
<secDNS:protocol> 1 Allowed values: 3
|
||||||
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 252, 253, 254, 255
|
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14
|
||||||
<secDNS:pubKey> 1 Public key
|
<secDNS:pubKey> 1 Public key
|
||||||
<ext:authInfo> 1
|
<ext:authInfo> 1
|
||||||
<domain:pw> 1 Domain password. Attribute: roid="String"
|
<domain:pw> 1 Domain password. Attribute: roid="String"
|
||||||
|
|
|
@ -32,5 +32,44 @@ namespace :convert do
|
||||||
d.save!
|
d.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
desc 'Contact Address Country Code Upcase'
|
||||||
|
task country_code_upcase: :environment do
|
||||||
|
count = 0
|
||||||
|
Contact.find_each do |c|
|
||||||
|
if c.country_code.present? && c.country_code != c.country_code.upcase
|
||||||
|
c.country_code = c.country_code.upcase
|
||||||
|
c.update_columns(country_code: c.country_code.upcase)
|
||||||
|
|
||||||
|
count +=1
|
||||||
|
puts "#{count} contacts has been changed" if count % 1000 == 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
puts "Contacts change has been finished. Starting ContactVersions"
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
ContactVersion.find_each do |c|
|
||||||
|
if (if_object = (c.object && c.object["country_code"].present? && c.object["country_code"] != c.object["country_code"].upcase)) ||
|
||||||
|
(if_changes = (c.object_changes && c.object_changes["country_code"].present? && c.object_changes["country_code"] != c.object_changes["country_code"].map{|e|e.try(:upcase)}))
|
||||||
|
|
||||||
|
if if_object
|
||||||
|
h = c.object
|
||||||
|
h["country_code"] = h["country_code"].try(:upcase)
|
||||||
|
c.object = h
|
||||||
|
end
|
||||||
|
|
||||||
|
if if_changes
|
||||||
|
h = c.object_changes
|
||||||
|
h["country_code"] = h["country_code"].map{|e|e.try(:upcase)}
|
||||||
|
c.object_changes = h
|
||||||
|
end
|
||||||
|
c.update_columns(object: c.object, object_changes: c.object_changes)
|
||||||
|
|
||||||
|
count +=1
|
||||||
|
puts "#{count} contact histories has been changed" if count % 1000 == 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
45
lib/tasks/documents.rake
Normal file
45
lib/tasks/documents.rake
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
namespace :documents do
|
||||||
|
|
||||||
|
desc 'Generate all'
|
||||||
|
task all: :environment do
|
||||||
|
Rake::Task['documents:log'].invoke
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Generate legaldoc versions'
|
||||||
|
task log: :environment do
|
||||||
|
start = Time.zone.now.to_f
|
||||||
|
puts '-----> Adding documets id for PaperTrail log...'
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
LegalDocument.find_each do |x|
|
||||||
|
|
||||||
|
next if x.documentable_id.blank?
|
||||||
|
|
||||||
|
document_type = case x.documentable_type
|
||||||
|
when 'Domain' then DomainVersion
|
||||||
|
when 'Contact'then ContactVersion
|
||||||
|
end
|
||||||
|
|
||||||
|
dc = document_type.where(item_id: x.documentable_id)
|
||||||
|
|
||||||
|
dc.each do |y|
|
||||||
|
|
||||||
|
if x.created_at < (y.created_at + (2*60)) &&
|
||||||
|
x.created_at > (y.created_at - (2*60))
|
||||||
|
|
||||||
|
y.children[:legal_documents] = [x.id]
|
||||||
|
y.save
|
||||||
|
count =+1
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
y.children[:legal_documents] = []
|
||||||
|
y.save
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
puts "-----> Log changed for #{count} rows in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -153,7 +153,7 @@ describe DomainMailer do
|
||||||
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
||||||
@domain = Fabricate(:domain, registrant: @registrant)
|
@domain = Fabricate(:domain, registrant: @registrant)
|
||||||
@domain.deliver_emails = true
|
@domain.deliver_emails = true
|
||||||
@mail = DomainMailer.registrant_updated_notification_for_new_registrant(@domain.id, deliver_emails)
|
@mail = DomainMailer.registrant_updated_notification_for_new_registrant(@domain.id, @registrant.id, @registrant.id, deliver_emails)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should render email subject' do
|
it 'should render email subject' do
|
||||||
|
@ -178,7 +178,7 @@ describe DomainMailer do
|
||||||
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
||||||
@domain = Fabricate(:domain, registrant: @registrant)
|
@domain = Fabricate(:domain, registrant: @registrant)
|
||||||
@domain.deliver_emails = true
|
@domain.deliver_emails = true
|
||||||
@mail = DomainMailer.registrant_updated_notification_for_old_registrant(@domain.id, deliver_emails)
|
@mail = DomainMailer.registrant_updated_notification_for_old_registrant(@domain.id, @registrant.id, @registrant.id, deliver_emails)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should render email subject' do
|
it 'should render email subject' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue