This commit is contained in:
Stas 2016-04-06 14:22:43 +03:00
commit bf9bb8b5f1
319 changed files with 3947 additions and 426329 deletions

1
.gitignore vendored
View file

@ -5,6 +5,7 @@ capybara-*.html
/tmp
/db/*.sqlite3
/public/system
/public/assets
/coverage/
/spec/tmp
**.orig

11
Gemfile
View file

@ -8,10 +8,11 @@ end if Bundler::VERSION < '2'
source 'https://rubygems.org'
# core
gem 'rails', '4.2.4' # when update, all initializers eis_custom files needs check/update
gem 'rails', '4.2.5.2' # when update, all initializers eis_custom files needs check/update
gem 'iso8601', '0.8.6' # for dates and times
gem 'hashie-forbidden_attributes', '0.1.1'
gem 'SyslogLogger', '2.0', require: 'syslog/logger'
gem 'rest-client'
# load env
gem 'figaro', '1.1.1'
@ -30,17 +31,17 @@ gem 'rails-settings-cached', '0.4.1' # for settings
# html-xml
gem 'haml-rails', '0.9.0' # haml for views
gem 'nokogiri', '1.6.6.2' # For XML parsing
gem 'nokogiri', '1.6.7.2' # For XML parsing
# style
gem 'sass-rails', '5.0.3' # sass style
gem 'bootstrap-sass', '3.3.5.1' # bootstrap style
# js
gem 'uglifier', '2.7.1' # minifies js
gem 'uglifier', '2.7.2' # minifies js
gem 'coffee-rails', '4.1.0' # coffeescript support
gem 'turbolinks', '2.5.3' # faster page load
gem 'jquery-rails', '4.0.3' # jquery
gem 'jquery-rails', '4.0.4' # jquery
gem 'selectize-rails', '0.12.1' # include selectize.js for select
gem 'therubyracer', '0.12.2', platforms: :ruby
gem 'jquery-validation-rails', '1.13.1' # validate on client side
@ -55,7 +56,7 @@ gem 'bootstrap-datepicker-rails', '1.3.1.1' # datepicker
gem 'liquid', '3.0.6' # for email templates
# rights
gem 'devise', '3.5.1' # authenitcation
gem 'devise', '3.5.4' # authenitcation
gem 'cancancan', '1.11.0' # autharization
# rest api

View file

@ -50,38 +50,38 @@ GEM
specs:
SyslogLogger (2.0)
abstract_type (0.0.7)
actionmailer (4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
actionmailer (4.2.5.2)
actionpack (= 4.2.5.2)
actionview (= 4.2.5.2)
activejob (= 4.2.5.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.4)
actionview (= 4.2.4)
activesupport (= 4.2.4)
actionpack (4.2.5.2)
actionview (= 4.2.5.2)
activesupport (= 4.2.5.2)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.4)
activesupport (= 4.2.4)
actionview (4.2.5.2)
activesupport (= 4.2.5.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.4)
activesupport (= 4.2.4)
activejob (4.2.5.2)
activesupport (= 4.2.5.2)
globalid (>= 0.3.0)
activemodel (4.2.4)
activesupport (= 4.2.4)
activemodel (4.2.5.2)
activesupport (= 4.2.5.2)
builder (~> 3.1)
activerecord (4.2.4)
activemodel (= 4.2.4)
activesupport (= 4.2.4)
activerecord (4.2.5.2)
activemodel (= 4.2.5.2)
activesupport (= 4.2.5.2)
arel (~> 6.0)
activerecord-import (0.7.0)
activerecord (>= 3.0)
activesupport (4.2.4)
activesupport (4.2.5.2)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
@ -157,6 +157,7 @@ GEM
concord (0.1.5)
adamantium (~> 0.2.0)
equalizer (~> 0.0.9)
concurrent-ruby (1.0.1)
countries (0.11.4)
currencies (~> 0.4.2)
i18n_data (~> 0.7.0)
@ -173,7 +174,7 @@ GEM
activerecord (>= 3.1.0, < 5.0.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (3.5.1)
devise (3.5.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
@ -188,6 +189,8 @@ GEM
nokogiri (>= 1.4.0)
savon (>= 2.4.0)
docile (1.1.5)
domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0)
epp-xml (1.0.4)
activesupport (~> 4.1)
builder (~> 3.2)
@ -261,6 +264,8 @@ GEM
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
html5_validators (1.2.2)
http-cookie (1.0.2)
domain_name (~> 0.5)
httpclient (2.6.0.1)
httpi (2.4.1)
rack
@ -272,7 +277,7 @@ GEM
jbuilder (2.2.16)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (4.0.3)
jquery-rails (4.0.4)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
@ -302,12 +307,12 @@ GEM
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (0.8.2)
mime-types (2.6.1)
mime-types (2.99.1)
mina (0.3.1)
open4 (~> 1.3.4)
rake
mini_portile (0.6.2)
minitest (5.8.0)
mini_portile2 (2.0.0)
minitest (5.8.4)
monetize (1.1.0)
money (~> 6.5.0)
money (6.5.1)
@ -320,9 +325,10 @@ GEM
multi_json (1.11.2)
multi_xml (0.5.5)
nenv (0.2.0)
netrc (0.11.0)
newrelic_rpm (3.12.0.288)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
nori (2.6.0)
notiffany (0.0.7)
nenv (~> 0.1)
@ -365,16 +371,16 @@ GEM
rack-test (0.6.3)
rack (>= 1.0)
railroady (1.3.0)
rails (4.2.4)
actionmailer (= 4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
activemodel (= 4.2.4)
activerecord (= 4.2.4)
activesupport (= 4.2.4)
rails (4.2.5.2)
actionmailer (= 4.2.5.2)
actionpack (= 4.2.5.2)
actionview (= 4.2.5.2)
activejob (= 4.2.5.2)
activemodel (= 4.2.5.2)
activerecord (= 4.2.5.2)
activesupport (= 4.2.5.2)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.4)
railties (= 4.2.5.2)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
@ -382,18 +388,18 @@ GEM
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails-settings-cached (0.4.1)
rails (>= 4.0.0)
railties (4.2.4)
actionpack (= 4.2.4)
activesupport (= 4.2.4)
railties (4.2.5.2)
actionpack (= 4.2.5.2)
activesupport (= 4.2.5.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
raindrops (0.15.0)
rake (10.4.2)
rake (10.5.0)
ransack (1.5.1)
actionpack (>= 3.0)
activerecord (>= 3.0)
@ -410,8 +416,12 @@ GEM
unparser (~> 0.2.2)
ref (2.0.0)
request_store (1.1.0)
responders (2.1.0)
railties (>= 4.2.0, < 5)
responders (2.1.1)
railties (>= 4.2.0, < 5.1)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (3.3.0)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
@ -491,12 +501,13 @@ GEM
spring (1.3.6)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.3.4)
rack (~> 1.0)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sprockets (3.5.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.4)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sys-uname (0.9.0)
ffi (>= 1.0.0)
terminal-table (1.5.2)
@ -512,9 +523,12 @@ GEM
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.1)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
unicorn (4.9.0)
kgio (~> 2.6)
rack
@ -536,7 +550,7 @@ GEM
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
warden (1.2.3)
warden (1.2.6)
rack (>= 1.0)
wasabi (3.5.0)
httpi (~> 2.0)
@ -572,7 +586,7 @@ DEPENDENCIES
data_migrate!
database_cleaner (= 1.4.1)
deep_cloneable (= 2.1.1)
devise (= 3.5.1)
devise (= 3.5.4)
digidoc_client (= 0.2.1)
epp (= 1.4.2)!
epp-xml (= 1.0.4)
@ -591,7 +605,7 @@ DEPENDENCIES
isikukood
iso8601 (= 0.8.6)
jbuilder (= 2.2.16)
jquery-rails (= 4.0.3)
jquery-rails (= 4.0.4)
jquery-ui-rails (= 5.0.5)
jquery-validation-rails (= 1.13.1)
kaminari (= 0.16.3)
@ -600,7 +614,7 @@ DEPENDENCIES
mina (= 0.3.1)
money-rails (= 1.4.1)
newrelic_rpm (= 3.12.0.288)
nokogiri (= 1.6.6.2)
nokogiri (= 1.6.7.2)
nprogress-rails (= 0.1.6.7)
paper_trail!
pdfkit (= 0.6.2)
@ -613,10 +627,11 @@ DEPENDENCIES
que-web (= 0.4.0)
que_mailer!
railroady (= 1.3.0)
rails (= 4.2.4)
rails (= 4.2.5.2)
rails-settings-cached (= 0.4.1)
rake
ransack (= 1.5.1)
rest-client
rspec-rails (= 3.3.2)
rubocop (= 0.32.1)
rubycritic (= 1.4.0)
@ -632,7 +647,7 @@ DEPENDENCIES
therubyracer (= 0.12.2)
traceroute (= 0.5.0)
turbolinks (= 2.5.3)
uglifier (= 2.7.1)
uglifier (= 2.7.2)
unicorn
uuidtools (= 2.1.5)
validates_email_format_of (= 1.6.3)

View file

@ -27,3 +27,16 @@ $(document).on 'page:change', ->
form.find('.js-ident-tip').show()
$('.js-contact-form').trigger('restoreDefault')
$('[data-legal-document]').each (i, fileInput)->
minSize = 8 * 1024 # 8kB
maxSize = 8 * 1024 * 1024; # 8 MB
$(fileInput).closest('form').submit (e) ->
if (files = fileInput.files).length
fileSize = files[0].size
if fileSize < minSize
alert 'Document size should be more than 8kB'
return false
else if fileSize > maxSize
alert 'Document size should be less than 8MB'
return false

View file

@ -1,8 +1,8 @@
class Admin::AccountActivitiesController < AdminController
load_and_authorize_resource
before_action :set_default_dates, only: [:index]
def index # rubocop: disable Metrics/AbcSize
params[:q] ||= {}
ca_cache = params[:q][:created_at_lteq]
begin
@ -25,10 +25,11 @@ class Admin::AccountActivitiesController < AdminController
@account_activities = @q.result.page(params[:page]).per(params[:results_per_page])
sort = @account_activities.orders.map(&:to_sql).join(",")
# can do here inline SQL as it's our
if params[:page] && params[:page].to_i > 1
@sum = @q.result.reorder(sort).limit(@account_activities.offset_value) + @b.result.where.not(id: @q.result.map(&:id))
@sum = @q.result.reorder(sort).limit(@account_activities.offset_value).sum(:sum) + @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
else
@sum = @b.result.where.not(id: @q.result.map(&:id))
@sum = @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
end
respond_to do |format|
@ -40,4 +41,20 @@ class Admin::AccountActivitiesController < AdminController
params[:q][:created_at_lteq] = ca_cache
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

View file

@ -2,22 +2,54 @@ class Admin::BlockedDomainsController < AdminController
load_and_authorize_resource
def index
bd = BlockedDomain.first_or_initialize
@blocked_domains = bd.names.join("\n")
params[:q] ||= {}
domains = BlockedDomain.all.order(:name)
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
end
def new
@domain = BlockedDomain.new
end
def create
names = params[:blocked_domains].split("\r\n").map(&:strip)
bd = BlockedDomain.first_or_create
@domain = BlockedDomain.new(blocked_domain_params)
if bd.update(names: names)
flash[:notice] = I18n.t('record_updated')
redirect_to :back
if @domain.save
flash[:notice] = I18n.t('domain_added')
redirect_to admin_blocked_domains_path
else
@blocked_domains = params[:blocked_domains]
flash.now[:alert] = I18n.t('failed_to_update_record')
render :index
flash.now[:alert] = I18n.t('failed_to_add_domain')
render 'new'
end
end
def delete
if BlockedDomain.find(params[:id]).destroy
flash[:notice] = I18n.t('domain_deleted')
redirect_to admin_blocked_domains_path
else
flash.now[:alert] = I18n.t('failed_to_delete_domain')
redirect_to admin_blocked_domains_path
end
end
def blocked_domain_params
params.require(:blocked_domain).permit(:name)
end
private
def set_domain
@domain = BlockedDomain.find(params[:id])
end
end

View file

@ -4,8 +4,14 @@ class Admin::ContactsController < AdminController
def index
params[:q] ||= {}
@q = Contact.includes(:registrar).search(params[:q])
@contacts = @q.result.page(params[:page])
search_params = params[:q].deep_dup
if search_params[:domain_contacts_type_in].is_a?(Array) && search_params[:domain_contacts_type_in].delete('registrant')
search_params[:registrant_domains_id_not_null] = 1
end
@q = Contact.includes(:registrar).search(search_params)
@contacts = @q.result(distinct: :true).page(params[:page])
if params[:statuses_contains]
contacts = Contact.includes(:registrar).where(
@ -14,10 +20,12 @@ class Admin::ContactsController < AdminController
else
contacts = Contact.includes(:registrar)
end
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
normalize_search_parameters do
@q = contacts.search(params[:q])
@contacts = @q.result.page(params[:page])
@q = contacts.search(search_params)
@contacts = @q.result(distinct: :true).page(params[:page])
end
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0

View file

@ -1,5 +1,6 @@
class Admin::EppLogsController < AdminController
load_and_authorize_resource class: ApiLog::EppLog
before_action :set_default_dates, only: [:index]
def index
@q = ApiLog::EppLog.search(params[:q])
@ -10,4 +11,19 @@ class Admin::EppLogsController < AdminController
def show
@epp_log = ApiLog::EppLog.find(params[:id])
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

View file

@ -23,7 +23,7 @@ class Admin::InvoicesController < AdminController
def index
@q = Invoice.includes(:account_activity).search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty?
@q.sorts = 'number desc' if @q.sorts.empty?
@invoices = @q.result.page(params[:page])
end

View file

@ -57,7 +57,7 @@ class Admin::RegistrarsController < AdminController
def registrar_params
params.require(:registrar).permit(
: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

View file

@ -1,5 +1,6 @@
class Admin::ReppLogsController < AdminController
load_and_authorize_resource class: ApiLog::ReppLog
before_action :set_default_dates, only: [:index]
def index
@q = ApiLog::ReppLog.search(params[:q])
@ -10,4 +11,20 @@ class Admin::ReppLogsController < AdminController
def show
@repp_log = ApiLog::ReppLog.find(params[:id])
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

View file

@ -1,49 +1,68 @@
class Admin::ReservedDomainsController < AdminController
load_and_authorize_resource
before_action :set_domain, only: [:edit, :update]
def index
names = ReservedDomain.pluck(:name, :password).each_with_object({}){|domain, hash| hash[domain[0]] = domain[1]}
names.names = nil if names.blank?
@reserved_domains = names.to_yaml.gsub(/---.?\n/, '').gsub(/\.\.\..?\n/, '')
params[:q] ||= {}
domains = ReservedDomain.all.order(:name)
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
end
def new
@domain = ReservedDomain.new
end
def edit
end
def create
@reserved_domains = params[:reserved_domains]
begin
params[:reserved_domains] = "---\n" if params[:reserved_domains].blank?
names = YAML.load(params[:reserved_domains])
fail if names == false
rescue
flash.now[:alert] = I18n.t('invalid_yaml')
logger.warn 'Invalid YAML'
render :index and return
end
@domain = ReservedDomain.new(reserved_domain_params)
result = true
ReservedDomain.transaction do
# removing old ones
existing = ReservedDomain.any_of_domains(names.keys).pluck(:id)
ReservedDomain.where.not(id: existing).destroy_all
#updating and adding
names.each do |name, psw|
rec = ReservedDomain.find_or_initialize_by(name: name)
rec.password = psw
unless rec.save
result = false
raise ActiveRecord::Rollback
end
end
end
if result
flash[:notice] = I18n.t('record_updated')
redirect_to :back
if @domain.save
flash[:notice] = I18n.t('domain_added')
redirect_to admin_reserved_domains_path
else
flash.now[:alert] = I18n.t('failed_to_update_record')
render :index
flash.now[:alert] = I18n.t('failed_to_add_domain')
render 'new'
end
end
def update
if @domain.update(reserved_domain_params)
flash[:notice] = I18n.t('domain_updated')
else
flash.now[:alert] = I18n.t('failed_to_update_domain')
end
render 'edit'
end
def delete
if ReservedDomain.find(params[:id]).destroy
flash[:notice] = I18n.t('domain_deleted')
redirect_to admin_reserved_domains_path
else
flash.now[:alert] = I18n.t('failed_to_delete_domain')
redirect_to admin_reserved_domains_path
end
end
private
def reserved_domain_params
params.require(:reserved_domain).permit(:name, :password)
end
def set_domain
@domain = ReservedDomain.find(params[:id])
end
end

View file

@ -59,6 +59,7 @@ class Admin::SettingsController < AdminController
:transfer_wait_time,
:invoice_number_min,
:invoice_number_max,
:days_to_keep_business_registry_cache,
:days_to_keep_invoices_active,
:days_to_keep_overdue_invoices_active,
:days_to_renew_domain_before_expire,

View file

@ -32,7 +32,7 @@ class ApplicationController < ActionController::Base
if registrar_request?
registrar_root_url
elsif registrant_request?
registrant_root_url
registrant_login_url
elsif admin_request?
admin_root_url
end

View file

@ -41,7 +41,7 @@ class Epp::ContactsController < EppController
def delete
authorize! :delete, @contact, @password
if @contact.destroy_and_clean
if @contact.destroy_and_clean(params[:parsed_frame])
render_epp_response '/epp/contacts/delete'
else
handle_errors(@contact)

View file

@ -361,9 +361,10 @@ class EppController < ApplicationController
if request_command == 'login' && frame.present?
frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]</')
end
trimmed_request = frame.gsub(/<eis:legalDocument([^>]+)>([^<])+<\/eis:legalDocument>/, "<eis:legalDocument>[FILTERED]</eis:legalDocument>")
ApiLog::EppLog.create({
request: frame,
request: trimmed_request,
request_command: request_command,
request_successful: epp_errors.empty?,
request_object: params[:epp_object_type],

View file

@ -0,0 +1,26 @@
class Registrant::ContactsController < RegistrantController
helper_method :domain_ids
def show
@contact = Contact.where(id: contacts).find_by(id: params[:id])
@current_user = current_user
authorize! :read, @contact
end
def contacts
begin
DomainContact.where(domain_id: domain_ids).pluck(:contact_id) | Domain.where(id: domain_ids).pluck(:registrant_id)
rescue Soap::Arireg::NotAvailableError => error
flash[:notice] = I18n.t(error.json[:message])
Rails.logger.fatal("[EXCEPTION] #{error.to_s}")
[]
end
end
def domain_ids
@domain_ids ||= begin
ident_cc, ident = @current_user.registrant_ident.to_s.split '-'
BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_domain_ids
end
end
end

View file

@ -1,5 +1,86 @@
class Registrant::DomainsController < RegistrantController
def index
authorize! :view, :registrant_domains
params[:q] ||= {}
normalize_search_parameters do
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
end
def show
@domain = domains.find(params[:id])
authorize! :read, @domain
end
def set_domain
@domain = domains.find(params[:id])
end
def domain_verification_url
authorize! :view, :registrant_domains
dom = domains.find(params[:id])
if (dom.statuses.include?(DomainStatus::PENDING_UPDATE) || dom.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)) &&
dom.pending_json.present?
@domain = dom
confirm_path = get_confirm_path(dom.statuses)
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
else
flash[:warning] = I18n.t('available_verification_url_not_found')
redirect_to registrant_domain_path(dom.id)
end
end
def download_list
authorize! :view, :registrant_domains
params[:q] ||= {}
normalize_search_parameters do
@q = domains.search(params[:q])
@domains = @q
end
respond_to do |format|
format.csv { render text: @domains.result.to_csv }
format.pdf do
pdf = @domains.result.pdf(render_to_string('registrant/domains/download_list', layout: false))
send_data pdf, filename: 'domains.pdf'
end
end
end
def domains
ident_cc, ident = @current_user.registrant_ident.split '-'
begin
BusinessRegistryCache.fetch_associated_domains ident, ident_cc
rescue Soap::Arireg::NotAvailableError => error
flash[:notice] = I18n.t(error.json[:message])
Rails.logger.fatal("[EXCEPTION] #{error.to_s}")
current_user.domains
end
end
def normalize_search_parameters
ca_cache = params[:q][:valid_to_lteq]
begin
end_time = params[:q][:valid_to_lteq].try(:to_date)
params[:q][:valid_to_lteq] = end_time.try(:end_of_day)
rescue
logger.warn('Invalid date')
end
yield
params[:q][:valid_to_lteq] = ca_cache
end
def get_confirm_path(statuses)
if statuses.include?(DomainStatus::PENDING_UPDATE)
"#{ENV['registrant_url']}/registrant/domain_update_confirms"
elsif statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)
"#{ENV['registrant_url']}/registrant/domain_delete_confirms"
end
end
end

View file

@ -0,0 +1,7 @@
class Registrant::RegistrarsController < RegistrantController
def show
@registrar = Registrar.find(params[:id])
authorize! :read, @registrar
end
end

View file

@ -6,15 +6,10 @@ class Registrant::SessionsController < Devise::SessionsController
# rubocop: disable Metrics/AbcSize
def id
if Rails.env.development?
sign_in(RegistrantUser.find_or_create_by_idc_data('test'), event: :authentication)
return redirect_to registrant_root_url
end
id_code, id_issuer = request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O']
id_code, id_issuer = 'test', RegistrantUser::ACCEPTED_ISSUER if Rails.env.development?
logger.error request.env['SSL_CLIENT_S_DN']
logger.error request.env['SSL_CLIENT_S_DN'].encoding
logger.error request.env['SSL_CLIENT_I_DN_O']
@user = RegistrantUser.find_or_create_by_idc_data(request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O'])
@user = RegistrantUser.find_or_create_by_idc_data(id_code, id_issuer)
if @user
sign_in(@user, event: :authentication)
redirect_to registrant_root_url

View file

@ -1,5 +1,9 @@
class Registrant::WhoisController < RegistrantController
def index
authorize! :view, :registrant_whois
if params[:domain_name].present?
@domain = WhoisRecord.find_by(name: params[:domain_name]);
end
end
end

View file

@ -6,8 +6,15 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller
params[:q] ||= {}
params[:q].delete_if { |_k, v| v.blank? }
if params[:q].length == 1 && params[:q][:name_matches].present?
@contacts = Contact.find_by(name: params[:q][:name_matches])
search_params = params[:q].deep_dup
if search_params[:domain_contacts_type_in].is_a?(Array) && search_params[:domain_contacts_type_in].delete('registrant')
search_params[:registrant_domains_id_not_null] = 1
end
if search_params.length == 1 && search_params[:name_matches].present?
@contacts = Contact.find_by(name: search_params[:name_matches])
end
if params[:statuses_contains]
@ -19,8 +26,8 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller
end
normalize_search_parameters do
@q = contacts.search(params[:q])
@contacts = @q.result.page(params[:page])
@q = contacts.search(search_params)
@contacts = @q.result(distinct: :true).page(params[:page])
end
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0

View 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

View 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

View file

@ -3,8 +3,8 @@ class RegenerateRegistrarWhoisesJob < Que::Job
# no return as we want restart job if fails
registrar = Registrar.find(registrar_id)
registrar.whois_records.select(:id).find_in_batches(batch_size: 20) do |group|
RegenerateWhoisRecordJob.enqueue group.map(&:id)
registrar.whois_records.select(:name).find_in_batches(batch_size: 20) do |group|
UpdateWhoisRecordJob.enqueue group.map(&:name), 'domain'
end
end
end

View file

@ -1,10 +0,0 @@
class RegenerateWhoisRecordJob < Que::Job
def run(ids)
ids.each do |id|
record = WhoisRecord.find_by(id: id)
return unless record
record.save
end
end
end

View file

@ -0,0 +1,52 @@
class UpdateWhoisRecordJob < Que::Job
def run(names, type)
klass = case type
when 'reserved'then ReservedDomain
when 'blocked' then BlockedDomain
when 'domain' then Domain
end
Array(names).each do |name|
record = klass.find_by(name: name)
if record
send "update_#{type}", record
else
send "delete_#{type}", name
end
end
end
def update_domain(domain)
domain.whois_record ? domain.whois_record.save : domain.create_whois_record
end
def update_reserved(record)
record.generate_data
end
def update_blocked(record)
update_reserved(record)
end
# 1. deleting own
# 2. trying to regenerate reserved in order domain is still in the list
def delete_domain(name)
WhoisRecord.where(name: name).destroy_all
BlockedDomain.find_by(name: name).try(:generate_data)
ReservedDomain.find_by(name: name).try(:generate_data)
end
def delete_reserved(name)
Domain.where(name: name).any?
Whois::Record.where(name: name).delete_all
end
def delete_blocked(name)
delete_reserved(name)
end
end

View file

@ -117,9 +117,11 @@ class Ability
end
def static_registrant
customer_service
can :manage, :registrant_domains
can :manage, :registrant_whois
can :manage, Depp::Domain
can :manage, Domain
end
def user

View file

@ -6,6 +6,8 @@ class AccountActivity < ActiveRecord::Base
belongs_to :bank_transaction
belongs_to :invoice
attr_accessor :registrar
CREATE = 'create'
RENEW = 'renew'
ADD_CREDIT = 'add_credit'
@ -22,12 +24,13 @@ class AccountActivity < ActiveRecord::Base
end
def to_csv
attributes = %w(description activity_type created_at sum)
attributes = %w(registrar description activity_type created_at sum)
CSV.generate(headers: true) do |csv|
csv << %w(description activity_type receipt_date sum)
csv << %w(registrar description activity_type receipt_date sum)
all.each do |x| # rubocop:disable Rails/FindEach
x.registrar = Registrar.find(x.account_id).try(:code)
csv << attributes.map { |attr| x.send(attr) }
end
end

View file

@ -32,7 +32,7 @@ class BankLink
hash["VK_AMOUNT"] = number_with_precision(invoice.sum_cache, :precision => 2, :separator => ".")
hash["VK_CURR"] = invoice.currency
hash["VK_REF"] = ""
hash["VK_MSG"] = "Order nr. #{invoice.number}"
hash["VK_MSG"] = invoice.description
hash["VK_RETURN"] = controller.registrar_return_payment_with_url(type)
hash["VK_CANCEL"] = controller.registrar_return_payment_with_url(type)
hash["VK_DATETIME"] = Time.now.strftime("%Y-%m-%dT%H:%M:%S%z")
@ -101,6 +101,7 @@ class BankLink
transaction.buyer_iban = params["VK_SND_ACC"]
transaction.buyer_name = params["VK_SND_NAME"]
transaction.paid_at = Time.parse(params["VK_T_DATETIME"])
transaction.save!
transaction.autobind_invoice
end

View file

@ -16,21 +16,32 @@ class BankTransaction < ActiveRecord::Base
account_activity.invoice
end
def invoice_num
return @invoice_no if defined?(@invoice_no)
match = description.match(/^[^\d]*(\d+)/)
return unless match
@invoice_no = match[1].try(:to_i)
end
def invoice
@invoice ||= registrar.invoices.find_by(number: invoice_num) if registrar
end
def registrar
@registrar ||= Registrar.find_by(reference_no: reference_no)
end
# For successful binding, reference number, invoice id and sum must match with the invoice
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def autobind_invoice
return if binded?
registrar = Registrar.find_by(reference_no: reference_no)
return unless registrar
match = description.match(/^[^\d]*(\d+)/)
return unless match
invoice_no = match[1].to_i
return unless invoice_no
invoice = registrar.invoices.find_by(number: invoice_no)
return unless invoice_num
return unless invoice
return if invoice.binded?

View file

@ -1,5 +1,50 @@
class BlockedDomain < ActiveRecord::Base
include Versions
before_save :generate_data
after_destroy :remove_data
after_initialize -> { self.names = [] if names.nil? }
validates :name, domain_name: true, uniqueness: true
class << self
def by_domain name
where(name: name)
end
def any_of_domains names
where(name: names)
end
end
def name= val
super SimpleIDN.to_unicode(val)
end
def generate_data
return if Domain.where(name: name).any?
wr = Whois::Record.find_or_initialize_by(name: name)
wr.json = @json = generate_json # we need @json to bind to class
wr.body = generate_body
wr.save
end
alias_method :update_whois_record, :generate_data
def generate_body
template = Rails.root.join("app/views/for_models/whois_other.erb".freeze)
ERB.new(template.read, nil, "-").result(binding)
end
def generate_json
h = HashWithIndifferentAccess.new
h[:name] = self.name
h[:status] = 'Blocked'
h
end
def remove_data
UpdateWhoisRecordJob.enqueue name, 'blocked'
end
end

View file

@ -0,0 +1,83 @@
=begin
The portal for registrants has to offer an overview of the domains the user is related to directly or through an organisation.
Personal relation is defined by matching the personal identification code associated with a domain and the one acquired on
authentication using electronic ID. Association through a business organisation requires a query to business registry.
* when user logs in the personal identification code is sent to business registry (using XML service)
* business registry returns the list of business registry codes the user is a board member of
* the list is cached for two days (configurable)
* during that time no new queries are made to business registry for that personal identification code
and the cached organisation code listing is used
* user sees the listing of domains that are associated with him/her directly or through registered organisation
* UI of the portal displays the list of organisation codes and names used to fetch additional domains for the user
(currently by clicking on a username in top right corner of the screen).
Also time and date of the query to the business registry is displayed with the list of organisations.
* if the query to the business registry fails for any reason the list of
domains associated directly with the user is still displayed with an error message indicating a problem
with receiving current list business entities. Outdated list of organisations cannot be used.
=end
class BusinessRegistryCache < ActiveRecord::Base
# 1. load domains by business
# 2. load domains by person
def associated_contacts
contact_ids = Contact.where(ident_type: 'org', ident: associated_businesses, ident_country_code: 'EE').pluck(:id)
contact_ids += Contact.where(ident_type: 'priv', ident: ident, ident_country_code: ident_country_code).pluck(:id)
contact_ids
end
def associated_domain_ids
domain_ids = []
contact_ids = associated_contacts
unless contact_ids.blank?
domain_ids = DomainContact.distinct.where(contact_id: contact_ids).pluck(:domain_id)
end
domain_ids
end
def associated_domains
Domain.includes(:registrar, :registrant).where(id: associated_domain_ids)
end
class << self
def fetch_associated_domains(ident_code, ident_cc)
fetch_by_ident_and_cc(ident_code, ident_cc).associated_domains
end
def fetch_by_ident_and_cc(ident_code, ident_cc)
cache = BusinessRegistryCache.where(ident: ident_code, ident_country_code: ident_cc).first_or_initialize
msg_start = "[Ariregister] #{ident_cc}-#{ident_code}:"
# fetch new data if cache is expired
if cache.retrieved_on && cache.retrieved_on > (Time.zone.now - Setting.days_to_keep_business_registry_cache.days)
Rails.logger.info("#{msg_start} Info loaded from cache")
return cache
end
cache.attributes = business_registry.associated_businesses(ident_code, ident_cc)
Rails.logger.info("#{msg_start} Info loaded from server")
cache.save
cache
end
def business_registry
Soap::Arireg.new
end
def purge
STDOUT << "#{Time.zone.now.utc} - Starting Purge of old BusinessRegistry data from cache\n" unless Rails.env.test?
purged = 0
BusinessRegistryCache.where('retrieved_on < ?',
Time.zone.now < Setting.days_to_keep_business_registry_cache.days).each do |br|
br.destroy and purged += 1
end
STDOUT << "#{Time.zone.now.utc} - Finished purging #{purged} old BusinessRegistry cache items\n" unless Rails.env.test?
end
end
end

View file

@ -33,9 +33,10 @@ class Contact < ActiveRecord::Base
uniqueness: { message: :epp_id_taken },
format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid },
length: { maximum: 100, message: :too_long_contact_code }
validate :ident_valid_format?
validate :val_ident_valid_format?
validate :uniq_statuses?
validate :validate_html
validate :val_country_code
after_initialize do
self.statuses = [] if statuses.nil?
@ -43,7 +44,7 @@ class Contact < ActiveRecord::Base
self.ident_updated_at = Time.zone.now if new_record? && ident_updated_at.blank?
end
before_validation :set_ident_country_code
before_validation :to_upcase_country_code
before_validation :prefix_code
before_create :generate_auth_info
@ -239,16 +240,17 @@ class Contact < ActiveRecord::Base
name || '[no name]'
end
def ident_valid_format?
def val_ident_valid_format?
case ident_country_code
when 'EE'.freeze
err_msg = "invalid_EE_identity_format#{"_update" if id}".to_sym
case ident_type
when 'priv'.freeze
errors.add(:ident, :invalid_EE_identity_format) unless Isikukood.new(ident).valid?
errors.add(:ident, err_msg) unless Isikukood.new(ident).valid?
when 'org'.freeze
# !%w(1 7 8 9).freeze.include?(ident.first) ||
if ident.size != 8 || !(ident =~/\A[0-9]{8}\z/)
errors.add(:ident, :invalid_EE_identity_format)
errors.add(:ident, err_msg)
end
end
end
@ -333,22 +335,36 @@ class Contact < ActiveRecord::Base
# TODO: refactor, it should not allow to destroy with normal destroy,
# no need separate method
# should use only in transaction
def destroy_and_clean
def destroy_and_clean frame
if domains_present?
errors.add(:domains, :exist)
return false
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
end
def set_ident_country_code
return true unless ident_country_code_changed? && ident_country_code.present?
code = Country.new(ident_country_code)
if code
self.ident_country_code = code.alpha2
else
errors.add(:ident, :invalid_country_code)
def to_upcase_country_code
self.ident_country_code = ident_country_code.upcase if ident_country_code
self.country_code = country_code.upcase if country_code
end
def val_country_code
errors.add(:ident, :invalid_country_code) unless Country.new(ident_country_code)
errors.add(:ident, :invalid_country_code) unless Country.new(country_code)
end
def related_domain_descriptions
@ -418,7 +434,10 @@ class Contact < ActiveRecord::Base
# fetch domains
domains = Domain.where("domains.id IN (#{filter_sql})").includes(:registrar).page(page).per(per)
domains = Domain.where("domains.id IN (#{filter_sql})")
domains = domains.where("domains.id" => params[:leave_domains]) if params[:leave_domains]
domains = domains.includes(:registrar).page(page).per(per)
if sorts.first == "registrar_name".freeze
# using small rails hack to generate outer join
domains = domains.includes(:registrar).where.not(registrars: {id: nil}).order("registrars.name #{order} NULLS LAST")
@ -437,6 +456,30 @@ class Contact < ActiveRecord::Base
domains
end
def all_registrant_domains(page: nil, per: nil, params: {}, registrant: nil)
if registrant
sorts = params.fetch(:sort, {}).first || []
sort = Domain.column_names.include?(sorts.first) ? sorts.first : "valid_to"
order = {"asc"=>"desc", "desc"=>"asc"}[sorts.second] || "desc"
domain_ids = DomainContact.distinct.where(contact_id: registrant.id).pluck(:domain_id)
domains = Domain.where(id: domain_ids).includes(:registrar).page(page).per(per)
if sorts.first == "registrar_name".freeze
domains = domains.includes(:registrar).where.not(registrars: {id: nil}).order("registrars.name #{order} NULLS LAST")
else
domains = domains.order("#{sort} #{order} NULLS LAST")
end
domain_c = Hash.new([])
registrant_domains.where(id: domains.map(&:id)).each{|d| domain_c[d.id] |= ["Registrant".freeze] }
DomainContact.where(contact_id: id, domain_id: domains.map(&:id)).each{|d| domain_c[d.domain_id] |= [d.type] }
domains.each{|d| d.roles = domain_c[d.id].uniq}
domains
end
end
def set_linked
statuses << LINKED if statuses.detect { |s| s == LINKED }.blank?
end
@ -502,7 +545,8 @@ class Contact < ActiveRecord::Base
end
def update_related_whois_records
related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) }
names = related_domain_descriptions.keys
UpdateWhoisRecordJob.enqueue(names, :domain) if names.present?
end
def children_log

24
app/models/counter.rb Normal file
View 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

179
app/models/directo.rb Normal file
View file

@ -0,0 +1,179 @@
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
def self.send_receipts
new_trans = Invoice.where(invoice_type: "DEB", in_directo: false).where(cancelled_at: nil)
total = new_trans.count
counter = 0
Rails.logger.info("[DIRECTO] Will try to send #{total} invoices")
new_trans.find_in_batches(batch_size: 10).each do |group|
mappers = {} # need them as no direct connection between invoice
builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
xml.invoices {
group.each do |invoice|
if invoice.account_activity.nil? || invoice.account_activity.bank_transaction.nil? ||
invoice.account_activity.bank_transaction.sum.nil? || invoice.account_activity.bank_transaction.sum != invoice.sum_cache
Rails.logger.info("[DIRECTO] Invoice #{invoice.number} has been skipped")
next
end
counter += 1
num = invoice.number
mappers[num] = invoice
xml.invoice(
"SalesAgent" => Setting.directo_sales_agent,
"Number" => num,
"InvoiceDate" => invoice.created_at.strftime("%Y-%m-%dT%H:%M:%S"),
"PaymentTerm" => Setting.directo_receipt_payment_term,
"Currency" => invoice.currency,
"CustomerCode"=> invoice.buyer.try(:directo_handle)
){
xml.line(
"ProductID" => Setting.directo_receipt_product_name,
"Quantity" => 1,
"UnitPriceWoVAT" => ActionController::Base.helpers.number_with_precision(invoice.sum_cache/(1+invoice.vat_prc), precision: 2, separator: "."),
"ProductName" => invoice.description
)
}
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
dump_result_to_db(mappers, response)
end
STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n"
end
def self.dump_result_to_db mappers, xml
Nokogiri::XML(xml).css("Result").each do |res|
obj = mappers[res.attributes["docid"].value.to_i]
obj.directo_records.create!(response: res.as_json.to_h, invoice_number: obj.number)
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}")
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

View file

@ -45,7 +45,7 @@ class Domain < ActiveRecord::Base
has_many :dnskeys, dependent: :destroy
has_many :keyrelays
has_one :whois_record, dependent: :destroy
has_one :whois_record # destroyment will be done in after_commit
accepts_nested_attributes_for :dnskeys, allow_destroy: true
@ -89,14 +89,11 @@ class Domain < ActiveRecord::Base
true
end
after_save :update_whois_record
after_commit :update_whois_record
after_create :update_reserved_domains
def update_reserved_domains
return unless in_reserved_list?
rd = ReservedDomain.by_domain(name).first
rd.names[name] = SecureRandom.hex
rd.save
ReservedDomain.new_password_for(name) if in_reserved_list?
end
validates :name_dirty, domain_name: true, uniqueness: true
@ -205,6 +202,31 @@ class Domain < ActiveRecord::Base
statuses.include? DomainStatus::SERVER_TECH_CHANGE_PROHIBITED
end
def self.clean_expired_pendings
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
DomainCron.send(__method__)
end
def self.start_expire_period
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
DomainCron.send(__method__)
end
def self.start_redemption_grace_period
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
DomainCron.send(__method__)
end
def self.start_delete_period
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
DomainCron.send(__method__)
end
def self.destroy_delete_candidates
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
DomainCron.send(__method__)
end
class << self
def convert_period_to_time(period, unit)
return (period.to_i / 365).years if unit == 'd'
@ -222,122 +244,6 @@ class Domain < ActiveRecord::Base
{ admin_contacts: :registrar }
)
end
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def clean_expired_pendings
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
expire_at = Setting.expire_pending_confirmation.hours.ago
count = 0
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
expired_pending_domains.each do |domain|
unless domain.pending_update? || domain.pending_delete? || domain.pending_delete_confirmation?
msg = "#{Time.zone.now.utc} - ISSUE: DOMAIN #{domain.id}: #{domain.name} IS IN EXPIRED PENDING LIST, " \
"but no pendingDelete/pendingUpdate state present!\n"
STDOUT << msg unless Rails.env.test?
next
end
count += 1
if domain.pending_update?
domain.send_mail :pending_update_expired_notification_for_new_registrant
end
if domain.pending_delete? || domain.pending_delete_confirmation?
DomainMailer.pending_delete_expired_notification(domain.id, true).deliver
end
domain.clean_pendings_lowlevel
unless Rails.env.test?
STDOUT << "#{Time.zone.now.utc} Domain.clean_expired_pendings: ##{domain.id} (#{domain.name})\n"
end
end
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
count
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/LineLength
def start_expire_period
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
domains = Domain.where('valid_to <= ?', Time.zone.now)
domains.each do |domain|
next unless domain.expirable?
domain.set_graceful_expired
DomainMailer.expiration_reminder(domain.id).deliver_in(Setting.expiration_reminder_mail.days)
STDOUT << "#{Time.zone.now.utc} Domain.start_expire_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
domain.save
end
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{domains.count} domains\n" unless Rails.env.test?
end
def start_redemption_grace_period
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
d = Domain.where('outzone_at <= ?', Time.zone.now)
d.each do |domain|
next unless domain.server_holdable?
domain.statuses << DomainStatus::SERVER_HOLD
STDOUT << "#{Time.zone.now.utc} Domain.start_redemption_grace_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
domain.save
end
STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test?
end
def start_delete_period
STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
d = Domain.where('delete_at <= ?', Time.zone.now)
d.each do |domain|
next unless domain.delete_candidateable?
domain.statuses << DomainStatus::DELETE_CANDIDATE
STDOUT << "#{Time.zone.now.utc} Domain.start_delete_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
domain.save
end
return if Rails.env.test?
STDOUT << "#{Time.zone.now.utc} - Successfully set delete_candidate to #{d.count} domains\n"
end
# rubocop:disable Rails/FindEach
# rubocop:disable Metrics/AbcSize
def destroy_delete_candidates
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
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
end
Domain.where('force_delete_at <= ?', Time.zone.now).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 force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
c += 1
end
STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test?
end
# rubocop: enable Metrics/AbcSize
# rubocop:enable Rails/FindEach
# rubocop: enable Metrics/LineLength
def destroy_with_message(domain)
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 # DomainVersion
)
end
end
def name=(value)
@ -372,7 +278,7 @@ class Domain < ActiveRecord::Base
end
def in_reserved_list?
ReservedDomain.pw_for(name).present?
@in_reserved_list ||= ReservedDomain.by_domain(name).any?
end
def pending_transfer
@ -410,8 +316,7 @@ class Domain < ActiveRecord::Base
end
end
return false if statuses.include_any?(DomainStatus::DELETE_CANDIDATE, DomainStatus::SERVER_RENEW_PROHIBITED,
DomainStatus::CLIENT_RENEW_PROHIBITED, DomainStatus::PENDING_RENEW,
return false if statuses.include_any?(DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW,
DomainStatus::PENDING_TRANSFER, DomainStatus::PENDING_DELETE,
DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION)
true
@ -442,7 +347,8 @@ class Domain < ActiveRecord::Base
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
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
statuses.delete(DomainStatus::PENDING_UPDATE)
@ -451,13 +357,23 @@ class Domain < ActiveRecord::Base
status_notes[DomainStatus::PENDING_UPDATE] = ''
status_notes[DomainStatus::PENDING_DELETE] = ''
update_columns(
hash = {
registrant_verification_token: nil,
registrant_verification_asked_at: nil,
pending_json: {},
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
def pending_update!
@ -481,6 +397,7 @@ class Domain < ActiveRecord::Base
self.registrant_verification_token = token
self.registrant_verification_asked_at = asked_at
set_pending_update
touch_always_version
pending_json['new_registrant_id'] = new_registrant_id
pending_json['new_registrant_email'] = new_registrant_email
pending_json['new_registrant_name'] = new_registrant_name
@ -546,19 +463,14 @@ class Domain < ActiveRecord::Base
period_i ||= period
unit ||= period_unit
# TODO: test if name.scan(/\.(.+)\z/).first.first is faster
zone = name.split('.').drop(1).join('.')
p = period_i / 365 if unit == 'd'
p = period_i / 12 if unit == 'm'
p = period_i if unit == 'y'
if p > 1
p = "#{p}years"
else
p = "#{p}year"
end
Pricelist.pricelist_for(zone, operation, p)
Pricelist.pricelist_for(zone, operation, "#{p}year".pluralize(p))
end
### VALIDATIONS ###
@ -595,7 +507,7 @@ class Domain < ActiveRecord::Base
def name_in_wire_format
res = ''
parts = name.split('.')
parts = name_puny.split('.')
parts.each do |x|
res += format('%02X', x.length) # length of label in hex
res += x.each_byte.map { |b| format('%02X', b) }.join # label
@ -731,8 +643,12 @@ class Domain < ActiveRecord::Base
case s
when DomainStatus::PENDING_DELETE
self.delete_at = nil
# Handle any other special remove cases?
# when DomainStatus::FORCE_DELETE unset_force_delete
when DomainStatus::SERVER_MANUAL_INZONE # removal causes server hold to set
self.outzone_at = Time.zone.now if self.force_delete_at.present?
when DomainStatus::DomainStatus::EXPIRED # removal causes server hold to set
self.outzone_at = self.valid_to + 15.day
when DomainStatus::DomainStatus::SERVER_HOLD # removal causes server hold to set
self.outzone_at = nil
end
end
end
@ -830,7 +746,7 @@ class Domain < ActiveRecord::Base
end
def update_whois_record
whois_record.blank? ? create_whois_record : whois_record.save
UpdateWhoisRecordJob.enqueue name, 'domain'
end
def status_notes_array=(notes)
@ -845,5 +761,19 @@ class Domain < ActiveRecord::Base
DomainMailer.send(action, DomainMailModel.new(self).send(action)).deliver
end
def self.to_csv
CSV.generate do |csv|
csv << column_names
all.each do |domain|
csv << domain.attributes.values_at(*column_names)
end
end
end
def self.pdf(html)
kit = PDFKit.new(html)
kit.to_pdf
end
end
# rubocop: enable Metrics/ClassLength

121
app/models/domain_cron.rb Normal file
View file

@ -0,0 +1,121 @@
class DomainCron
def self.clean_expired_pendings
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
expire_at = Setting.expire_pending_confirmation.hours.ago
count = 0
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
expired_pending_domains.each do |domain|
unless domain.pending_update? || domain.pending_delete? || domain.pending_delete_confirmation?
msg = "#{Time.zone.now.utc} - ISSUE: DOMAIN #{domain.id}: #{domain.name} IS IN EXPIRED PENDING LIST, " \
"but no pendingDelete/pendingUpdate state present!\n"
STDOUT << msg unless Rails.env.test?
next
end
count += 1
if domain.pending_update?
DomainMailer.pending_update_expired_notification_for_new_registrant(domain.id).deliver
end
if domain.pending_delete? || domain.pending_delete_confirmation?
DomainMailer.pending_delete_expired_notification(domain.id, true).deliver
end
domain.clean_pendings_lowlevel
unless Rails.env.test?
STDOUT << "#{Time.zone.now.utc} DomainCron.clean_expired_pendings: ##{domain.id} (#{domain.name})\n"
end
UpdateWhoisRecordJob.enqueue domain.name, 'domain'
end
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
count
end
def self.start_expire_period
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
domains = Domain.where('valid_to <= ?', Time.zone.now)
marked = 0
real = 0
domains.each do |domain|
next unless domain.expirable?
real += 1
domain.set_graceful_expired
STDOUT << "#{Time.zone.now.utc} DomainCron.start_expire_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
domain.save(validate: false) and marked += 1
end
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{marked} of #{real} domains\n" unless Rails.env.test?
end
def self.start_redemption_grace_period
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
d = Domain.where('outzone_at <= ?', Time.zone.now)
marked = 0
real = 0
d.each do |domain|
next unless domain.server_holdable?
real += 1
domain.statuses << DomainStatus::SERVER_HOLD
STDOUT << "#{Time.zone.now.utc} DomainCron.start_redemption_grace_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
domain.save(validate: false) and marked += 1
end
STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{marked} of #{real} domains\n" unless Rails.env.test?
marked
end
def self.start_delete_period
begin
STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
d = Domain.where('delete_at <= ?', Time.zone.now)
marked = 0
real = 0
d.each do |domain|
next unless domain.delete_candidateable?
real += 1
STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test?
DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) and marked += 1
end
ensure # the operator should see what was accomplished
STDOUT << "#{Time.zone.now.utc} - Finished setting schedule for delete_candidate - #{marked} out of #{real} successfully added to Que schedule\n" unless Rails.env.test?
end
marked
end
def self.destroy_delete_candidates
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
c = 0
Domain.where("statuses @> '{deleteCandidate}'::varchar[]").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)
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
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
c += 1
end
STDOUT << "#{Time.zone.now.utc} - Job destroy added for #{c} domains\n" unless Rails.env.test?
end
# rubocop: enable Metrics/AbcSize
# rubocop:enable Rails/FindEach
# rubocop: enable Metrics/LineLength
def self.destroy_with_message(domain)
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 # DomainVersion
)
end
end

View file

@ -5,6 +5,7 @@ class Epp::Contact < Contact
self.inheritance_column = :sti_disabled
before_validation :manage_permissions
def manage_permissions
return unless update_prohibited? || delete_prohibited?
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
@ -121,6 +122,7 @@ class Epp::Contact < Contact
[:email, :invalid],
[:ident, :invalid],
[:ident, :invalid_EE_identity_format],
[:ident, :invalid_EE_identity_format_update],
[:ident, :invalid_birthday_format],
[:ident, :invalid_country_code],
[:ident_type, :missing],
@ -168,7 +170,7 @@ class Epp::Contact < Contact
org_priv = %w(org priv).freeze
if ident_country_code.blank? && org_priv.include?(ident_type) && org_priv.include?(ident_frame.attr('type'))
at.merge!(ident_country_code: ident_frame.attr('cc'), ident_type: ident_frame.attr('type'))
elsif ident_type == "birthday" && ident !=~ /\d{4}-\d{2}-\d{2}/ && (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_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present?
elsif ident_type.blank? && ident_country_code.blank?
@ -177,6 +179,8 @@ class Epp::Contact < Contact
else
throw :epp_error, {code: '2306', msg: I18n.t(:ident_update_error)}
end
else
throw :epp_error, {code: '2306', msg: I18n.t(:ident_update_error)}
end
end

View file

@ -6,9 +6,10 @@ class Epp::Domain < Domain
attr_accessor :is_renewal, :is_transfer
before_validation :manage_permissions
def manage_permissions
return if is_admin # this bad hack for 109086524, refactor later
return true if is_transfer
return true if is_transfer || is_renewal
return unless update_prohibited? || delete_prohibited?
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
false
@ -498,6 +499,15 @@ class Epp::Domain < Domain
# at[:statuses] += at_add[:domain_statuses_attributes]
if registrant_id && registrant.code == frame.css('registrant')
throw :epp_error, {
code: '2305',
msg: I18n.t(:contact_already_associated_with_the_domain)
}
end
if errors.empty? && verify &&
Setting.request_confrimation_on_registrant_change_enabled &&
frame.css('registrant').present? &&
@ -600,6 +610,7 @@ class Epp::Domain < Domain
statuses.delete(DomainStatus::SERVER_HOLD)
statuses.delete(DomainStatus::EXPIRED)
statuses.delete(DomainStatus::SERVER_UPDATE_PROHIBITED)
save
end
@ -868,6 +879,7 @@ class Epp::Domain < Domain
ld = parsed_frame.css('legalDocument').first
return nil unless ld
return nil if ld.text.starts_with?(ENV['legal_documents_dir']) # escape reloading
return nil if ld.text.starts_with?('/home/') # escape reloading
{
body: ld.text,

View file

@ -2,14 +2,27 @@ class Invoice < ActiveRecord::Base
include Versions
belongs_to :seller, class_name: 'Registrar'
belongs_to :buyer, class_name: 'Registrar'
has_many :invoice_items
has_one :account_activity
has_many :invoice_items
has_many :directo_records, as: :item, class_name: 'Directo'
accepts_nested_attributes_for :invoice_items
scope :unbinded, lambda {
where('id NOT IN (SELECT invoice_id FROM account_activities where invoice_id IS NOT NULL)')
}
scope :all_columns, ->{select("invoices.*")}
scope :sort_due_date_column, ->{all_columns.select("CASE WHEN invoices.cancelled_at is not null THEN
(invoices.cancelled_at + interval '100 year') ELSE
invoices.due_date END AS sort_due_date")}
scope :sort_by_sort_due_date_asc, ->{sort_due_date_column.order("sort_due_date ASC")}
scope :sort_by_sort_due_date_desc, ->{sort_due_date_column.order("sort_due_date DESC")}
scope :sort_receipt_date_column, ->{all_columns.includes(:account_activity).references(:account_activity).select(%Q{
CASE WHEN account_activities.created_at is not null THEN account_activities.created_at
WHEN invoices.cancelled_at is not null THEN invoices.cancelled_at + interval '100 year'
ELSE NULL END AS sort_receipt_date })}
scope :sort_by_sort_receipt_date_asc, ->{sort_receipt_date_column.order("sort_receipt_date ASC")}
scope :sort_by_sort_receipt_date_desc, ->{sort_receipt_date_column.order("sort_receipt_date DESC")}
attr_accessor :billing_email
validates :billing_email, email_format: { message: :invalid }, allow_blank: true
@ -99,6 +112,10 @@ class Invoice < ActiveRecord::Base
kit.to_pdf
end
def description
"Order nr. #{number}"
end
def pdf_name
"invoice-#{number}.pdf"
end

View file

@ -31,7 +31,6 @@ class LegalDocument < ActiveRecord::Base
end
def save_to_filesystem
loop do
rand = SecureRandom.random_number.to_s.last(4)

View file

@ -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
validates :price_cents, :price_currency, :price,
@ -27,6 +29,14 @@ class Pricelist < ActiveRecord::Base
"#{operation_category} #{category}"
end
def years_amount
duration.to_i
end
def price_decimal
price_cents / BigDecimal.new('100')
end
class << self
def pricelist_for(zone, operation, period)
lists = valid.where(category: zone, operation_category: operation, duration: period)

View file

@ -1,4 +1,5 @@
class RegistrantUser < User
ACCEPTED_ISSUER = 'AS Sertifitseerimiskeskus'
attr_accessor :idc_data
def ability
@ -6,6 +7,19 @@ class RegistrantUser < User
end
delegate :can?, :cannot?, to: :ability
def ident
registrant_ident.to_s.split("-").last
end
def domains
ident_cc, ident = registrant_ident.to_s.split '-'
Domain.includes(:registrar, :registrant).where(contacts: {
ident_type: 'priv',
ident: ident, #identity_code,
ident_country_code: ident_cc #country_code
})
end
def to_s
username
end
@ -13,15 +27,23 @@ class RegistrantUser < User
class << self
def find_or_create_by_idc_data(idc_data, issuer_organization)
return false if idc_data.blank?
return false if issuer_organization != 'AS Sertifitseerimiskeskus'
return false if issuer_organization != ACCEPTED_ISSUER
idc_data.force_encoding('UTF-8')
logger.error(idc_data)
logger.error(idc_data.encoding)
# handling here new and old mode
if idc_data.starts_with?("/")
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.username = "#{first_name} #{last_name}"

View file

@ -2,7 +2,11 @@ class ReservedDomain < ActiveRecord::Base
include Versions # version/reserved_domain_version.rb
before_save :fill_empty_passwords
before_save :generate_data
before_destroy :remove_data
after_destroy :remove_data
validates :name, domain_name: true, uniqueness: true
class << self
@ -18,29 +22,40 @@ class ReservedDomain < ActiveRecord::Base
def any_of_domains names
where(name: names)
end
def new_password_for name
record = by_domain(name).first
return unless record
record.regenerate_password
record.save
end
end
def fill_empty_passwords
self.password = SecureRandom.hex unless self.password
end
def name= val
super SimpleIDN.to_unicode(val)
end
def generate_data
@json = generate_json
@body = generate_body
update_whois_server
def fill_empty_passwords
regenerate_password if self.password.blank?
end
def update_whois_server
def regenerate_password
self.password = SecureRandom.hex
end
def generate_data
return if Domain.where(name: name).any?
wr = Whois::Record.find_or_initialize_by(name: name)
wr.body = @body
wr.json = @json
wr.json = @json = generate_json # we need @json to bind to class
wr.body = generate_body
wr.save
end
alias_method :update_whois_record, :generate_data
def generate_body
template = Rails.root.join("app/views/for_models/whois_other.erb".freeze)
@ -55,7 +70,7 @@ class ReservedDomain < ActiveRecord::Base
end
def remove_data
Whois::Record.where(name: name).delete_all
UpdateWhoisRecordJob.enqueue name, 'reserved'
end
end

219
app/models/soap/arireg.rb Normal file
View file

@ -0,0 +1,219 @@
# coding: utf-8
require 'savon'
=begin
Estonian Business registry provides information about registered companies via xml (SOAP over HTTPS).
Note:
The SSL endpoint certificate is self signed.
Documentation:
http://www.rik.ee/et/e-ariregister/xml-teenus
Specifications are in Eng and Est
User contract required
Testing:
https://demo-ariregxml.rik.ee:447/testariport/?wsdl
http://demo-ariregxml.rik.ee:81
https://demo-ariregxml.rik.ee:447
Live service:
https://ariregxml.rik.ee/ariport/?wsdl
https://ariregxml.rik.ee/
Implements Soap::Arireg # associated_businesses
8. arireg.paringesindus_v4
Rights of representation of all persons related to the company (newer)
http://www2.rik.ee/schemas/xtee/arireg/live/paringesindus_v4.xsd
expects personal id code, to fetch list of registered business id codes
returning {ident: person, ident_country_code: ... associated_businesses: [...id_codes...]}
=end
# do some SSL set up?
# ssl_version
# ssl_verify_mode
# ssl_cert_key_file
# ssl_cert_key
# ssl_cert_key_password
# ssl_cert_file
# ssl_cert
# ssl_ca_cert_file
# ssl_ca_cert
module Soap
class Arireg
class NotAvailableError < StandardError
attr_accessor :json
def initialize(params)
params[:message] = "#{I18n.t(:business_registry_service_not_available)}" unless params.key? :message
@json = params
super(params)
end
end
class << self
attr_accessor :wsdl, :host, :username, :password
end
def initialize
if self.class.username.nil?
if Rails.application.secrets.key?(:arireg)
arireg = Rails.application.secrets[:arireg].with_indifferent_access
self.class.username = arireg[:username]
self.class.password = arireg[:password]
if self.class.wsdl.nil? # no override of config/environments/* ?
self.class.wsdl = arireg[:wsdl]
self.class.host = arireg[:host]
end
else
self.class.username = ENV['arireg_username']
self.class.password = ENV['arireg_password']
end
end
if self.class.wsdl.nil?
self.class.wsdl = ENV['arireg_wsdl']
self.class.host = ENV['arireg_host']
end
# note Savon has error if https w/non-standard port,
# use non-standard force to pre-set endpoint
@client = Savon.client(wsdl: self.class.wsdl,
host: self.class.host,
endpoint: "#{self.class.host}/cgi-bin/consumer_proxy")
@session = nil
end
# retrieve business id codes for business that a person has a legal role
def associated_businesses(ident, ident_cc = 'EST')
begin
msg = {
'fyysilise_isiku_kood' => ident,
'fyysilise_isiku_koodi_riik' => country_code_3(ident_cc)
}
Rails.logger.info "[Ariregister] Request sent with data: #{msg.inspect}"
response = @client.call :paringesindus_v4, message: body(msg)
content = extract response, :paringesindus_v4_response
Rails.logger.info "[Ariregister] Got response with data: #{content.inspect}"
if content.present? && content[:ettevotjad].key?(:item)
business_ident = items(content, :ettevotjad).map{|item| item[:ariregistri_kood]}
else
business_ident = []
end
{
ident: ident,
ident_country_code: ident_cc,
# ident_type: 'priv',
retrieved_on: Time.now,
associated_businesses: business_ident
}
rescue Savon::SOAPFault => fault
Rails.logger.error "[Ariregister] #{fault} Äriregister arireg #{self.class.username} at #{self.class.host }"
raise NotAvailableError.new(exception: fault)
rescue HTTPI::SSLError => ssl_error
Rails.logger.error "[Ariregister] #{ssl_error} at #{self.class.host}"
raise NotAvailableError.new(exception: ssl_error)
rescue SocketError => sock
Rails.logger.error "[Ariregister] #{sock}"
raise NotAvailableError.new(exception: sock)
end
end
def debug
@client.globals.log_level :debug
@client.globals.log true
@client.globals.pretty_print_xml true
@debug = true
@client
end
private
# add required elements to request
def body(args)
if @session.nil?
args['ariregister_kasutajanimi'] = self.class.username
args['ariregister_parool'] = self.class.password
else
args['ariregister_sessioon'] = @session
end
{keha: args}
end
# TLA --- three letter acronym required not two letter acronym, transform
def country_code_3(code)
if code.length == 2
code = CC2X3[code]
raise NotAvailableError.new(message: 'Unrecognized Country') if code.nil?
end
code
end
def extract(response, element)
# response envelope body has again header/body under element; header is user and password returned
response.hash[:envelope][:body][element][:keha]
end
def items(content, parent)
items = content[parent][:item]
items.is_a?(Array) ? items : [items]
end
CC2X3 = {"AF"=>"AFG", "AX"=>"ALA", "AL"=>"ALB", "DZ"=>"DZA", "AS"=>"ASM",
"AD"=>"AND", "AO"=>"AGO", "AI"=>"AIA", "AQ"=>"ATA", "AG"=>"ATG",
"AR"=>"ARG", "AM"=>"ARM", "AW"=>"ABW", "AU"=>"AUS", "AT"=>"AUT",
"AZ"=>"AZE", "BS"=>"BHS", "BH"=>"BHR", "BD"=>"BGD", "BB"=>"BRB",
"BY"=>"BLR", "BE"=>"BEL", "BZ"=>"BLZ", "BJ"=>"BEN", "BM"=>"BMU",
"BT"=>"BTN", "BO"=>"BOL", "BQ"=>"BES", "BA"=>"BIH", "BW"=>"BWA",
"BV"=>"BVT", "BR"=>"BRA", "IO"=>"IOT", "BN"=>"BRN", "BG"=>"BGR",
"BF"=>"BFA", "BI"=>"BDI", "CV"=>"CPV", "KH"=>"KHM", "CM"=>"CMR",
"CA"=>"CAN", "KY"=>"CYM", "CF"=>"CAF", "TD"=>"TCD", "CL"=>"CHL",
"CN"=>"CHN", "CX"=>"CXR", "CC"=>"CCK", "CO"=>"COL", "KM"=>"COM",
"CD"=>"COD", "CG"=>"COG", "CK"=>"COK", "CR"=>"CRI", "CI"=>"CIV",
"HR"=>"HRV", "CU"=>"CUB", "CW"=>"CUW", "CY"=>"CYP", "CZ"=>"CZE",
"DK"=>"DNK", "DJ"=>"DJI", "DM"=>"DMA", "DO"=>"DOM", "EC"=>"ECU",
"EG"=>"EGY", "SV"=>"SLV", "GQ"=>"GNQ", "ER"=>"ERI", "EE"=>"EST",
"ET"=>"ETH", "FK"=>"FLK", "FO"=>"FRO", "FJ"=>"FJI", "FI"=>"FIN",
"FR"=>"FRA", "GF"=>"GUF", "PF"=>"PYF", "TF"=>"ATF", "GA"=>"GAB",
"GM"=>"GMB", "GE"=>"GEO", "DE"=>"DEU", "GH"=>"GHA", "GI"=>"GIB",
"GR"=>"GRC", "GL"=>"GRL", "GD"=>"GRD", "GP"=>"GLP", "GU"=>"GUM",
"GT"=>"GTM", "GG"=>"GGY", "GN"=>"GIN", "GW"=>"GNB", "GY"=>"GUY",
"HT"=>"HTI", "HM"=>"HMD", "VA"=>"VAT", "HN"=>"HND", "HK"=>"HKG",
"HU"=>"HUN", "IS"=>"ISL", "IN"=>"IND", "ID"=>"IDN", "IR"=>"IRN",
"IQ"=>"IRQ", "IE"=>"IRL", "IM"=>"IMN", "IL"=>"ISR", "IT"=>"ITA",
"JM"=>"JAM", "JP"=>"JPN", "JE"=>"JEY", "JO"=>"JOR", "KZ"=>"KAZ",
"KE"=>"KEN", "KI"=>"KIR", "KP"=>"PRK", "KR"=>"KOR", "KW"=>"KWT",
"KG"=>"KGZ", "LA"=>"LAO", "LV"=>"LVA", "LB"=>"LBN", "LS"=>"LSO",
"LR"=>"LBR", "LY"=>"LBY", "LI"=>"LIE", "LT"=>"LTU", "LU"=>"LUX",
"MO"=>"MAC", "MK"=>"MKD", "MG"=>"MDG", "MW"=>"MWI", "MY"=>"MYS",
"MV"=>"MDV", "ML"=>"MLI", "MT"=>"MLT", "MH"=>"MHL", "MQ"=>"MTQ",
"MR"=>"MRT", "MU"=>"MUS", "YT"=>"MYT", "MX"=>"MEX", "FM"=>"FSM",
"MD"=>"MDA", "MC"=>"MCO", "MN"=>"MNG", "ME"=>"MNE", "MS"=>"MSR",
"MA"=>"MAR", "MZ"=>"MOZ", "MM"=>"MMR", "NA"=>"NAM", "NR"=>"NRU",
"NP"=>"NPL", "NL"=>"NLD", "NC"=>"NCL", "NZ"=>"NZL", "NI"=>"NIC",
"NE"=>"NER", "NG"=>"NGA", "NU"=>"NIU", "NF"=>"NFK", "MP"=>"MNP",
"NO"=>"NOR", "OM"=>"OMN", "PK"=>"PAK", "PW"=>"PLW", "PS"=>"PSE",
"PA"=>"PAN", "PG"=>"PNG", "PY"=>"PRY", "PE"=>"PER", "PH"=>"PHL",
"PN"=>"PCN", "PL"=>"POL", "PT"=>"PRT", "PR"=>"PRI", "QA"=>"QAT",
"RE"=>"REU", "RO"=>"ROU", "RU"=>"RUS", "RW"=>"RWA", "BL"=>"BLM",
"SH"=>"SHN", "KN"=>"KNA", "LC"=>"LCA", "MF"=>"MAF", "PM"=>"SPM",
"VC"=>"VCT", "WS"=>"WSM", "SM"=>"SMR", "ST"=>"STP", "SA"=>"SAU",
"SN"=>"SEN", "RS"=>"SRB", "SC"=>"SYC", "SL"=>"SLE", "SG"=>"SGP",
"SX"=>"SXM", "SK"=>"SVK", "SI"=>"SVN", "SB"=>"SLB", "SO"=>"SOM",
"ZA"=>"ZAF", "GS"=>"SGS", "SS"=>"SSD", "ES"=>"ESP", "LK"=>"LKA",
"SD"=>"SDN", "SR"=>"SUR", "SJ"=>"SJM", "SZ"=>"SWZ", "SE"=>"SWE",
"CH"=>"CHE", "SY"=>"SYR", "TW"=>"TWN", "TJ"=>"TJK", "TZ"=>"TZA",
"TH"=>"THA", "TL"=>"TLS", "TG"=>"TGO", "TK"=>"TKL", "TO"=>"TON",
"TT"=>"TTO", "TN"=>"TUN", "TR"=>"TUR", "TM"=>"TKM", "TC"=>"TCA",
"TV"=>"TUV", "UG"=>"UGA", "UA"=>"UKR", "AE"=>"ARE", "GB"=>"GBR",
"UM"=>"UMI", "US"=>"USA", "UY"=>"URY", "UZ"=>"UZB", "VU"=>"VUT",
"VE"=>"VEN", "VN"=>"VNM", "VG"=>"VGB", "VI"=>"VIR", "WF"=>"WLF",
"EH"=>"ESH", "YE"=>"YEM", "ZM"=>"ZMB", "ZW"=>"ZWE"}
end
end

View file

@ -106,7 +106,7 @@ class WhoisRecord < ActiveRecord::Base
self.json = generated_json
self.body = generated_body
self.name = json['name']
self.registrar_id = domain.registrar_id # for faster registrar updates
self.registrar_id = domain.registrar_id if domain # for faster registrar updates
end
def update_whois_server

View file

@ -38,7 +38,7 @@ class DomainNameValidator < ActiveModel::EachValidator
def validate_blocked(value)
return true unless value
return false if BlockedDomain.where("names @> ?::varchar[]", "{#{value}}").count > 0
return false if BlockedDomain.where(name: value).count > 0
ZonefileSetting.where(origin: value).count == 0
end
end

View file

@ -45,7 +45,7 @@
.col-md-3
.col-md-2
.col-md-4{class: 'text-right'}
= t(:starting_balance) + " #{@sum.to_a.map(&:sum).sum.to_f} EUR"
= t(:starting_balance) + " #{@sum.to_f} EUR"
%hr
@ -66,10 +66,10 @@
%th{class: 'col-xs-2'}
= sort_link(@q, 'sum')
%tbody
-total = @sum.to_a.map(&:sum).sum.to_f
-total = @sum.to_f
- @account_activities.each do |x|
%tr
%td= link_to(x.account.registrar.try(:code), admin_registrar_path(x.account.registrar))
%td= x.account.registrar && link_to(x.account.registrar.try(:code), admin_registrar_path(x.account.registrar))
%td= x.description.present? ? x.description : '-'
%td= x.activity_type ? t(x.activity_type) : ''
%td= l(x.created_at)

View file

@ -0,0 +1,17 @@
= form_for([:admin, @domain], html: {class: 'form-horizontal'}) do |f|
= render 'shared/full_errors', object: @domain
.row
.col-md-8
.panel.panel-default
.panel-heading.clearfix
.pull-left= t(:general)
.panel-body
.form-group
.col-md-4.control-label
= f.label :name
.col-md-7
= f.text_field(:name, class: 'form-control')
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')

View file

@ -0,0 +1,3 @@
= render 'shared/title', name: t(:edit_pw)
= render 'form'

View file

@ -1,10 +1,68 @@
- content_for :actions do
= link_to(t(:new), new_admin_blocked_domain_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:blocked_domains)
= form_tag([:admin, :blocked_domains]) do |f|
.row
.row
.col-md-12
= text_area_tag :blocked_domains, @blocked_domains, class: 'form-control', rows: 30
%hr
= search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
.row
.col-md-12.text-right
%button.btn.btn-warning=t(:save)
.col-md-3
.form-group
= f.label :name
= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
.col-md-3
.form-group
= f.label t(:created_at_from)
= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control datepicker', placeholder: t(:created_at_from)
.col-md-3
.form-group
= f.label t(:created_at_until)
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:created_at_until)
.row
.col-md-3
.form-group
= label_tag t(:results_per_page)
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
.col-md-3{style: 'padding-top: 25px;'}
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= sort_link(@q, 'name')
%th{class: 'col-xs-2'}
= sort_link(@q, 'created_at', t(:created_at))
%th{class: 'col-xs-2'}
= sort_link(@q, 'updated_at', t(:updated_at))
%th{class: 'col-xs-1'}
= t(:actions)
%tbody
- @domains.each do |x|
%tr
%td= x.name
%td= l(x.created_at, format: :short)
%td= l(x.updated_at, format: :short)
%td
%div{class: 'text-center'}
= link_to(t(:delete), delete_admin_blocked_domain_path(id: x.id),
data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs')
.row
.col-md-6
= paginate @domains
.col-md-6.text-right
.pagination
= t(:result_count, count: @domains.total_count)
:coffee
$(".js-reset-form").on "click", (e) ->
e.preventDefault();
window.location = "#{admin_blocked_domains_path}"

View file

@ -0,0 +1,3 @@
= render 'shared/title', name: t(:add_blocked_domain)
= render 'form'

View file

@ -29,15 +29,10 @@
.form-group
= label_tag t(:country)
= select_tag '[q][country_code_eq]', SortedCountry.all_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
.col-md-3
.form-group
= f.label t(:is_registrant)
%div
= f.check_box :registrant_domains_id_not_null
.col-md-3
.col-md-6
.form-group
= label_tag t(:contact_type)
= select_tag '[q][domain_contacts_type_in]', options_for_select([['admin', 'AdminDomainContact'], ['tech', 'TechDomainContact']], params[:q][:domain_contacts_type_in]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
= select_tag '[q][domain_contacts_type_in]', options_for_select([['admin', 'AdminDomainContact'], ['tech', 'TechDomainContact'], ['registrant', 'registrant']], params[:q][:domain_contacts_type_in]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
.row
.col-md-3
.form-group
@ -64,7 +59,13 @@
.form-group
= label_tag t(:results_per_page)
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
.col-md-3{style: 'padding-top: 25px;'}
.col-md-3
.form-group
= label_tag :only_no_country_code, "Ident CC missing"
= check_box_tag :only_no_country_code, '1',params[:only_no_country_code].eql?('1'), style: 'width:auto;height:auto;float:right'
.row
.col-md-3{style: 'padding-top: 25px;float:right;'}
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search

View file

@ -55,6 +55,7 @@
= "#{l(domain.valid_to, format: :date)}"
%td
- if registrant
- registrant.each do |r|
%p
= r[:name]
@ -64,6 +65,7 @@
= r[:code]
%td
- if admin_contacts
- admin_contacts.each do |ac|
%p
= ac[:name]
@ -73,6 +75,7 @@
= ac[:code]
%td
- if tech_contacts
- tech_contacts.each do |tc|
%p
= tc[:name]
@ -83,6 +86,7 @@
%td
%p
- if nameservers
- nameservers.each do |ns|
= ns[:hostname]
%br
@ -91,7 +95,7 @@
%td
%p
= domain.registrar.name
= domain.registrar.name if domain.registrar
- if domain.pending_json.present?
%tr.js-pending{ style: 'display: none;' }

View file

@ -29,11 +29,11 @@
.col-md-3
.form-group
= 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
.form-group
= 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;'}
%button.btn.btn-primary
&nbsp;

View file

@ -8,13 +8,13 @@
%thead
%tr
%th{class: 'col-xs-3'}
= sort_link(@q, 'invoice')
= sort_link(@q, :number)
%th{class: 'col-xs-3'}
= sort_link(@q, 'buyer')
= sort_link(@q, :buyer_name, "Buyer")
%th{class: 'col-xs-3'}
= sort_link(@q, 'due_date')
= sort_link(@q, :sort_due_date, "Due date")
%th{class: 'col-xs-3'}
= sort_link(@q, 'receipt_date')
= sort_link(@q, :sort_receipt_date, "Receipt date")
%tbody
- @invoices.each do |x|
%tr

View file

@ -82,6 +82,11 @@
= f.label :code
.col-md-7
= 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
.row

View file

@ -14,12 +14,15 @@
= sort_link(@q, 'reg_no', t(:reg_no))
%th{class: 'col-xs-4'}
= t(:credit_balance)
%th{class: 'col-xs-4'}
= t(:test_registrar)
%tbody
- @registrars.each do |x|
%tr
%td= link_to(x, [:admin, x])
%td= x.reg_no
%td= "#{x.balance}"
%td= "#{x.test_registrar}"
.row
.col-md-12
= paginate @registrars

View file

@ -2,6 +2,10 @@
= link_to(t(:edit), edit_admin_registrar_path(@registrar), class: 'btn btn-primary')
= link_to(t(:delete), admin_registrar_path(@registrar),
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
- if @registrar.errors.any?

View file

@ -29,11 +29,11 @@
.col-md-3
.form-group
= 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
.form-group
= 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;'}
%button.btn.btn-primary
&nbsp;

View file

@ -0,0 +1,22 @@
= form_for([:admin, @domain], html: {class: 'form-horizontal'}) do |f|
= render 'shared/full_errors', object: @domain
.row
.col-md-8
.panel.panel-default
.panel-heading.clearfix
.pull-left= t(:general)
.panel-body
.form-group
.col-md-4.control-label
= f.label :name
.col-md-7
= f.text_field(:name, class: 'form-control', disabled: !f.object.new_record?)
.form-group
.col-md-4.control-label
= f.label :password
.col-md-7
= f.text_field(:password, placeholder: t(:optional), class: 'form-control')
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')

View file

@ -0,0 +1,3 @@
= render 'shared/title', name: t(:edit_pw)
= render 'form'

View file

@ -1,14 +1,72 @@
- content_for :actions do
= link_to('#', class: 'btn btn-default', "data-container": "body", "data-title": t('list_format_is_in_yaml'), "data-content": "domain.ee: authinfopw<br>seconddomain.ee:<br>thirddomain.ee: authinfo3<br><br>#{t('if_auth_info_is_left_empty_it_will_be_auto_generated')}<br>#{t('each_domain_name_must_end_with_colon_sign')}", "data-placement": "left", "data-toggle": "popover", "data-html" => "true") do
%span.glyphicon.glyphicon-info-sign{"aria-hidden" => "true"}
= link_to(t(:new), new_admin_reserved_domain_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:reserved_domains)
= form_tag([:admin, :reserved_domains]) do |f|
.row
.row
.col-md-12
= text_area_tag :reserved_domains, @reserved_domains, class: 'form-control', rows: 30
%hr
= search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
.row
.col-md-12.text-right
%button.btn.btn-warning=t(:save)
.col-md-3
.form-group
= f.label :name
= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
.col-md-3
.form-group
= f.label t(:created_at_from)
= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control datepicker', placeholder: t(:created_at_from)
.col-md-3
.form-group
= f.label t(:created_at_until)
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:created_at_until)
.row
.col-md-3
.form-group
= label_tag t(:results_per_page)
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
.col-md-3{style: 'padding-top: 25px;'}
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= sort_link(@q, 'name')
%th{class: 'col-xs-2'}
= sort_link(@q, 'password')
%th{class: 'col-xs-2'}
= sort_link(@q, 'created_at', t(:created_at))
%th{class: 'col-xs-2'}
= sort_link(@q, 'updated_at', t(:updated_at))
%th{class: 'col-xs-2'}
= t(:actions)
%tbody
- @domains.each do |x|
%tr
%td= x.name
%td= x.password
%td= l(x.created_at, format: :short)
%td= l(x.updated_at, format: :short)
%td
= link_to(t(:edit_pw), edit_admin_reserved_domain_path(id: x.id),
class: 'btn btn-primary btn-xs')
= link_to(t(:delete), delete_admin_reserved_domain_path(id: x.id),
data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs')
.row
.col-md-6
= paginate @domains
.col-md-6.text-right
.pagination
= t(:result_count, count: @domains.total_count)
:coffee
$(".js-reset-form").on "click", (e) ->
e.preventDefault();
window.location = "#{admin_reserved_domains_path}"

View file

@ -0,0 +1,3 @@
= render 'shared/title', name: t(:add_reserved_domain)
= render 'form'

View file

@ -51,6 +51,7 @@
= render 'setting_row', var: :transfer_wait_time
= render 'setting_row', var: :ds_digest_type
= render 'setting_row', var: :client_side_status_editing_enabled
= render 'setting_row', var: :days_to_keep_business_registry_cache
= render 'setting_row', var: :api_ip_whitelist_enabled
= render 'setting_row', var: :registrar_ip_whitelist_enabled
= render 'setting_row', var: :request_confrimation_on_registrant_change_enabled
@ -68,9 +69,15 @@
%tbody
= render 'setting_row', var: :invoice_number_min
= 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_overdue_invoices_active
= render 'setting_row', var: :minimum_deposit
= render 'setting_row', var: :directo_receipt_payment_term
= render 'setting_row', var: :directo_receipt_product_name
= render 'setting_row', var: :directo_sales_agent
= render 'setting_row', var: :registry_billing_email
= render 'setting_row', var: :registry_invoice_contact
= render 'setting_row', var: :registry_vat_no

View file

@ -51,7 +51,7 @@ xml.epp_head do
xml.tag!('contact:crID', @contact.cr_id)
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
if @contact.updated_at != @contact.created_at
if @contact.updated_at > @contact.created_at
upID = @contact.updator.try(:registrar)
upID = upID.code if upID.present? # Did updator return a kind of User that has a registrar?
xml.tag!('contact:upID', upID) if upID.present? # optional upID

View file

@ -41,7 +41,7 @@ xml.epp_head do
xml.tag!('domain:crID', @domain.cr_id)
xml.tag!('domain:crDate', @domain.created_at.try(:iso8601))
if @domain.updated_at != @domain.created_at
if @domain.updated_at > @domain.created_at
upID = @domain.updator.try(:registrar)
upID = upID.code if upID.present? # Did updator return a kind of User that has a registrar?
xml.tag!('domain:upID', upID) if upID.present? # optional upID

View file

@ -55,7 +55,7 @@
%li= link_to t(:pricelists), admin_pricelists_path
%li= link_to t(:bank_statements), admin_bank_statements_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.dropdown-header= t(:system)
%li= link_to t(:settings), admin_settings_path
@ -64,8 +64,8 @@
%li= link_to t(:reserved_domains), admin_reserved_domains_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(:epp_logs), admin_epp_logs_path
%li= link_to t(:repp_logs), admin_repp_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(created_after: 'today')
%li= link_to t(:que), '/admin/que'
- if signed_in?

View file

@ -1,7 +1,7 @@
Domeen <%= @domain.name %> on aegunud<br>
Lugupeetud .ee domeeni kasutaja<br>
<br>
Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= l(@domain.outzone_at, format: :short) %> internetis kättesaadav. Alates <%= l(@domain.delete_at, format: :short) %> on domeen <%= @domain.name %> avatud registreerimiseks kõigile huvilistele.
Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= l(@domain.outzone_at, format: :date) %> internetis kättesaadav. Alates <%= l(@domain.delete_at, format: :date) %> on domeen <%= @domain.name %> avatud registreerimiseks kõigile huvilistele.
<br><br>
Domeeni registreeringu pikendamiseks pöörduge palun oma registripidaja <%= @domain.registrar.name %> poole. Registripidajate kontaktid leiate aadressilt www.internet.ee/registripidajad.
<br><br>
@ -27,7 +27,7 @@ Tel: +372 727 1000<br>
The <%= @domain.name %> domain has expired<br>
Dear user of .ee domain,<br>
<br>
The domain name <%= @domain.name %> has expired and will not be available on the Internet from <%= l(@domain.outzone_at, format: :short) %>. From <%= l(@domain.delete_at, format: :short) %>, the <%= @domain.name %> domain will be available for registration on a first come first served basis.
The domain name <%= @domain.name %> has expired and will not be available on the Internet from <%= l(@domain.outzone_at, format: :date) %>. From <%= l(@domain.delete_at, format: :date) %>, the <%= @domain.name %> domain will be available for registration on a first come first served basis.
<br><br>
To renew the domain registration, please contact your registrar <%= @domain.registrar.name %>. You can find the registrar's contacts at http://www.internet.ee/en/registripidajad/.
<br><br>
@ -53,7 +53,7 @@ Phone: +372 727 1000<br>
Домен <%= @domain.name %> устарел<br>
Уважаемый пользователь домена .ee<br>
<br>
Доменное имя <%= @domain.name %> устарело и с <%= l(@domain.outzone_at, format: :short) %> недоступно в Интернете. С <%= l(@domain.delete_at, format: :short) %> домен <%= @domain.name %> доступен для регистрации всем желающим по принципу "first come, first served".
Доменное имя <%= @domain.name %> устарело и с <%= l(@domain.outzone_at, format: :date) %> недоступно в Интернете. С <%= l(@domain.delete_at, format: :date) %> домен <%= @domain.name %> доступен для регистрации всем желающим по принципу "first come, first served".
<br><br>
Для продления регистрации домена просим обратиться к своему регистратору <%= @domain.registrar.name %>. Контактные данные регистраторов можно найти по адресу http://www.internet.ee/ru/p/.
<br><br>

View file

@ -1,7 +1,7 @@
Domeen <%= @domain.name %> on aegunud
Lugupeetud .ee domeeni kasutaja
Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= l(@domain.outzone_at, format: :short) %> internetis kättesaadav. Alates <%= l(@domain.delete_at, format: :short) %> on domeen <%= @domain.name %> avatud registreerimiseks kõigile huvilistele.
Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= l(@domain.outzone_at, format: :date) %> internetis kättesaadav. Alates <%= l(@domain.delete_at, format: :date) %> on domeen <%= @domain.name %> avatud registreerimiseks kõigile huvilistele.
Domeeni registreeringu pikendamiseks pöörduge palun oma registripidaja <%= @domain.registrar.name %> poole. Registripidajate kontaktid leiate aadressilt www.internet.ee/registripidajad.
@ -27,7 +27,7 @@ Tel: +372 727 1000
The <%= @domain.name %> domain has expired
Dear user of .ee domain,
The domain name <%= @domain.name %> has expired and will not be available on the Internet from <%= l(@domain.outzone_at, format: :short) %>. From <%= l(@domain.delete_at, format: :short) %>, the <%= @domain.name %> domain will be available for registration on a first come first served basis.
The domain name <%= @domain.name %> has expired and will not be available on the Internet from <%= l(@domain.outzone_at, format: :date) %>. From <%= l(@domain.delete_at, format: :date) %>, the <%= @domain.name %> domain will be available for registration on a first come first served basis.
To renew the domain registration, please contact your registrar <%= @domain.registrar.name %>. You can find the registrar's contacts at http://www.internet.ee/en/registripidajad/.
@ -53,7 +53,7 @@ Phone: +372 727 1000
Домен <%= @domain.name %> устарел
Уважаемый пользователь домена .ee
Доменное имя <%= @domain.name %> устарело и с <%= l(@domain.outzone_at, format: :short) %> недоступно в Интернете. С <%= l(@domain.delete_at, format: :short) %> домен <%= @domain.name %> доступен для регистрации всем желающим по принципу "first come, first served".
Доменное имя <%= @domain.name %> устарело и с <%= l(@domain.outzone_at, format: :date) %> недоступно в Интернете. С <%= l(@domain.delete_at, format: :date) %> домен <%= @domain.name %> доступен для регистрации всем желающим по принципу "first come, first served".
Для продления регистрации домена просим обратиться к своему регистратору <%= @domain.registrar.name %>. Контактные данные регистраторов можно найти по адресу http://www.internet.ee/ru/p/.

View file

@ -20,7 +20,7 @@ Registrikood: <b><%= @domain.registrant.try(:ident) %></b></p>
<p>Domeenireeglite punktist 6.4 tulenevalt on domeeni suhtes &otilde;igust omaval registreerijal v&otilde;imalus esitada domeeni <b><%= @domain.name %></b> registripidajale <b><%= @domain.registrar %></b> domeeni &uuml;leandmise taotlus Domeenireeglite p 5.3.6.2 kohaselt. Taotlusele tuleb lisada domeeni omandamist t&otilde;endavad dokumendid, mis asendavad Domeenireeglite punktis 5.3.6.3 s&auml;testatud &uuml;leandva registreerija n&otilde;usolekut. Vastav dokumentatsioon tuleks esitada Registripidajale esimesel v&otilde;imalusel.</p>
<p>Kui &uuml;leandmine ei ole 30 p&auml;eva jooksul toimunud, kustub domeen <b><%= @domain.name %></b> 24 tunni jooksul <b><%= l(@domain.force_delete_at, format: :short) %></b> m&ouml;&ouml;dumisest juhuslikult valitud ajahetkel. Soovi korral on v&otilde;imalik domeen p&auml;rast selle kustumist registrist “kes ees, see mees” p&otilde;him&otilde;ttel uuesti registreerida.</p>
<p>Kui &uuml;leandmine ei ole 30 p&auml;eva jooksul toimunud, kustub domeen <b><%= @domain.name %></b> 24 tunni jooksul <b><%= l(@domain.force_delete_at, format: :date) %></b> m&ouml;&ouml;dumisest juhuslikult valitud ajahetkel. Soovi korral on v&otilde;imalik domeen p&auml;rast selle kustumist registrist “kes ees, see mees” p&otilde;him&otilde;ttel uuesti registreerida.</p>
<p>Lisak&uuml;simuste korral v&otilde;tke palun &uuml;hendust oma registripidajaga <%= @domain.registrar %>, kelle kontaktandmed leiate lingilt <a href="http://www.internet.ee/registripidajad" target="_blank">http://www.internet.ee/registripidajad</a></p><br /><br />
@ -39,7 +39,7 @@ Registry code: <b><%= @domain.registrant.try(:ident) %></b></p>
<p>According to paragraph 6.4 of the Domain Regulation, the registrant holding a right to the domain name <b><%= @domain.name %></b> can submit a domain name transfer application to the registrar <b><%= @domain.registrar %></b> in accordance with paragraph 5.3.6.2 of the Domain Regulation. The application must be submitted together with documents certifying the acquisition of the domain that will replace the consent of the surrendering registrant as laid down in paragraph 5.3.6.3 of the Domain Regulation. The relevant documents should be submitted to the registrar as soon as possible.</p>
<p>If the transfer has not been made in 30 days, the domain <b><%= @domain.name %></b> will be deleted at a randomly chosen moment within 24 hours after <b><%= l(@domain.force_delete_at, format: :short) %></b>. After deletion it is possible to reregister the domain on a "first come, first served" basis.</p>
<p>If the transfer has not been made in 30 days, the domain <b><%= @domain.name %></b> will be deleted at a randomly chosen moment within 24 hours after <b><%= l(@domain.force_delete_at, format: :date) %></b>. After deletion it is possible to reregister the domain on a "first come, first served" basis.</p>
<p>Should you have additional questions, please contact your registrar <%= @domain.registrar %>, whose contact information can be found at <a href="http://www.internet.ee/registrars/" target="_blank">http://www.internet.ee/registrars/</a></p><br /><br />
@ -58,7 +58,7 @@ Registry code: <b><%= @domain.registrant.try(:ident) %></b></p>
<p>Согласно пункту 6.4 Правил домена регистрант, имеющий право на домен, может подать регистратору <b><%= @domain.registrar %></b> домена <b><%= @domain.name %></b> ходатайство о передаче домена в соответствии с п. 5.3.6.2 Правил домена. К ходатайству следует приложить подтверждающие приобретение домена документы, заменяющие в соответствии с пунктом 5.3.6.3 Правил домена согласие передающего доменное имя регистранта. EIS предлагает представить соответствующую документацию Регистратору при первой возможности, начиная с инициирования процедуры удаления.</p>
<p>Если в течение 30 дней передача не произошла, домен <b><%= @domain.name %></b> удаляется по истечении 24 часов <b><%= l(@domain.force_delete_at, format: :short) %></b> в случайный момент времени. По желанию после удаления из регистра домен можно снова зарегистрировать по принципу "кто успел, тот и съел".</p>
<p>Если в течение 30 дней передача не произошла, домен <b><%= @domain.name %></b> удаляется по истечении 24 часов <b><%= l(@domain.force_delete_at, format: :date) %></b> в случайный момент времени. По желанию после удаления из регистра домен можно снова зарегистрировать по принципу "кто успел, тот и съел".</p>
<p>Просим обратиться к своему регистратору <%= @domain.registrar %>. Контактные данные регистраторов можно найти по адресу <a href="http://www.internet.ee/registratory/" target="_blank">http://www.internet.ee/registratory/</a></p><br /><br />

View file

@ -11,7 +11,7 @@ Kuivõrd äriregistrist kustutatud juriidiline isik ei saa olla domeeni registre
Domeenireeglite punktist 6.4 tulenevalt on domeeni suhtes õigust omaval registreerijal võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @domain.registrar %> domeeni üleandmise taotlus Domeenireeglite p 5.3.6.2 kohaselt. Taotlusele tuleb lisada domeeni omandamist tõendavad dokumendid, mis asendavad Domeenireeglite punktis 5.3.6.3 sätestatud üleandva registreerija nõusolekut. Vastav dokumentatsioon tuleks esitada Registripidajale esimesel võimalusel.
Kui üleandmine ei ole 30 päeva jooksul toimunud, kustub domeen <%= @domain.name %> 24 tunni jooksul <%= l(@domain.force_delete_at, format: :short) %> möödumisest juhuslikult valitud ajahetkel. Soovi korral on võimalik domeen pärast selle kustumist registrist "kes ees, see mees" põhimõttel uuesti registreerida.
Kui üleandmine ei ole 30 päeva jooksul toimunud, kustub domeen <%= @domain.name %> 24 tunni jooksul <%= l(@domain.force_delete_at, format: :date) %> möödumisest juhuslikult valitud ajahetkel. Soovi korral on võimalik domeen pärast selle kustumist registrist "kes ees, see mees" põhimõttel uuesti registreerida.
Lisaküsimuste korral võtke palun ühendust oma registripidajaga <%= @domain.registrar %>, kelle kontaktandmed leiate lingilt http://www.internet.ee/registripidajad/
@ -30,7 +30,7 @@ As a terminated legal person cannot be the registrant of a domain, the EIF start
According to paragraph 6.4 of the Domain Regulation, the registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @domain.registrar %> in accordance with paragraph 5.3.6.2 of the Domain Regulation. The application must be submitted together with documents certifying the acquisition of the domain that will replace the consent of the surrendering registrant as laid down in paragraph 5.3.6.3 of the Domain Regulation. The relevant documents should be submitted to the registrar as soon as possible.
If the transfer has not been made in 30 days, the domain <%= @domain.name %> will be deleted at a randomly chosen moment within 24 hours after <%= l(@domain.force_delete_at, format: :short) %>. After deletion it is possible to reregister the domain on a "first come, first served" basis.
If the transfer has not been made in 30 days, the domain <%= @domain.name %> will be deleted at a randomly chosen moment within 24 hours after <%= l(@domain.force_delete_at, format: :date) %>. After deletion it is possible to reregister the domain on a "first come, first served" basis.
Should you have additional questions, please contact your registrar <%= @domain.registrar %>, whose contact information can be found at http://www.internet.ee/registrars/
@ -49,7 +49,7 @@ EIS стало известно, что юридическое лицо с ре
Согласно пункту 6.4 Правил домена регистрант, имеющий право на домен, может подать регистратору <%= @domain.registrar %> домена <%= @domain.name %> ходатайство о передаче домена в соответствии с п. 5.3.6.2 Правил домена. К ходатайству следует приложить подтверждающие приобретение домена документы, заменяющие в соответствии с пунктом 5.3.6.3 Правил домена согласие передающего доменное имя регистранта. EIS предлагает представить соответствующую документацию Регистратору при первой возможности, начиная с инициирования процедуры удаления.
Если в течение 30 дней передача не произошла, домен <%= @domain.name %> удаляется по истечении 24 часов <%= l(@domain.force_delete_at, format: :short) %> в случайный момент времени. По желанию после удаления из регистра домен можно снова зарегистрировать по принципу "кто успел, тот и съел".
Если в течение 30 дней передача не произошла, домен <%= @domain.name %> удаляется по истечении 24 часов <%= l(@domain.force_delete_at, format: :date) %> в случайный момент времени. По желанию после удаления из регистра домен можно снова зарегистрировать по принципу "кто успел, тот и съел".
Просим обратиться к своему регистратору <%= @domain.registrar %>. Контактные данные регистраторов можно найти по адресу http://www.internet.ee/registratory

View file

@ -0,0 +1,23 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t(:address)
.panel-body
%dl.dl-horizontal
- if @contact.org_name.present?
%dt= t(:org_name)
%dd= @contact.org_name
%dt= t(:street)
%dd= @contact.street.to_s.gsub("\n", '<br>').html_safe
%dt= t(:city)
%dd= @contact.city
%dt= t(:zip)
%dd= @contact.zip
%dt= t(:state)
%dd= @contact.state
%dt= t(:country)
%dd= @contact.country

View file

@ -0,0 +1,30 @@
- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params.merge(leave_domains: domain_ids))
#contacts.panel.panel-default
.panel-heading
.pull-left
= t(:domains)
.pull-right
= form_tag request.path, method: :get do
= select_tag :domain_filter, options_for_select(%w(Registrant AdminDomainContact TechDomainContact), selected: params[:domain_filter]),
include_blank: true, class: 'form-control2 selectize2'
%button.btn.btn-primary
%span.glyphicon.glyphicon-search
.clearfix
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-3'}=custom_sort_link t(:domain_name), :name
%th{class: 'col-xs-3'}=custom_sort_link t(:registrar), :registrar_name
%th{class: 'col-xs-3'}=custom_sort_link t(:valid_to), :valid_to
%th{class: 'col-xs-3'}=custom_sort_link t(:roles), :roles
%tbody
- domains.each do |x|
%tr
%td= link_to(x.name, [:registrant, x])
%td= link_to(x.registrar, [:registrant, x.registrar])
%td= l(x.valid_to, format: :short)
%td= x.roles.join(", ")
= paginate domains, param_name: :domain_page

View file

@ -0,0 +1,48 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t(:general)
.panel-body
%dl.dl-horizontal
%dt= t(:id)
%dd= @contact.code
%dt= t(:name)
%dd= @contact.name
%dt= t(:password)
%dd
= text_field_tag :auth_info, @contact.auth_info, readonly: true, class: 'partially-hidden'
%br
%dt= t(:ident)
%dd= ident_for(@contact)
%dt= t(:email)
%dd= @contact.email
%dt= t(:phone)
%dd= @contact.phone
- if @contact.fax
%dt= t(:fax)
%dd= @contact.fax
%br
%dt= t(:created)
%dd
= l(@contact.created_at, format: :short)
by
= @contact.name
%dt= t(:updated)
%dd
= l(@contact.updated_at, format: :short)
by
= @contact.name
%dt= t(:registrar)
%dd
- if @contact.registrar.present?
= link_to(@contact.registrar, registrant_registrar_path(@contact.registrar))

View file

@ -0,0 +1,6 @@
= search_form_for [:registrant, @q] do |f|
= f.search_field :name_cont
= f.submit do
%span.glyphicon.glyphicon-search

View file

@ -0,0 +1,21 @@
- panel_class = contact.errors.messages[:statuses] ? 'panel-danger' : 'panel-default'
#contact_statuses.panel{class: panel_class}
.panel-heading.clearfix
= t(:statuses)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}= t(:status)
%th{class: 'col-xs-6'}= t(:notes)
%tbody
- contact.statuses.each do |status|
%tr
%td= status
%td= contact.status_notes[status]
- if contact.errors.messages[:statuses]
%tfoot
- @domain.errors.messages[:statuses].each do |s|
%tr
%td{colspan: 4}= s

View file

@ -0,0 +1,11 @@
= render 'shared/title', name: @contact.name
.row
.col-md-6= render 'registrant/contacts/partials/general'
.col-md-6= render 'registrant/contacts/partials/address'
.row
.col-md-12= render 'registrant/contacts/partials/statuses', contact: @contact
.row
.col-md-12= render 'registrant/contacts/partials/domains', contact: @contact

View file

@ -0,0 +1,13 @@
- content_for :actions do
= render 'shared/title', name: @domain.name
.row
.col-md-12
.panel.panel-default
.panel-heading
%h3.panel-title= t(:personal_domain_verification_url)
.panel-body
.input-group.input-group-lg
%span#sizing-addon1.input-group-addon.glyphicon.glyphicon-link
%input.form-control{"aria-describedby" => "sizing-addon1", type: "text", value: @verification_url}

View file

@ -0,0 +1,28 @@
!!!
%html
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
%title Contacts
%body
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
=t(:name)
%th{class: 'col-xs-2'}
=t(:registrant)
%th{class: 'col-xs-2'}
=t(:valid_to)
%th{class: 'col-xs-2'}
=t(:registrar)
%tbody
- @domains.result.each do |x|
%tr
%td= x.name
%td= x.registrant
%td= l(x.valid_to, format: :short)
%td= x.registrar
.row
.col-md-6

View file

@ -1,5 +1,52 @@
= render 'shared/title', name: t(:domains)
.row
.col-md-12
= search_form_for [:registrant, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
.row
.col-md-3
.form-group
= f.label :name
= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
.col-md-3
.form-group
= f.label t(:registrant_ident)
= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident)
.row
.col-md-3
.form-group
= f.label t(:valid_to_from)
= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control datepicker', placeholder: t(:valid_to_from)
.col-md-3
.form-group
= f.label t(:valid_to_until)
= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control datepicker', placeholder: t(:valid_to_until)
.col-md-3
.form-group
= label_tag t(:results_per_page)
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
.col-md-3{style: 'padding-top: 25px;'}
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
.row
.col-md-3
.btn-group{:role => "group"}
%button.btn.btn-default.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button"}
Download
%span.caret
%ul.dropdown-menu
%li= link_to 'PDF', download_list_registrant_domains_path(q: params[:q], format: "pdf")
%li= link_to 'CSV', download_list_registrant_domains_path(q: params[:q], format: "csv")
.col-md-3
.col-md-3
.col-md-3
%hr
.row
.col-md-12
@ -8,20 +55,30 @@
%thead
%tr
%th{class: 'col-xs-2'}
= t(:name)
= sort_link(@q, 'name')
%th{class: 'col-xs-2'}
= t(:registrant)
= sort_link(@q, 'registrant_name', t(:registrant))
%th{class: 'col-xs-2'}
= t(:valid_to)
= sort_link(@q, 'valid_to', t(:valid_to))
%th{class: 'col-xs-2'}
= t(:registrar)
= sort_link(@q, 'registrar_name', t(:registrar))
%tbody
-# - @domains.each do |x|
-# %tr
-# %td= link_to(x, admin_domain_path(x))
-# %td
-# - if x.registrant
-# = link_to(x.registrant, [:admin, x.registrant])
- @domains.each do |x|
%tr
%td= link_to(x, registrant_domain_path(x))
%td= link_to(x.registrant.name, registrant_contact_path(x.registrant)) if x.registrant
%td= l(x.valid_to, format: :short)
%td= link_to(x.registrar, registrant_registrar_path(x.registrar)) if x.registrar
.row
.col-md-6
= paginate @domains
.col-md-6.text-right
.pagination
= t(:result_count, count: @domains.total_count)
:coffee
$(".js-reset-form").on "click", (e) ->
e.preventDefault();
window.location = "#{registrant_domains_path}"
-# %td= l(x.valid_to, format: :short)
-# %td= link_to(x.registrar, admin_registrar_path(x.registrar)) if x.registrar

View file

@ -0,0 +1,22 @@
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
.panel{class: panel_class}
.panel-heading.clearfix
= t(:admin_contacts)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:name)
%th{class: 'col-xs-4'}= t(:id)
%th{class: 'col-xs-4'}= t(:email)
%tbody
- @domain.admin_contacts.each do |ac|
%tr
%td= link_to(ac, registrant_contact_path(ac))
%td= ac.code
%td= ac.email
- if @domain.errors.messages[:admin_contacts]
%tfoot
- @domain.errors.messages[:admin_contacts].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -0,0 +1,25 @@
- panel_class = @domain.errors.messages[:dnskeys] ? 'panel-danger' : 'panel-default'
#dnskeys.panel{class: panel_class}
.panel-heading.clearfix
= t(:dnskeys)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-1'}= t(:flag)
%th{class: 'col-xs-1'}= t(:protocol)
%th{class: 'col-xs-1'}= t(:algorithm)
%th{class: 'col-xs-9'}= t(:public_key)
%tbody
- @domain.dnskeys.each do |x|
%tr
%td= x.flags
%td= x.protocol
%td= x.alg
%td= x.public_key
- if @domain.errors.messages[:dnskeys]
%tfoot
- @domain.errors.messages[:dnskeys].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -0,0 +1,32 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t(:general)
.panel-body
%dl.dl-horizontal
%dt= t(:name)
%dd= @domain.name
%dt= t(:registered_at)
%dd= l(@domain.registered_at)
%dt= t(:registrar)
%dd= link_to(@domain.registrar, registrant_registrar_path(@domain.registrar))
%dt= t(:authinfo_pw)
%dd
= text_field_tag :password, @domain.auth_info, readonly: true, class: 'partially-hidden'
%dt= t(:valid_from)
%dd= l(@domain.valid_from)
%dt= t(:valid_to)
%dd= l(@domain.valid_to)
%dt= t(:outzone_at)
%dd= l(@domain.outzone_at)
%dt= t(:delete_at)
%dd= l(@domain.delete_at)
%dt= t(:force_delete_at)
%dd= l(@domain.force_delete_at)

View file

@ -0,0 +1,20 @@
.panel{class: 'panel-default'}
.panel-heading.clearfix
= t(:keyrelays)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:uploaded_at)
%th{class: 'col-xs-3'}= t(:expiry)
%th{class: 'col-xs-2'}= t(:requester)
%th{class: 'col-xs-2'}= t(:accepter)
%th{class: 'col-xs-1'}= t(:status)
%tbody
- @domain.keyrelays.includes([:requester, :accepter]).order(pa_date: :desc).each do |x|
%tr
%td= link_to(x.pa_date, [:registrar, x])
%td= x.expiry
%td= link_to(x.requester, [:registrar, x.requester])
%td= link_to(x.accepter, [:registrar, x.accepter])
%td= x.status

View file

@ -0,0 +1,14 @@
.panel.panel-default
.panel-heading.clearfix
= t(:legal_documents)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-8'}= t(:created_at)
%th{class: 'col-xs-4'}= t(:type)
%tbody
- legal_documents.each do |x|
%tr
%td= link_to(x.created_at, [:registrar, x])
%td= x.document_type

View file

@ -0,0 +1,23 @@
- panel_class = @domain.errors.messages[:nameservers] ? 'panel-danger' : 'panel-default'
#nameservers.panel{class: panel_class}
.panel-heading.clearfix
= t(:nameservers)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:hostname)
%th{class: 'col-xs-4'}= t(:ipv4)
%th{class: 'col-xs-4'}= t(:ipv6)
%tbody
- @domain.nameservers.each do |x|
%tr
%td= x
%td= x.ipv4
%td= x.ipv6
- if @domain.errors.messages[:nameservers]
%tfoot
- @domain.errors.messages[:nameservers].each do |x|
%tr
%td{colspan: 3}= x

View file

@ -0,0 +1,19 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t(:registrant)
.panel-body
%dl.dl-horizontal
%dt= t(:name)
%dd= link_to(@domain.registrant.name, registrant_contact_path(@domain.registrant))
%dt= t(:id)
%dd= @domain.registrant_code
%dt= t(:identity_code)
%dd= @domain.registrant_ident
%dt= t(:email)
%dd= @domain.registrant_email
%dt= t(:phone)
%dd= @domain.registrant_phone

View file

@ -0,0 +1,18 @@
#domain_statuses.panel.panel-default
.panel-heading.clearfix
= t(:statuses)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}= t(:status)
%th{class: 'col-xs-6'}= t(:notes)
%tbody
- @domain.statuses.each do |status|
%tr
%td
- if [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION].include?(status) && @domain.pending_json.present?
= link_to(status, domain_verification_url_registrant_domain_url(@domain.id))
- else
= status
%td= @domain.status_notes[status]

View file

@ -0,0 +1,22 @@
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
#tech_contacts.panel{class: panel_class}
.panel-heading.clearfix
= t(:tech_contacts)
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:name)
%th{class: 'col-xs-4'}= t(:id)
%th{class: 'col-xs-4'}= t(:email)
%tbody
- @domain.tech_contacts.each do |tc|
%tr
%td= link_to(tc, registrant_contact_path(tc))
%td= tc.code
%td= tc.email
- if @domain.errors.messages[:tech_contacts]
%tfoot
- @domain.errors.messages[:tech_contacts].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -0,0 +1,17 @@
= render 'shared/title', name: @domain.name
.row
.col-md-6= render 'registrant/domains/partials/general'
.col-md-6= render 'registrant/domains/partials/owner'
.row
.col-md-12= render 'registrant/domains/partials/tech_contacts'
.row
.col-md-12= render 'registrant/domains/partials/admin_contacts'
.row
.col-md-12= render 'registrant/domains/partials/statuses'
.row
.col-md-12= render 'registrant/domains/partials/nameservers'
.row
.col-md-12= render 'registrant/domains/partials/dnskeys'
.row
.col-md-12= render 'registrant/domains/partials/keyrelays'

View file

@ -0,0 +1,21 @@
- content_for :actions do
= render 'shared/title', name: t(:registrars)
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}
= sort_link(@q, 'name')
%th{class: 'col-xs-6'}
= sort_link(@q, 'reg_no', t(:reg_no))
%tbody
- @registrars.each do |x|
%tr
%td= link_to(x, [:registrar, x])
%td= x.reg_no
.row
.col-md-12
= paginate @registrars

View file

@ -0,0 +1,53 @@
= render 'shared/title', name: @registrar.name
- if @registrar.errors.any?
- @registrar.errors.each do |attr, err|
= err
%br
- if @registrar.errors.any?
%hr
.row
.col-md-6
.panel.panel-default
.panel-heading
%h3.panel-title= t(:general)
.panel-body
%dl.dl-horizontal
%dt= t(:name)
%dd= @registrar.name
%dt= t(:reg_no)
%dd= @registrar.reg_no
%dt= t(:vat_no)
%dd= @registrar.vat_no
%dt= t(:reference_no)
%dd= @registrar.reference_no
%dt= t(:id)
%dd= @registrar.code
.col-md-6
.panel.panel-default
.panel-heading
%h3.panel-title= t(:contact)
.panel-body
%dl.dl-horizontal
%dt= t(:country)
%dd= @registrar.country
%dt= t(:address)
%dd= @registrar.address
%dt= t(:contact_phone)
%dd= @registrar.phone
%dt= t(:contact_email)
%dd= @registrar.email
%dt= t(:billing_address)
%dd= @registrar.billing_address
%dt= t(:billing_email)
%dd= @registrar.billing_email

View file

@ -17,5 +17,5 @@
%span.glyphicon.glyphicon-search
&nbsp;
%hr
- if @results
= @results
- if @domain
%pre= @domain.body

View file

@ -10,4 +10,4 @@
= f.label :legal_document, t(:legal_document)
%p.help-block= t(:legal_document_max_size)
.col-md-7
= f.file_field :legal_document, :value => ''
= f.file_field :legal_document, :value => '', data: {legal_document: true}

View file

@ -31,15 +31,10 @@
.form-group
= label_tag t(:country)
= select_tag '[q][country_code_eq]', SortedCountry.all_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
.col-md-3
.form-group
= f.label t(:is_registrant)
%div
= f.check_box :registrant_domains_id_not_null
.col-md-3
.col-md-6
.form-group
= label_tag t(:contact_type)
= select_tag '[q][domain_contacts_type_in]', options_for_select([['admin', 'AdminDomainContact'], ['tech', 'TechDomainContact']], params[:q][:domain_contacts_type_in]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
= select_tag '[q][domain_contacts_type_in]', options_for_select([['admin', 'AdminDomainContact'], ['tech', 'TechDomainContact'], ['registrant', 'registrant']], params[:q][:domain_contacts_type_in]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
.row
.col-md-3
.form-group

View file

@ -18,7 +18,7 @@
= label_tag 'domain[legal_document]', t(:legal_document), class: c
%p.help-block= t(:legal_document_max_size)
.col-md-7
= file_field_tag 'domain[legal_document]', required: fr
= file_field_tag 'domain[legal_document]', required: fr, data: {legal_document: true}
.col-md-4
%p.domain-general-help= t(:domain_general_help).html_safe
%p.domain-admin-contact-help= t(:domain_admin_contact_help).html_safe

View file

@ -4,7 +4,7 @@
.row
.col-sm-6
%h1.text-center-xs
= truncate(name, length: 35)
= content_for?(:page_name) ? yield(:page_name) : truncate(name, length: 35)
.col-sm-6
%h1.text-right.text-center-xs
= yield :actions

View file

@ -45,6 +45,8 @@ ca_cert_path: '/home/registry/registry/shared/ca/certs/ca.crt.pem'
ca_key_path: '/home/registry/registry/shared/ca/private/ca.key.pem'
ca_key_password: 'your-root-key-password'
directo_invoice_url: 'https://domain/ddddd.asp'
#
# EPP
@ -86,6 +88,16 @@ repp_url: 'https://repp.gitlab.eu/repp/v1/'
#
restful_whois_url: 'https://restful-whois.example.com'
#
# Estonian Business Registry
#
# config/secrets.yml --- arireg: {username, password}
arireg_username: 'kasutaja'
arireg_password: 'parool'
# config/environments/production.rb --- Soap::Arireg.wsdl, Soap::Arireg.host
arireg_wsdl: 'lib/schemas/testariport.wsdl' # https://demo-ariregxml.rik.ee:447/testariport/?wsdl
#arireg_wsdl: 'lib/schemas/ariport.wsdl' # https://ariregxml.rik.ee/ariport/?wsdl
arireg_host: 'https://demo-ariregxml.rik.ee:447' # https://ariregxml.rik.ee/
#
# REGISTRAR AND REGISTRANT

Some files were not shown because too many files have changed in this diff Show more