Skip to content

Commit

Permalink
Merge pull request #683 from internetee/registry-660
Browse files Browse the repository at this point in the history
Registry 660
  • Loading branch information
vohmar authored Feb 1, 2018
2 parents 888dc7b + 5162a89 commit fe0dca8
Show file tree
Hide file tree
Showing 161 changed files with 2,078 additions and 1,270 deletions.
14 changes: 0 additions & 14 deletions .reek
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,11 @@ UncommunicativeVariableName:
- Epp::Contact#attrs_from
- Epp::Contact#check_availability
- Epp::Domain#check_availability
- Epp::Domain#copy_and_transfer_contact
- Epp::Domain#domain_contact_attrs_from
- Epp::Domain#domain_status_list_from
- Epp::Domain#domain_statuses_attrs
- Epp::Domain#nameservers_from
- Epp::Domain#parse_period_unit_from_frame
- Epp::Domain#transfer_domain_contacts
- Epp::Domain#validate_contacts
- Invoice#cancel_overdue_invoices
- Legacy::Db
Expand Down Expand Up @@ -209,7 +207,6 @@ DuplicateMethodCall:
- Registrar::DomainsController#normalize_search_parameters
- Registrar::DomainsController#renew
- Registrar::DomainsController#search_contacts
- Registrar::DomainsController#transfer
- Registrar::DomainsController#update
- Registrar::InvoicesController#index
- Registrar::InvoicesController#normalize_search_parameters
Expand Down Expand Up @@ -246,7 +243,6 @@ DuplicateMethodCall:
- Billing::Price#self.effective
- Billing::Price#self.valid
- BusinessRegistryCache#fetch_by_ident_and_cc
- BusinessRegistryCache#purge
- Certificate#parse_metadata
- Certificate#reload_apache
- Certificate#revoke!
Expand Down Expand Up @@ -285,7 +281,6 @@ DuplicateMethodCall:
- Depp::Domain#default_params
- Depp::Domain#renew
- Depp::Keyrelay#keyrelay
- Depp::User#repp_request
- Depp::User#validate_existance_in_server
- Directo#self.dump_result_to_db
- Directo#self.load_price
Expand Down Expand Up @@ -319,7 +314,6 @@ DuplicateMethodCall:
- Epp::Domain#parse_legal_document_from_frame
- Epp::Domain#query_transfer
- Epp::Domain#renew
- Epp::Domain#transfer_domain_contacts
- Epp::Domain#update
- Epp::Domain#validate_contacts
- Epp::Domain#validate_exp_dates
Expand Down Expand Up @@ -765,7 +759,6 @@ TooManyStatements:
- Depp::Domain#create_nameservers_hash
- Depp::Domain#default_params
- Depp::Domain#transfer
- Depp::User#repp_request
- Depp::User#validate_existance_in_server
- Directo#self.send_monthly_invoices
- Directo#self.send_receipts
Expand All @@ -785,7 +778,6 @@ TooManyStatements:
- DomainCron#self.start_expire_period
- DomainCron#self.start_redemption_grace_period
- DomainMailModel#domain_info
- DomainTransfer#approve_as_client
- Epp::Contact#add_legal_file_to_new
- Epp::Contact#attrs_from
- Epp::Contact#check_availability
Expand All @@ -798,7 +790,6 @@ TooManyStatements:
- Epp::Domain#approve_transfer
- Epp::Domain#attrs_from
- Epp::Domain#check_availability
- Epp::Domain#copy_and_transfer_contact
- Epp::Domain#destroy_attrs
- Epp::Domain#dnskeys_attrs
- Epp::Domain#domain_contact_attrs_from
Expand All @@ -814,7 +805,6 @@ TooManyStatements:
- Epp::Domain#reject_transfer
- Epp::Domain#renew
- Epp::Domain#transfer
- Epp::Domain#transfer_domain_contacts
- Epp::Domain#update
- Epp::Domain#validate_contacts
- Invoice#cancel
Expand Down Expand Up @@ -884,7 +874,6 @@ UtilityFunction:
- EppErrors#construct_msg_args_and_value
- Versions#user_from_id_role_username
- Depp::Keyrelay#expiry
- Epp::Domain#copy_and_transfer_contact
- Epp::Domain#nameservers_from
- Epp::Domain::DnsSecKeys#mark
- Epp::Domain::DnsSecKeys#xm_copy
Expand Down Expand Up @@ -947,7 +936,6 @@ FeatureEnvy:
- Depp::Domain#renew
- Depp::Domain#transfer
- Depp::Keyrelay#keyrelay
- Depp::User#repp_request
- DomainMailModel#format
- Epp::Contact#attach_legal_document
- Epp::Contact#attrs_from
Expand All @@ -959,7 +947,6 @@ FeatureEnvy:
- Epp::Domain#destroy_attrs
- Epp::Domain#domain_contact_attrs_from
- Epp::Domain#domain_status_list_from
- Epp::Domain#transfer_domain_contacts
- LegalDocument#calc_checksum
- Nameserver#find_by_hash_params
- RegistrantUser#find_or_create_by_idc_data
Expand Down Expand Up @@ -1094,7 +1081,6 @@ Attribute:
- BankStatement#th6_file
- Versions#version_loader
- Contact#deliver_emails
- Contact#domain_transfer
- Contact#domains_present
- Contact#legal_document_id
- Counter#value
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ env:
- DB=postgresql
bundler_args: --without development staging production
before_script:
- "psql -c 'create database registry_test;' -U postgres"
- "psql -c 'create database registry_whois_test;' -U postgres"
- "psql -c 'create database registry_api_log_test;' -U postgres"
- "cp config/application-example.yml config/application.yml"
- "cp config/database-travis.yml config/database.yml"
- "bundle exec rake db:setup:all"
Expand Down
7 changes: 1 addition & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ gem 'sass-rails', '5.0.6' # sass style

gem 'coffee-rails', '4.1.0' # coffeescript support
gem 'jquery-rails', '4.0.4' # jquery
gem 'turbolinks', '2.5.3' # faster page load
gem 'selectize-rails', '0.12.1' # include selectize.js for select
gem 'jquery-validation-rails', '1.13.1' # validate on client side

# view helpers
gem 'kaminari', '0.16.3' # pagination
gem 'coderay', '1.1.0' # xml console visualize
gem 'html5_validators', '1.2.2' # model requements now automatically on html form
gem 'nprogress-rails', '0.1.6.7' # visual loader
gem 'select2-rails', '3.5.9.3' # for autocomplete
gem 'liquid', '3.0.6' # for email templates

Expand All @@ -59,7 +57,7 @@ gem 'devise', '3.5.4' # authenitcation

# rest api
gem 'grape', '0.12.0'
gem 'hashie-forbidden_attributes', '0.1.1' # For grape, https://github.com/ruby-grape/grape#rails
gem 'hashie-forbidden_attributes', '0.1.1' # For grape, https://github.com/ruby-grape/grape/tree/v0.12.0#rails
gem 'jbuilder', '2.2.16' # json api

# registry specfic
Expand All @@ -76,9 +74,6 @@ gem 'whenever', '0.9.4', require: false
# country listing
gem 'countries', :require => 'countries/global'

# cloning activerecord objects
gem 'deep_cloneable', '2.1.1'

# id + mid login
# gem 'digidoc_client', '0.3.0'
gem 'digidoc_client',
Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ GEM
daemons
multi_json (~> 1.0)
database_cleaner (1.6.1)
deep_cloneable (2.1.1)
activerecord (>= 3.1.0, < 5.0.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (3.5.4)
Expand Down Expand Up @@ -281,7 +279,6 @@ GEM
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
nori (2.6.0)
nprogress-rails (0.1.6.7)
open4 (1.3.4)
orm_adapter (0.5.0)
parallel (1.12.0)
Expand Down Expand Up @@ -441,8 +438,6 @@ GEM
thor (0.19.4)
thread_safe (0.3.6)
tilt (1.4.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.3)
thread_safe (~> 0.1)
unf (0.1.4)
Expand Down Expand Up @@ -497,7 +492,6 @@ DEPENDENCIES
daemons-rails (= 1.2.1)
data_migrate!
database_cleaner
deep_cloneable (= 2.1.1)
devise (= 3.5.4)
digidoc_client!
epp (= 1.5.0)!
Expand All @@ -520,7 +514,6 @@ DEPENDENCIES
mina (= 0.3.1)
money-rails
nokogiri
nprogress-rails (= 0.1.6.7)
paper_trail!
pdfkit (= 0.6.2)
pg (= 0.19.0)
Expand All @@ -545,7 +538,6 @@ DEPENDENCIES
simpleidn (= 0.0.7)
spring
spring-commands-rspec
turbolinks (= 2.5.3)
uuidtools (= 2.1.5)
validates_email_format_of (= 1.6.3)
webmock
Expand Down
1 change: 1 addition & 0 deletions app/api/repp/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ class API < Grape::API
mount Repp::DomainV1
mount Repp::ContactV1
mount Repp::AccountV1
mount Repp::DomainTransfersV1
end
end
47 changes: 47 additions & 0 deletions app/api/repp/domain_transfers_v1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
module Repp
class DomainTransfersV1 < Grape::API
version 'v1', using: :path

resource :domain_transfers do
post '/' do
params do
requires :data, type: Hash do
requires :domainTransfers, type: Array do
requires :domainName, type: String, allow_blank: false
requires :transferCode, type: String, allow_blank: false
end
end
end

new_registrar = current_user.registrar
domain_transfers = params['data']['domainTransfers']
errors = []

domain_transfers.each do |domain_transfer|
domain_name = domain_transfer['domainName']
transfer_code = domain_transfer['transferCode']
domain = Domain.find_by(name: domain_name)

if domain
if domain.transfer_code == transfer_code
domain.transfer(new_registrar)
else
errors << { title: "#{domain_name} transfer code is wrong" }
end
else
errors << { title: "#{domain_name} does not exist" }
end
end

if errors.none?
status 204
body false
@response = {}
else
status 400
@response = { errors: errors }
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/api/repp/domain_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DomainV1 < Grape::API
domain = ident =~ /\A[0-9]+\z/ ? Domain.find_by(id: ident) : Domain.find_by_idn(ident)

error! I18n.t('errors.messages.epp_domain_not_found'), 404 unless domain
error! I18n.t('errors.messages.epp_authorization_error'), 401 unless domain.auth_info.eql? request.headers['Auth-Code']
error! I18n.t('errors.messages.epp_authorization_error'), 401 unless domain.transfer_code.eql? request.headers['Auth-Code']

contact_repp_json = proc{|contact|
contact.as_json.slice("code", "name", "ident", "ident_type", "ident_country_code", "phone", "email", "street", "city", "zip","country_code", "statuses")
Expand Down
5 changes: 0 additions & 5 deletions app/assets/javascripts/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,5 @@
dateFields.datepicker();
}

// For turbolinks
document.addEventListener('page:change', function() {
attachDatePicker();
});

attachDatePicker();
})();
6 changes: 0 additions & 6 deletions app/assets/javascripts/registrant-manifest.coffee
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#= require jquery
#= require jquery_ujs
#= require jquery.validate
#= require jquery.validate.additional-methods
#= require turbolinks
#= require bootstrap-sprockets
#= require jquery.nested_attributes
#= require shared/jquery.validate.bootstrap
#= require jquery-ui/datepicker
#= require select2
#= require datepicker
#= require shared/general
#= require registrar/application
1 change: 0 additions & 1 deletion app/assets/javascripts/registrar-manifest.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#= require jquery
#= require jquery_ujs
#= require turbolinks
#= require bootstrap-sprockets
#= require typeahead.bundle.min
#= require jquery.nested_attributes
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/registrar/application.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(document).on 'page:change', ->
$ ->
$('.js-contact-form').on 'restoreDefault', (e) ->
form = $(e.target)
form.find('.js-ident-tip').hide()
Expand Down
8 changes: 1 addition & 7 deletions app/assets/javascripts/shared/general.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#= require nprogress
#= require nprogress-turbolinks

NProgress.configure
showSpinner: false

@flash_notice = (msg) ->
$('#flash').find('div').removeClass('bg-danger')
$('#flash').find('div').addClass('bg-success')
Expand All @@ -16,7 +10,7 @@ NProgress.configure
$('#flash').find('div').html(msg)
$('#flash').show()

$(document).on 'page:change', ->
$ ->
today = new Date()
tomorrow = new Date(today)
tomorrow.setDate(today.getDate() + 1)
Expand Down
1 change: 0 additions & 1 deletion app/assets/stylesheets/admin-manifest.sass
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//= require 'shared/general-manifest'
//= require 'admin/admin-bootstrap'
//= require 'jquery-ui/datepicker'
//= require 'select2'
Expand Down
4 changes: 1 addition & 3 deletions app/assets/stylesheets/registrant-manifest.sass
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
//= require 'shared/general-manifest'
//= require 'registrant/registrant-bootstrap'
//= require 'jquery-ui/datepicker'
//= require 'select2'
//= require 'select2-bootstrap'
@import shared/fonts
@import shared/general
@import nprogress
@import nprogress-bootstrap
@import forms
@import typeaheadjs
@import selectize
@import selectize.bootstrap3
Expand Down
4 changes: 1 addition & 3 deletions app/assets/stylesheets/registrar-manifest.sass
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
//= require 'shared/general-manifest'
//= require 'registrar/registrar-bootstrap'
//= require 'jquery-ui/datepicker'
//= require 'select2'
//= require 'select2-bootstrap'
@import shared/fonts
@import shared/general
@import nprogress
@import nprogress-bootstrap
@import forms
@import typeaheadjs
@import selectize
@import selectize.bootstrap3
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/shared/general-bootstrap.sass
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@
.required:after
content: "*"
margin: 0 0 0 1px

.tab-content
padding-top: 15px
Empty file.
7 changes: 0 additions & 7 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ def user_for_paper_trail
user_log_str(current_user)
end

def depp_current_user
@depp_current_user ||= Depp::User.new(
tag: current_user.username,
password: current_user.password
)
end

def user_log_str(user)
user.nil? ? 'public' : user.id_role_username
end
Expand Down
Loading

0 comments on commit fe0dca8

Please sign in to comment.