From e8f2360c36350a2621fab27c719586456edcd168 Mon Sep 17 00:00:00 2001 From: Thiago Youssef Date: Sun, 4 Sep 2022 16:52:33 -0300 Subject: [PATCH 1/7] Remove registrar controllers and views --- .../account_activities_controller.rb | 31 --- .../registrar/account_controller.rb | 34 --- .../registrar/admin_contacts_controller.rb | 21 -- app/controllers/registrar/base_controller.rb | 43 ---- .../registrar/bulk_change_controller.rb | 105 -------- .../registrar/contacts_controller.rb | 163 ------------- .../registrar/current_user_controller.rb | 18 -- .../registrar/deposits_controller.rb | 28 --- app/controllers/registrar/depp_controller.rb | 37 --- .../registrar/domain_transfers_controller.rb | 49 ---- .../registrar/domains_controller.rb | 229 ------------------ .../registrar/invoices/delivery_controller.rb | 13 - .../registrar/invoices_controller.rb | 38 --- .../registrar/nameservers_controller.rb | 65 ----- .../registrar/payments_controller.rb | 66 ----- app/controllers/registrar/polls_controller.rb | 44 ---- .../registrar/sessions_controller.rb | 108 --------- .../balance_auto_reload_controller.rb | 52 ---- .../registrar/tech_contacts_controller.rb | 22 -- .../registrar/xml_consoles_controller.rb | 62 ----- app/views/layouts/registrar/base.html.erb | 64 ----- app/views/layouts/registrar/sessions.html.erb | 53 ---- .../account/_balance_auto_reload.html.erb | 30 --- app/views/registrar/account/_details.html.erb | 19 -- app/views/registrar/account/_form.html.erb | 32 --- .../registrar/account/_linked_users.html.erb | 18 -- app/views/registrar/account/edit.html.erb | 10 - app/views/registrar/account/show.html.erb | 23 -- .../account_activities/_search_form.html.erb | 49 ---- .../account_activities/index.html.erb | 66 ----- .../registrar/base/_current_user.html.erb | 4 - .../registrar/base/_form_errors.html.erb | 11 - app/views/registrar/base/_navbar.haml | 20 -- .../bulk_change/_admin_contact_form.html.erb | 65 ----- .../bulk_change/_api_errors.html.erb | 13 - .../bulk_change/_bulk_renew_form.html.erb | 57 ----- .../bulk_change/_bulk_transfer_form.html.erb | 34 --- .../bulk_change/_nameserver_form.html.erb | 77 ------ .../bulk_change/_tech_contact_form.html.erb | 60 ----- app/views/registrar/bulk_change/new.html.erb | 54 ----- app/views/registrar/contacts/_form.haml | 26 -- .../registrar/contacts/_search_form.html.erb | 117 --------- app/views/registrar/contacts/delete.haml | 20 -- app/views/registrar/contacts/edit.haml | 5 - .../registrar/contacts/form/_address.haml | 36 --- app/views/registrar/contacts/form/_code.haml | 9 - .../registrar/contacts/form/_general.haml | 67 ----- .../contacts/form/_legal_document.haml | 13 - app/views/registrar/contacts/index.html.erb | 77 ------ app/views/registrar/contacts/info_index.haml | 19 -- .../registrar/contacts/list_pdf.html.erb | 34 --- app/views/registrar/contacts/new.haml | 5 - .../registrar/contacts/partials/_address.haml | 23 -- .../registrar/contacts/partials/_domains.haml | 31 --- .../registrar/contacts/partials/_general.haml | 23 -- .../contacts/partials/_statuses.haml | 14 -- app/views/registrar/contacts/show.haml | 19 -- app/views/registrar/deposits/new.haml | 28 --- .../registrar/domain_transfers/_form.html.erb | 39 --- .../domain_transfers/create.html.erb | 27 --- .../form/_api_errors.html.erb | 13 - .../registrar/domain_transfers/new.html.erb | 11 - app/views/registrar/domains/_check_form.haml | 10 - app/views/registrar/domains/_domain.html.erb | 15 -- app/views/registrar/domains/_form.haml | 30 --- .../registrar/domains/_search_form.html.erb | 89 ------- app/views/registrar/domains/check.haml | 25 -- app/views/registrar/domains/check_index.haml | 5 - app/views/registrar/domains/delete.haml | 25 -- app/views/registrar/domains/edit.haml | 3 - .../registrar/domains/form/_contacts.haml | 44 ---- .../registrar/domains/form/_dnskeys.haml | 77 ------ .../registrar/domains/form/_general.haml | 39 --- .../registrar/domains/form/_nameservers.haml | 33 --- app/views/registrar/domains/index.html.erb | 59 ----- app/views/registrar/domains/info.html.erb | 59 ----- app/views/registrar/domains/new.haml | 3 - .../registrar/domains/partials/_contacts.haml | 17 -- .../registrar/domains/partials/_dnskeys.haml | 66 ----- .../domains/partials/_general.html.erb | 41 ---- .../domains/partials/_nameservers.haml | 17 -- .../registrar/domains/partials/_statuses.haml | 14 -- app/views/registrar/domains/renew.haml | 14 -- app/views/registrar/domains/renew_index.haml | 30 --- .../registrar/invoices/delivery/new.html.erb | 25 -- app/views/registrar/invoices/index.haml | 73 ------ .../invoices/partials/_banklinks.haml | 8 - .../registrar/invoices/partials/_buyer.haml | 23 -- .../registrar/invoices/partials/_details.haml | 36 --- .../registrar/invoices/partials/_items.haml | 32 --- .../invoices/partials/_payment_orders.haml | 19 -- .../registrar/invoices/partials/_seller.haml | 38 --- app/views/registrar/invoices/show.haml | 20 -- app/views/registrar/payments/pay.html.haml | 14 -- app/views/registrar/polls/show.haml | 48 ---- app/views/registrar/sessions/new.html.erb | 28 --- .../balance_auto_reload/_form.html.erb | 1 - .../balance_auto_reload/edit.html.erb | 10 - .../form/types/_threshold.erb | 40 --- app/views/registrar/shared/_epp_results.haml | 31 --- .../registrar/shared/_error_messages.haml | 5 - app/views/registrar/tara/callback.html.erb | 0 .../epp_requests/contact/check.xml | 12 - .../epp_requests/contact/check_multiple.xml | 14 -- .../epp_requests/contact/create.xml | 32 --- .../epp_requests/contact/delete.xml | 22 -- .../epp_requests/contact/info.xml | 14 -- .../epp_requests/contact/update_chg.xml | 36 --- .../epp_requests/domain/check.xml | 12 - .../epp_requests/domain/client_hold.xml | 15 -- .../epp_requests/domain/create.xml | 42 ---- .../epp_requests/domain/delete.xml | 19 -- .../xml_consoles/epp_requests/domain/info.xml | 15 -- .../epp_requests/domain/renew.xml | 14 -- .../epp_requests/domain/transfer.xml | 22 -- .../epp_requests/domain/update.xml | 54 ----- .../xml_consoles/epp_requests/poll/poll.xml | 7 - app/views/registrar/xml_consoles/show.haml | 73 ------ 118 files changed, 4212 deletions(-) delete mode 100644 app/controllers/registrar/account_activities_controller.rb delete mode 100644 app/controllers/registrar/account_controller.rb delete mode 100644 app/controllers/registrar/admin_contacts_controller.rb delete mode 100644 app/controllers/registrar/base_controller.rb delete mode 100644 app/controllers/registrar/bulk_change_controller.rb delete mode 100644 app/controllers/registrar/contacts_controller.rb delete mode 100644 app/controllers/registrar/current_user_controller.rb delete mode 100644 app/controllers/registrar/deposits_controller.rb delete mode 100644 app/controllers/registrar/depp_controller.rb delete mode 100644 app/controllers/registrar/domain_transfers_controller.rb delete mode 100644 app/controllers/registrar/domains_controller.rb delete mode 100644 app/controllers/registrar/invoices/delivery_controller.rb delete mode 100644 app/controllers/registrar/invoices_controller.rb delete mode 100644 app/controllers/registrar/nameservers_controller.rb delete mode 100644 app/controllers/registrar/payments_controller.rb delete mode 100644 app/controllers/registrar/polls_controller.rb delete mode 100644 app/controllers/registrar/sessions_controller.rb delete mode 100644 app/controllers/registrar/settings/balance_auto_reload_controller.rb delete mode 100644 app/controllers/registrar/tech_contacts_controller.rb delete mode 100644 app/controllers/registrar/xml_consoles_controller.rb delete mode 100644 app/views/layouts/registrar/base.html.erb delete mode 100644 app/views/layouts/registrar/sessions.html.erb delete mode 100644 app/views/registrar/account/_balance_auto_reload.html.erb delete mode 100644 app/views/registrar/account/_details.html.erb delete mode 100644 app/views/registrar/account/_form.html.erb delete mode 100644 app/views/registrar/account/_linked_users.html.erb delete mode 100644 app/views/registrar/account/edit.html.erb delete mode 100644 app/views/registrar/account/show.html.erb delete mode 100644 app/views/registrar/account_activities/_search_form.html.erb delete mode 100644 app/views/registrar/account_activities/index.html.erb delete mode 100644 app/views/registrar/base/_current_user.html.erb delete mode 100644 app/views/registrar/base/_form_errors.html.erb delete mode 100644 app/views/registrar/base/_navbar.haml delete mode 100644 app/views/registrar/bulk_change/_admin_contact_form.html.erb delete mode 100644 app/views/registrar/bulk_change/_api_errors.html.erb delete mode 100644 app/views/registrar/bulk_change/_bulk_renew_form.html.erb delete mode 100644 app/views/registrar/bulk_change/_bulk_transfer_form.html.erb delete mode 100644 app/views/registrar/bulk_change/_nameserver_form.html.erb delete mode 100644 app/views/registrar/bulk_change/_tech_contact_form.html.erb delete mode 100644 app/views/registrar/bulk_change/new.html.erb delete mode 100644 app/views/registrar/contacts/_form.haml delete mode 100644 app/views/registrar/contacts/_search_form.html.erb delete mode 100644 app/views/registrar/contacts/delete.haml delete mode 100644 app/views/registrar/contacts/edit.haml delete mode 100644 app/views/registrar/contacts/form/_address.haml delete mode 100644 app/views/registrar/contacts/form/_code.haml delete mode 100644 app/views/registrar/contacts/form/_general.haml delete mode 100644 app/views/registrar/contacts/form/_legal_document.haml delete mode 100644 app/views/registrar/contacts/index.html.erb delete mode 100644 app/views/registrar/contacts/info_index.haml delete mode 100644 app/views/registrar/contacts/list_pdf.html.erb delete mode 100644 app/views/registrar/contacts/new.haml delete mode 100644 app/views/registrar/contacts/partials/_address.haml delete mode 100644 app/views/registrar/contacts/partials/_domains.haml delete mode 100644 app/views/registrar/contacts/partials/_general.haml delete mode 100644 app/views/registrar/contacts/partials/_statuses.haml delete mode 100644 app/views/registrar/contacts/show.haml delete mode 100644 app/views/registrar/deposits/new.haml delete mode 100644 app/views/registrar/domain_transfers/_form.html.erb delete mode 100644 app/views/registrar/domain_transfers/create.html.erb delete mode 100644 app/views/registrar/domain_transfers/form/_api_errors.html.erb delete mode 100644 app/views/registrar/domain_transfers/new.html.erb delete mode 100644 app/views/registrar/domains/_check_form.haml delete mode 100644 app/views/registrar/domains/_domain.html.erb delete mode 100644 app/views/registrar/domains/_form.haml delete mode 100644 app/views/registrar/domains/_search_form.html.erb delete mode 100644 app/views/registrar/domains/check.haml delete mode 100644 app/views/registrar/domains/check_index.haml delete mode 100644 app/views/registrar/domains/delete.haml delete mode 100644 app/views/registrar/domains/edit.haml delete mode 100644 app/views/registrar/domains/form/_contacts.haml delete mode 100644 app/views/registrar/domains/form/_dnskeys.haml delete mode 100644 app/views/registrar/domains/form/_general.haml delete mode 100644 app/views/registrar/domains/form/_nameservers.haml delete mode 100644 app/views/registrar/domains/index.html.erb delete mode 100644 app/views/registrar/domains/info.html.erb delete mode 100644 app/views/registrar/domains/new.haml delete mode 100644 app/views/registrar/domains/partials/_contacts.haml delete mode 100644 app/views/registrar/domains/partials/_dnskeys.haml delete mode 100644 app/views/registrar/domains/partials/_general.html.erb delete mode 100644 app/views/registrar/domains/partials/_nameservers.haml delete mode 100644 app/views/registrar/domains/partials/_statuses.haml delete mode 100644 app/views/registrar/domains/renew.haml delete mode 100644 app/views/registrar/domains/renew_index.haml delete mode 100644 app/views/registrar/invoices/delivery/new.html.erb delete mode 100644 app/views/registrar/invoices/index.haml delete mode 100644 app/views/registrar/invoices/partials/_banklinks.haml delete mode 100644 app/views/registrar/invoices/partials/_buyer.haml delete mode 100644 app/views/registrar/invoices/partials/_details.haml delete mode 100644 app/views/registrar/invoices/partials/_items.haml delete mode 100644 app/views/registrar/invoices/partials/_payment_orders.haml delete mode 100644 app/views/registrar/invoices/partials/_seller.haml delete mode 100644 app/views/registrar/invoices/show.haml delete mode 100644 app/views/registrar/payments/pay.html.haml delete mode 100644 app/views/registrar/polls/show.haml delete mode 100644 app/views/registrar/sessions/new.html.erb delete mode 100644 app/views/registrar/settings/balance_auto_reload/_form.html.erb delete mode 100644 app/views/registrar/settings/balance_auto_reload/edit.html.erb delete mode 100644 app/views/registrar/settings/balance_auto_reload/form/types/_threshold.erb delete mode 100644 app/views/registrar/shared/_epp_results.haml delete mode 100644 app/views/registrar/shared/_error_messages.haml delete mode 100644 app/views/registrar/tara/callback.html.erb delete mode 100644 app/views/registrar/xml_consoles/epp_requests/contact/check.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/contact/create.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/contact/delete.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/contact/info.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/domain/check.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/domain/client_hold.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/domain/create.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/domain/delete.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/domain/info.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/domain/renew.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/domain/update.xml delete mode 100644 app/views/registrar/xml_consoles/epp_requests/poll/poll.xml delete mode 100644 app/views/registrar/xml_consoles/show.haml diff --git a/app/controllers/registrar/account_activities_controller.rb b/app/controllers/registrar/account_activities_controller.rb deleted file mode 100644 index 0ad8c3d5ab..0000000000 --- a/app/controllers/registrar/account_activities_controller.rb +++ /dev/null @@ -1,31 +0,0 @@ -class Registrar - class AccountActivitiesController < BaseController - load_and_authorize_resource - - def index - params[:q] ||= {} - account = current_registrar_user.registrar.cash_account - - ca_cache = params[:q][:created_at_lteq] - begin - end_time = params[:q][:created_at_lteq].try(:to_date) - params[:q][:created_at_lteq] = end_time.try(:end_of_day) - rescue - logger.warn('Invalid date') - end - - @q = account.activities.includes(:invoice).ransack(params[:q]) - @q.sorts = 'id desc' if @q.sorts.empty? - - respond_to do |format| - format.html { @account_activities = @q.result.page(params[:page]) } - format.csv do - raw_csv = CsvGenerator.generate_csv(@q.result) - send_data raw_csv, filename: "account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv" - end - end - - params[:q][:created_at_lteq] = ca_cache - end - end -end diff --git a/app/controllers/registrar/account_controller.rb b/app/controllers/registrar/account_controller.rb deleted file mode 100644 index a7d135659b..0000000000 --- a/app/controllers/registrar/account_controller.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Registrar - class AccountController < BaseController - skip_authorization_check - helper_method :iban_max_length - helper_method :balance_auto_reload_setting - - def show; end - - def edit - @registrar = current_registrar_user.registrar - end - - def update - @registrar = current_registrar_user.registrar - @registrar.update!(registrar_params) - - redirect_to registrar_account_path, notice: t('.saved') - end - - private - - def registrar_params - params.require(:registrar).permit(:billing_email, :iban) - end - - def iban_max_length - Iban.max_length - end - - def balance_auto_reload_setting - current_registrar_user.registrar.settings['balance_auto_reload'] - end - end -end diff --git a/app/controllers/registrar/admin_contacts_controller.rb b/app/controllers/registrar/admin_contacts_controller.rb deleted file mode 100644 index 378f490a9c..0000000000 --- a/app/controllers/registrar/admin_contacts_controller.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Registrar - class AdminContactsController < BulkChangeController - BASE_URL = URI.parse("#{ENV['repp_url']}domains/admin_contacts").freeze - ACTIVE_TAB = :admin_contact - - def update - authorize! :manage, :repp - uri = BASE_URL - request = form_request(uri) - - action = Actions::DoRequest.new(request, uri) - response = action.call - - start_notice = t('.replaced') - - process_response(response: response, - start_notice: start_notice, - active_tab: ACTIVE_TAB) - end - end -end diff --git a/app/controllers/registrar/base_controller.rb b/app/controllers/registrar/base_controller.rb deleted file mode 100644 index 2aad861b84..0000000000 --- a/app/controllers/registrar/base_controller.rb +++ /dev/null @@ -1,43 +0,0 @@ -class Registrar - class BaseController < ApplicationController - include Registrar::ApplicationHelper - - before_action :authenticate_registrar_user! - before_action :check_ip_restriction - helper_method :depp_controller? - helper_method :head_title_sufix - before_action :set_paper_trail_whodunnit - - protected - - def current_ability - @current_ability ||= Ability.new(current_registrar_user, request.remote_ip) - end - - private - - def check_ip_restriction - ip_restriction = Authorization::RestrictedIp.new(request.ip) - allowed = ip_restriction.can_access_registrar_area?(current_registrar_user.registrar) - - return if allowed - - sign_out current_registrar_user - - flash[:alert] = t('registrar.authorization.ip_not_allowed', ip: request.ip) - redirect_to new_registrar_user_session_url - end - - def depp_controller? - false - end - - def head_title_sufix - t(:registrar_head_title_sufix) - end - - def user_for_paper_trail - current_registrar_user ? current_registrar_user.id_role_username : 'anonymous' - end - end -end diff --git a/app/controllers/registrar/bulk_change_controller.rb b/app/controllers/registrar/bulk_change_controller.rb deleted file mode 100644 index 9cd00e6cc7..0000000000 --- a/app/controllers/registrar/bulk_change_controller.rb +++ /dev/null @@ -1,105 +0,0 @@ -class Registrar - class BulkChangeController < DeppController - helper_method :available_contacts - - def new - authorize! :manage, :repp - @expire_date = Time.zone.now.to_date - render 'registrar/bulk_change/new', locals: { active_tab: default_tab } - end - - def bulk_renew - authorize! :manage, :repp - set_form_data - - if ready_to_renew? - res = ReppApi.bulk_renew(domain_ids_for_bulk_renew, params[:period], - current_registrar_user) - - flash_message(JSON.parse(res)) - else - flash[:notice] = nil - end - - render 'registrar/bulk_change/new', locals: { active_tab: :bulk_renew } - end - - private - - def form_request(uri) - request = Net::HTTP::Patch.new(uri) - request.set_form_data(current_contact_id: params[:current_contact_id], - new_contact_id: params[:new_contact_id]) - request.basic_auth(current_registrar_user.username, - current_registrar_user.plain_text_password) - request - end - - def process_response(response:, start_notice: '', active_tab:) - parsed_response = JSON.parse(response.body, symbolize_names: true) - - if response.code == '200' - notices = success_notices(parsed_response, start_notice) - - flash[:notice] = notices.join(', ') - redirect_to registrar_domains_url - else - @error = response.code == '404' ? 'Contact(s) not found' : parsed_response[:message] - render 'registrar/bulk_change/new', locals: { active_tab: active_tab } - end - end - - def success_notices(parsed_response, start_notice) - notices = [start_notice] - - notices << "#{t('.affected_domains')}: " \ - "#{parsed_response[:data][:affected_domains].join(', ')}" - - if parsed_response[:data][:skipped_domains] - notices << "#{t('.skipped_domains')}: " \ - "#{parsed_response[:data][:skipped_domains].join(', ')}" - end - notices - end - - def ready_to_renew? - domain_ids_for_bulk_renew.present? && params[:renew].present? - end - - def set_form_data - @expire_date = params[:expire_date].to_date - @domains = domains_by_date(@expire_date) - @period = params[:period] - end - - def available_contacts - current_registrar_user.registrar.contacts.order(:name).pluck(:name, :code) - end - - def default_tab - :technical_contact - end - - def domains_scope - current_registrar_user.registrar.domains - end - - def domains_by_date(date) - domains_scope.where('valid_to <= ?', date) - end - - def domain_ids_for_bulk_renew - params['domain_ids']&.reject { |id| id.blank? } - end - - def renew_task(domains) - Domains::BulkRenew::Start.run(domains: domains, - period_element: @period, - registrar: current_registrar_user.registrar) - end - - def flash_message(res) - flash[:notice] = res['code'] == 1000 ? t(:bulk_renew_completed) : res['message'] - end - end -end diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb deleted file mode 100644 index 812e278e53..0000000000 --- a/app/controllers/registrar/contacts_controller.rb +++ /dev/null @@ -1,163 +0,0 @@ -class Registrar - class ContactsController < DeppController - before_action :init_epp_contact - helper_method :address_processing? - helper_method :ident_types - helper_method :domain_filter_params - - def index - authorize! :view, Depp::Contact - - params[:q] ||= {} - params[:q].delete_if { |_k, v| v.blank? } - - 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 - - contacts = current_registrar_user.registrar.contacts.includes(:registrar) - status_list = params[:statuses_contains] - - if status_list - contacts_ids = contacts.select { |c| (c.statuses & status_list.to_a) == status_list.to_a } - .map(&:id) - contacts = contacts.where(id: contacts_ids) - end - - normalize_search_parameters do - @q = contacts.ransack(search_params) - end - - contacts = @q.result - - respond_to do |format| - format.html do - contacts_per_page = params[:results_per_page].to_i - @contacts = contacts.page(params[:page]) - @contacts = @contacts.per(contacts_per_page) if contacts_per_page.positive? - end - format.csv do - raw_csv = CsvGenerator.generate_csv(contacts) - send_data raw_csv, filename: 'contacts.csv', type: "#{Mime[:csv]}; charset=utf-8" - end - format.pdf do - raw_html = ApplicationController.render( - template: 'registrar/contacts/list_pdf', - assigns: { contacts: contacts }, - formats: [:html] - ) - raw_pdf = contacts.pdf(raw_html) - - send_data raw_pdf, filename: 'contacts.pdf' - end - end - end - - def new - authorize! :create, Depp::Contact - @contact = Depp::Contact.new - end - - def show - authorize! :view, Depp::Contact - @contact = Depp::Contact.find_by_id(params[:id]) - end - - def edit - authorize! :edit, Depp::Contact - @contact = Depp::Contact.find_by_id(params[:id]) - end - - def create - authorize! :create, Depp::Contact - @contact = Depp::Contact.new(contact_params) - - if @contact.save - redirect_to registrar_contact_url(@contact.id) - else - render 'new' - end - end - - def update - authorize! :edit, Depp::Contact - @contact = Depp::Contact.new(contact_params) - - if @contact.update_attributes(contact_params) - redirect_to registrar_contact_url(@contact.id) - else - render 'edit' - end - end - - def delete - authorize! :delete, Depp::Contact - @contact = Depp::Contact.find_by_id(params[:id]) - end - - def destroy - authorize! :delete, Depp::Contact - @contact = Depp::Contact.new(contact_params_for_delete) - - if @contact.delete - redirect_to registrar_contacts_url, notice: t(:destroyed) - else - render 'delete' - end - end - - protected - - def domain_filter_params - params.permit(:domain_filter) - end - - private - - def init_epp_contact - Depp::Contact.user = depp_current_user - 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 address_processing? - Contact.address_processing? - end - - def ident_types - Contact::Ident.types - end - - def contact_params - params.require(:depp_contact).permit(:id, - :name, - :email, - :phone, - :org_name, - :ident, :ident_type, :ident_country_code, - :street, :city, :zip, :state, :country_code, - :password, - :legal_document, - :code) - end - - def contact_params_for_delete - params.require(:depp_contact).permit(:id, :password, :legal_document) - end - end -end diff --git a/app/controllers/registrar/current_user_controller.rb b/app/controllers/registrar/current_user_controller.rb deleted file mode 100644 index 3a214322c8..0000000000 --- a/app/controllers/registrar/current_user_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -class Registrar - class CurrentUserController < BaseController - skip_authorization_check - - def switch - raise 'Cannot switch to unlinked user' unless current_registrar_user.linked_with?(new_user) - - sign_in(:registrar_user, new_user) - redirect_back(fallback_location: root_path, notice: t('.switched', new_user: new_user)) - end - - private - - def new_user - @new_user ||= ApiUser.find(params[:new_user_id]) - end - end -end diff --git a/app/controllers/registrar/deposits_controller.rb b/app/controllers/registrar/deposits_controller.rb deleted file mode 100644 index 0dcaf6830b..0000000000 --- a/app/controllers/registrar/deposits_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class Registrar - class DepositsController < BaseController - authorize_resource class: false - - def new - @deposit = Deposit.new - end - - def create - @deposit = Deposit.new(deposit_params.merge(registrar: current_registrar_user.registrar)) - @invoice = @deposit.issue_prepayment_invoice - - if @invoice - flash[:notice] = t(:please_pay_the_following_invoice) - redirect_to [:registrar, @invoice] - else - flash[:alert] = @deposit.errors.full_messages.join(', ') - redirect_to new_registrar_deposit_path - end - end - - private - - def deposit_params - params.require(:deposit).permit(:amount, :description) - end - end -end diff --git a/app/controllers/registrar/depp_controller.rb b/app/controllers/registrar/depp_controller.rb deleted file mode 100644 index 70fb01c4a4..0000000000 --- a/app/controllers/registrar/depp_controller.rb +++ /dev/null @@ -1,37 +0,0 @@ -class Registrar - class DeppController < BaseController - helper_method :depp_current_user - - rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |exception| - logger.error 'COULD NOT CONNECT TO REGISTRY' - logger.error exception.backtrace.join("\n") - redirect_to new_registrar_user_session_url, alert: t(:no_connection_to_registry) - end - - before_action :authenticate_user - - def authenticate_user - redirect_to new_registrar_user_session_url and return unless depp_current_user - end - - def depp_controller? - true - end - - def depp_current_user - return nil unless current_registrar_user - @depp_current_user ||= Depp::User.new( - tag: current_registrar_user.username, - password: current_registrar_user.plain_text_password - ) - end - - def response_ok? - @data.css('result').each do |x| - success_codes = %(1000, 1001, 1300, 1301) - return false unless success_codes.include?(x['code']) - end - true - end - end -end diff --git a/app/controllers/registrar/domain_transfers_controller.rb b/app/controllers/registrar/domain_transfers_controller.rb deleted file mode 100644 index 57e06d0102..0000000000 --- a/app/controllers/registrar/domain_transfers_controller.rb +++ /dev/null @@ -1,49 +0,0 @@ -class Registrar - class DomainTransfersController < BulkChangeController - before_action do - authorize! :transfer, Depp::Domain - end - - def new - end - - def create - if params[:batch_file].present? - csv = CSV.read(params[:batch_file].path, headers: true) - domain_transfers = [] - - csv.each do |row| - domain_name = row['Domain'] - transfer_code = row['Transfer code'] - domain_transfers << { 'domain_name' => domain_name, 'transfer_code' => transfer_code } - end - - uri = URI.parse("#{ENV['repp_url']}domains/transfer") - request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') - request.body = { data: { domain_transfers: domain_transfers } }.to_json - request.basic_auth(current_registrar_user.username, - current_registrar_user.plain_text_password) - - action = Actions::DoRequest.new(request, uri) - response = action.call - - parsed_response = JSON.parse(response.body, symbolize_names: true) - - if response.code == '200' - failed = parsed_response[:data][:failed].pluck(:domain_name).join(', ') - flash[:notice] = t('.transferred', count: parsed_response[:data][:success].size, - failed: failed) - redirect_to registrar_domains_url - else - @api_errors = parsed_response[:message] - render 'registrar/bulk_change/new', locals: { active_tab: :bulk_transfer } - end - else - params[:request] = true # EPP domain:transfer "op" attribute - domain = Depp::Domain.new(current_user: depp_current_user) - @data = domain.transfer(params) - render :new unless response_ok? - end - end - end -end diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb deleted file mode 100644 index 3347f5d38e..0000000000 --- a/app/controllers/registrar/domains_controller.rb +++ /dev/null @@ -1,229 +0,0 @@ -class Registrar - class DomainsController < DeppController - before_action :init_domain, except: :new - helper_method :contacts - helper_method :search_params - - def index - authorize! :view, Depp::Domain - - if search_params.to_h.delete_if { |_key, value| value.blank? }.length == 1 && - search_params[:name_matches].present? - domain = Domain.find_by(name: search_params[:name_matches]) - - redirect_to info_registrar_domains_url(domain_name: domain.name) and return if domain - end - - domains = if params[:statuses_contains] - current_domain_scope.where('domains.statuses @> ?::varchar[]', - "{#{params[:statuses_contains].join(',')}}") - else - current_domain_scope - end - - domains = domains.where(contacts: { ident: params[:contacts_ident_eq] }) if params[:contacts_ident_eq] - - normalize_search_parameters do - @q = domains.ransack(search_params.except(:contacts_ident_eq)) - @domains = @q.result.page(params[:page]) - - # if we do not get any results, add wildcards to the name field and search again - if @domains.count == 0 && search_params[:name_matches] !~ /^%.+%$/ - new_search_params = search_params.to_h.except(:contacts_ident_eq) - new_search_params[:name_matches] = "%#{new_search_params[:name_matches]}%" - @q = domains.ransack(new_search_params) - @domains = @q.result.page(params[:page]) - end - end - - @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? - - respond_to do |format| - format.html - format.csv do - domain_presenters = [] - - @domains.find_each do |domain| - domain_presenters << ::DomainPresenter.new(domain: domain, view: view_context) - end - - raw_csv = Registrar::DomainListCsvPresenter.new(domains: domain_presenters, - view: view_context).to_s - filename = "Domains_#{l(Time.zone.now, format: :filename)}.csv" - send_data raw_csv, filename: filename, type: "#{Mime[:csv]}; charset=utf-8" - end - end - end - - def current_domain_scope - current_registrar_user.registrar.domains.includes(:registrar, :registrant) - end - - def info - authorize! :info, Depp::Domain - @data = @domain.info(params[:domain_name]) if params[:domain_name] - @pending_delete = domain_delete_pending(@data) - @client_holded = client_holded(@data) - if response_ok? - render 'info' - else - flash[:alert] = @data.css('msg').text - redirect_to registrar_domains_url and return - end - end - - def check - authorize! :check, Depp::Domain - if params[:domain_name] - @data = @domain.check(params[:domain_name]) - render 'check_index' and return unless response_ok? - else - render 'check_index' - end - end - - def new - authorize! :create, Depp::Domain - @domain_params = Depp::Domain.default_params - @domain_params[:period] = Depp::Domain.default_period - end - - # rubocop:disable Metrics/CognitiveComplexity - def create - authorize! :create, Depp::Domain - @domain_params = domain_params.to_h - @data = @domain.create(@domain_params) - - if @data && response_ok? - redirect_to info_registrar_domains_url(domain_name: @domain_params[:name]) - else - flash[:alert] = t('.email_error_message') unless @emails_check_result - render 'new' - end - end - - def edit - authorize! :update, Depp::Domain - @data = @domain.info(params[:domain_name]) - @domain_params = Depp::Domain.construct_params_from_server_data(@data) - @dispute = Dispute.active.find_by(domain_name: params[:domain_name]) - end - - def update - authorize! :update, Depp::Domain - @domain_params = params[:domain] - @data = @domain.update(@domain_params) - @dispute = Dispute.active.find_by(domain_name: @domain_params[:name]) - - if @data && response_ok? - redirect_to info_registrar_domains_url(domain_name: @domain_params[:name]) - else - flash[:alert] = t('.email_error_message') unless @emails_check_result - params[:domain_name] = @domain_params[:name] - render 'new' - end - end - # rubocop:enable Metrics/CognitiveComplexity - - def delete - authorize! :delete, Depp::Domain - end - - def destroy - authorize! :delete, Depp::Domain - @data = @domain.delete(params[:domain]) - @results = @data.css('result') - if response_ok? - flash[:notice] = t('.deleting_request') - redirect_to info_registrar_domains_url(domain_name: params[:domain][:name]) - else - params[:domain_name] = params[:domain][:name] - render 'delete' - end - end - - def renew - authorize! :renew, Depp::Domain - if params[:domain_name] && params[:cur_exp_date] - @data = @domain.renew(params) - render 'renew_index' and return unless response_ok? - else - params[:period] = Depp::Domain.default_period - render 'renew_index' - end - end - - def search_contacts - authorize! :create, Depp::Domain - - scope = current_registrar_user.registrar.contacts.limit(10) - if params[:query].present? - escaped_str = ActiveRecord::Base.connection.quote_string params[:query] - scope = scope.where("name ilike '%#{escaped_str}%' OR code ilike '%#{escaped_str}%' ") - end - - render json: scope.pluck(:name, :code).map { |c| { display_key: "#{c.second} #{c.first}", value: c.second } } - end - - def remove_hold - authorize! :remove_hold, Depp::Domain - return unless params[:domain_name] - - @data = @domain.remove_hold(params) - - flash[:alert] = @data.css('msg').text unless response_ok? - redirect_to info_registrar_domains_url(domain_name: params[:domain_name]) - end - - private - - def init_domain - @domain = Depp::Domain.new(current_user: depp_current_user) - end - - def client_holded(data) - data.css('status')&.map { |element| element.attribute('s').value } - &.any? { |status| status == DomainStatus::CLIENT_HOLD } - end - - def domain_delete_pending(data) - data.css('status')&.map { |element| element.attribute('s').value } - &.any? { |status| status.include?(DomainStatus::PENDING_DELETE) } - end - - def contacts - current_registrar_user.registrar.contacts - end - - def normalize_search_parameters - ca_cache = search_params[:valid_to_lteq] - begin - end_time = search_params[:valid_to_lteq].try(:to_date) - search_params[:valid_to_lteq] = end_time.try(:end_of_day) - rescue - logger.warn('Invalid date') - end - - yield - - search_params[:valid_to_lteq] = ca_cache - end - - def search_params - params.fetch(:q, {}).permit(:name_matches, - :registrant_ident_eq, - :contacts_ident_eq, - :nameservers_hostname_eq, - :valid_to_gteq, - :valid_to_lteq, - :s) - end - - def domain_params - params.require(:domain).permit(:name, :period, :registrant, :registrant_helper, :reserved_pw, - :verified, :legal_document, contacts_attributes: {}, - nameservers_attributes: {}, - dnskeys_attributes: {}) - end - end -end diff --git a/app/controllers/registrar/invoices/delivery_controller.rb b/app/controllers/registrar/invoices/delivery_controller.rb deleted file mode 100644 index 8cdbb9196d..0000000000 --- a/app/controllers/registrar/invoices/delivery_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Registrar - module Invoices - class DeliveryController < BaseController - include Deliverable - - private - - def redirect_url - registrar_invoice_path(@invoice) - end - end - end -end diff --git a/app/controllers/registrar/invoices_controller.rb b/app/controllers/registrar/invoices_controller.rb deleted file mode 100644 index 2a17b72b08..0000000000 --- a/app/controllers/registrar/invoices_controller.rb +++ /dev/null @@ -1,38 +0,0 @@ -class Registrar - class InvoicesController < BaseController - load_and_authorize_resource - - def index - params[:q] ||= {} - invoices = current_registrar_user.registrar.invoices.includes(:items, :account_activity) - - normalize_search_parameters do - @q = invoices.ransack(params[:q]) - @q.sorts = 'id desc' if @q.sorts.empty? - @invoices = @q.result.page(params[:page]) - end - end - - def show; end - - def cancel - @invoice.cancel - EisBilling::SendInvoiceStatus.send_info(invoice_number: @invoice.number, status: 'cancelled') - - redirect_to [:registrar, @invoice], notice: t('.cancelled') - end - - def download - filename = "invoice-#{@invoice.number}.pdf" - send_data @invoice.as_pdf, filename: filename - end - - private - - def normalize_search_parameters - params[:q][:total_gteq].gsub!(',', '.') if params[:q][:total_gteq] - params[:q][:total_lteq].gsub!(',', '.') if params[:q][:total_lteq] - yield - end - end -end diff --git a/app/controllers/registrar/nameservers_controller.rb b/app/controllers/registrar/nameservers_controller.rb deleted file mode 100644 index 9bf31d1d7d..0000000000 --- a/app/controllers/registrar/nameservers_controller.rb +++ /dev/null @@ -1,65 +0,0 @@ -class Registrar - class NameserversController < BulkChangeController - def update - authorize! :manage, :repp - - ipv4 = params[:ipv4].split("\r\n") - ipv6 = params[:ipv6].split("\r\n") - - uri = URI.parse("#{ENV['repp_url']}registrar/nameservers") - - domains = domain_list_from_csv - - return csv_list_empty_guard if domains == [] - - options = { - uri: uri, - ipv4: ipv4, - ipv6: ipv6, - } - action = Actions::BulkNameserversChange.new(params, domains, current_registrar_user, options) - response = action.call - - parsed_response = JSON.parse(response.body, symbolize_names: true) - - if response.code == '200' - redirect_to(registrar_domains_url, - flash: { notice: compose_notice_message(parsed_response) }) - else - @api_errors = parsed_response[:message] - render 'registrar/bulk_change/new', locals: { active_tab: :nameserver } - end - end - - def compose_notice_message(res) - action_text = params[:old_hostname].blank? ? t('.added') : t('.replaced') - notices = ["#{action_text}. #{t('.affected_domains')}: " \ - "#{res[:data][:affected_domains].join(', ')}"] - - notices << "#{t('.skipped_domains')}: #{res[:data][:skipped_domains].join(', ')}" if res[:data][:skipped_domains] - - notices.join(', ') - end - - def csv_list_empty_guard - notice = 'CSV scoped domain list seems empty. Make sure that domains are added and ' \ - '"Domain" header is present.' - redirect_to(registrar_domains_url, flash: { notice: notice }) - end - - def domain_list_from_csv - return if params[:puny_file].blank? - - domains = [] - csv = CSV.read(params[:puny_file].path, headers: true) - - return [] if csv['Domain'].blank? - - csv.map { |b| domains << b['Domain'] } - - domains.compact - rescue CSV::MalformedCSVError - [] - end - end -end diff --git a/app/controllers/registrar/payments_controller.rb b/app/controllers/registrar/payments_controller.rb deleted file mode 100644 index 598d13446b..0000000000 --- a/app/controllers/registrar/payments_controller.rb +++ /dev/null @@ -1,66 +0,0 @@ -class Registrar - class PaymentsController < BaseController - protect_from_forgery except: [:back, :callback] - - skip_authorization_check # actually anyone can pay, no problems at all - skip_before_action :authenticate_registrar_user!, :check_ip_restriction, - only: [:back, :callback] - - before_action :check_supported_payment_method, only: [:pay] - - def pay - invoice = Invoice.find(params[:invoice_id]) - channel = params[:bank] - - @payment_order = PaymentOrder.new_with_type(type: channel, invoice: invoice) - @payment_order.save - @payment_order.reload - - @payment_order.return_url = registrar_return_payment_with_url(@payment_order) - @payment_order.response_url = registrar_response_payment_with_url(@payment_order) - - @payment_order.save - @payment_order.reload - end - - def back - @payment_order = PaymentOrder.find_by!(id: params[:payment_order]) - @payment_order.update!(response: params.to_unsafe_h) - - if @payment_order.payment_received? - @payment_order.complete_transaction - - if @payment_order.invoice.paid? - flash[:notice] = t('.payment_successful') - else - flash[:alert] = t('.successful_payment_backend_error') - end - else - @payment_order.create_failure_report - flash[:alert] = t('.payment_not_received') - end - redirect_to registrar_invoice_path(@payment_order.invoice) - end - - def callback - @payment_order = PaymentOrder.find_by!(id: params[:payment_order]) - @payment_order.update!(response: params.to_unsafe_h) - - if @payment_order.payment_received? - @payment_order.complete_transaction - else - @payment_order.create_failure_report - end - - render status: 200, json: { status: 'ok' } - end - - private - - def check_supported_payment_method - return if PaymentOrder.supported_method?(params[:bank], shortname: true) - - raise(StandardError, 'Not supported payment method') - end - end -end diff --git a/app/controllers/registrar/polls_controller.rb b/app/controllers/registrar/polls_controller.rb deleted file mode 100644 index dde4bb8ea4..0000000000 --- a/app/controllers/registrar/polls_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Registrar - class PollsController < DeppController - authorize_resource class: false - before_action :init_epp_xml - - def show - if Rails.env.test? # Stub for depp server request - @data = Object.new - - def @data.css(key) - ; []; - end - else - @data = depp_current_user.request(@ex.poll) - end - end - - def destroy - @data = depp_current_user.request(@ex.poll(poll: { value: '', attrs: { op: 'ack', msgID: params[:id] } })) - - @results = @data.css('result') - - @data = depp_current_user.request(@ex.poll) - render 'show' - end - - def confirm_transfer - domain_params = params[:domain] - @data = @domain.confirm_transfer(domain_params) - - @results = @data.css('result') - @data = depp_current_user.request(@ex.poll) - - render 'show' - end - - private - - def init_epp_xml - @ex = EppXml::Session.new(cl_trid_prefix: depp_current_user.tag) - @domain = Depp::Domain.new(current_user: depp_current_user) - end - end -end diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb deleted file mode 100644 index c73ed799b3..0000000000 --- a/app/controllers/registrar/sessions_controller.rb +++ /dev/null @@ -1,108 +0,0 @@ -class Registrar - class SessionsController < Devise::SessionsController - before_action :check_ip_restriction - helper_method :depp_controller? - - def create - @depp_user = Depp::User.new(depp_user_params) - - if @depp_user.pki && request.env['HTTP_SSL_CLIENT_S_DN_CN'].blank? - @depp_user.errors.add(:base, :webserver_missing_user_name_directive) - end - - if @depp_user.pki && request.env['HTTP_SSL_CLIENT_CERT'].blank? - @depp_user.errors.add(:base, :webserver_missing_client_cert_directive) - end - - if @depp_user.pki && request.env['HTTP_SSL_CLIENT_S_DN_CN'] == '(null)' - @depp_user.errors.add(:base, :webserver_user_name_directive_should_be_required) - end - - if @depp_user.pki && request.env['HTTP_SSL_CLIENT_CERT'] == '(null)' - @depp_user.errors.add(:base, :webserver_client_cert_directive_should_be_required) - end - - @api_user = ApiUser.find_by(username: sign_in_params[:username], - plain_text_password: sign_in_params[:password]) - - unless @api_user - @depp_user.errors.add(:base, t(:no_such_user)) - show_error and return - end - - if @depp_user.pki && !@api_user.pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'], - request.env['HTTP_SSL_CLIENT_S_DN_CN'], api: false) - @depp_user.errors.add(:base, :invalid_cert) - end - - show_error and return unless @depp_user.errors.none? - - if @api_user.active? - sign_in_and_redirect(:registrar_user, @api_user) - else - @depp_user.errors.add(:base, :not_active) - show_error - end - end - - private - - def depp_controller? - false - end - - def find_user_by_idc(idc) - return User.new unless idc - ApiUser.find_by(identity_code: idc) || User.new - end - - def find_user_by_idc_and_allowed(idc) - return User.new unless idc - - possible_users = ApiUser.where(identity_code: idc) || User.new - possible_users.each do |selected_user| - return selected_user if selected_user.registrar.white_ips.registrar_area.include_ip?(request.ip) - end - end - - def check_ip_restriction - ip_restriction = Authorization::RestrictedIp.new(request.ip) - allowed = ip_restriction.can_access_registrar_area_sign_in_page? - - return if allowed - - render plain: t('registrar.authorization.ip_not_allowed', ip: request.ip) - end - - def current_ability - @current_ability ||= Ability.new(current_registrar_user, request.remote_ip) - end - - def after_sign_in_path_for(_resource_or_scope) - if can?(:show, :poll) - registrar_root_path - else - registrar_account_path - end - end - - def after_sign_out_path_for(_resource_or_scope) - new_registrar_user_session_path - end - - def user_for_paper_trail - current_registrar_user ? current_registrar_user.id_role_username : 'anonymous' - end - - def depp_user_params - params = sign_in_params - params[:tag] = params.delete(:username) - params.merge!(pki: !(Rails.env.development? || Rails.env.test?)) - params - end - - def show_error - redirect_to new_registrar_user_session_url, alert: @depp_user.errors.full_messages.first - end - end -end diff --git a/app/controllers/registrar/settings/balance_auto_reload_controller.rb b/app/controllers/registrar/settings/balance_auto_reload_controller.rb deleted file mode 100644 index d6ace12ef1..0000000000 --- a/app/controllers/registrar/settings/balance_auto_reload_controller.rb +++ /dev/null @@ -1,52 +0,0 @@ -class Registrar - module Settings - class BalanceAutoReloadController < BaseController - before_action :authorize - - def edit - @type = if current_registrar.settings['balance_auto_reload'] - type_params = current_registrar.settings['balance_auto_reload']['type'] - .except('name') - BalanceAutoReloadTypes::Threshold.new(type_params) - else - BalanceAutoReloadTypes::Threshold.new - end - end - - def update - type = BalanceAutoReloadTypes::Threshold.new(type_params) - current_registrar.update!(settings: { balance_auto_reload: { type: type } }) - - redirect_to registrar_account_path, notice: t('.saved') - end - - def destroy - current_registrar.settings.delete('balance_auto_reload') - current_registrar.save! - - redirect_to registrar_account_path, notice: t('.disabled') - end - - private - - def type_params - permitted_params = params.require(:type).permit(:amount, :threshold) - normalize_params(permitted_params) - end - - def normalize_params(params) - params[:amount] = params[:amount].to_f - params[:threshold] = params[:threshold].to_f - params - end - - def authorize - authorize!(:manage, :balance_auto_reload) - end - - def current_registrar - current_registrar_user.registrar - end - end - end -end diff --git a/app/controllers/registrar/tech_contacts_controller.rb b/app/controllers/registrar/tech_contacts_controller.rb deleted file mode 100644 index 9a5631abfd..0000000000 --- a/app/controllers/registrar/tech_contacts_controller.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Registrar - class TechContactsController < BulkChangeController - BASE_URL = URI.parse("#{ENV['repp_url']}domains/contacts").freeze - ACTIVE_TAB = :technical_contact - - def update - authorize! :manage, :repp - - uri = BASE_URL - request = form_request(uri) - - action = Actions::DoRequest.new(request, uri) - response = action.call - - start_notice = t('.replaced') - - process_response(response: response, - start_notice: start_notice, - active_tab: ACTIVE_TAB) - end - end -end diff --git a/app/controllers/registrar/xml_consoles_controller.rb b/app/controllers/registrar/xml_consoles_controller.rb deleted file mode 100644 index a27e3e3ee7..0000000000 --- a/app/controllers/registrar/xml_consoles_controller.rb +++ /dev/null @@ -1,62 +0,0 @@ -class Registrar - class XmlConsolesController < DeppController - PREFS = %w[ - domain-ee - contact-ee - eis - epp-ee - ].freeze - - authorize_resource class: false - - def show; end - - def create - begin - @result = depp_current_user.server.request(params[:payload]) - rescue StandardError - @result = 'CONNECTION ERROR - Is the EPP server running?' - end - render :show - end - - def load_xml - cl_trid = "#{depp_current_user.tag}-#{Time.zone.now.to_i}" - xml_dir_path = Rails.root.join('app/views/registrar/xml_consoles/epp_requests').to_s - xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml") - xml = prepare_payload(xml, cl_trid) - - render plain: xml - end - - private - - def prepare_payload(xml, cl_trid) - PREFS.map do |pref| - xml = load_schema_by_prefix(pref, xml) - end - - xml.gsub!('ABC-12345', "#{cl_trid}") - xml - end - - def load_schema_by_prefix(pref, xml) - case pref - when 'epp-ee' - insert_prefix_and_version(xml, pref, '1.0') - when 'eis' - insert_prefix_and_version(xml, pref, '1.0') - when 'contact-ee' - insert_prefix_and_version(xml, pref, '1.1') - else - insert_prefix_and_version(xml, pref, '1.2') - end - end - - def insert_prefix_and_version(xml, pref, version) - xml.gsub!("\"#{pref}\"", - "\"#{Xsd::Schema.filename(for_prefix: pref.to_s, for_version: version)}\"") - xml - end - end -end diff --git a/app/views/layouts/registrar/base.html.erb b/app/views/layouts/registrar/base.html.erb deleted file mode 100644 index 5881dd4004..0000000000 --- a/app/views/layouts/registrar/base.html.erb +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - <% if content_for? :head_title %> - <%= yield :head_title %> - <% else %> - - <%= t(:registrar_head_title) %> - - <% end %> - <%= csrf_meta_tags %> - <%= stylesheet_link_tag 'registrar-manifest', media: 'all' %> - <%= favicon_link_tag 'favicon.ico' %> - - - -
- <%= render 'flash_messages' %> - <% if depp_controller? %> - <%= render 'registrar/shared/epp_results' %> - <% end %> - <%= yield %> -
- - <%= javascript_include_tag 'registrar-manifest', async: true %> - - diff --git a/app/views/layouts/registrar/sessions.html.erb b/app/views/layouts/registrar/sessions.html.erb deleted file mode 100644 index ace6451998..0000000000 --- a/app/views/layouts/registrar/sessions.html.erb +++ /dev/null @@ -1,53 +0,0 @@ - - - - - <% if content_for? :head_title %> - <%= yield :head_title %> - <% else %> - - <%= t(:registrar_head_title) %> - - <% end %> - <%= csrf_meta_tags %> - <%= stylesheet_link_tag 'registrar-manifest', media: 'all' %> - <%= javascript_include_tag 'registrar-manifest' %> - - - - -
- <%= render 'flash_messages' %> - <%= yield %> -
- - - - diff --git a/app/views/registrar/account/_balance_auto_reload.html.erb b/app/views/registrar/account/_balance_auto_reload.html.erb deleted file mode 100644 index 9b6f2791a4..0000000000 --- a/app/views/registrar/account/_balance_auto_reload.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -
-
- <%= t '.header' %> -
- -
- <% if setting %> - <%= t '.enabled' %> - <%= t '.enabled_state_details', amount: number_to_currency(setting['type']['amount']), - threshold: number_to_currency(setting['type']['threshold']) %> - <% else %> - <%= t '.disabled' %> - <% end %> -
- - -
\ No newline at end of file diff --git a/app/views/registrar/account/_details.html.erb b/app/views/registrar/account/_details.html.erb deleted file mode 100644 index 185b046c80..0000000000 --- a/app/views/registrar/account/_details.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -
-
- <%= t '.header' %> -
- -
-
-
<%= Registrar.human_attribute_name :billing_email %>
-
<%= registrar.billing_email %>
- -
<%= Registrar.human_attribute_name :iban %>
-
<%= registrar.iban %>
-
-
- - -
diff --git a/app/views/registrar/account/_form.html.erb b/app/views/registrar/account/_form.html.erb deleted file mode 100644 index ab1fb02947..0000000000 --- a/app/views/registrar/account/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<%= form_for @registrar, url: registrar_account_path, method: :patch, html: { class: 'form-horizontal' } do |f| %> - <%= render 'form_errors', target: @registrar %> - -
-
- <%= f.label :billing_email %> -
- -
- <%= f.email_field :billing_email, autofocus: true, class: 'form-control' %> -
-
- -
-
- <%= f.label :iban %> -
- -
- <%= f.text_field :iban, maxlength: iban_max_length, class: 'form-control' %> - <%= t '.iban_hint' %> -
-
- -
- -
-
- <%= f.submit t('.submit_btn'), class: 'btn btn-success' %> -
-
-<% end %> \ No newline at end of file diff --git a/app/views/registrar/account/_linked_users.html.erb b/app/views/registrar/account/_linked_users.html.erb deleted file mode 100644 index fa8d868b41..0000000000 --- a/app/views/registrar/account/_linked_users.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -
-
<%= t '.header' %>
-
-
    - <% linked_users.each do |user| %> - <% user_presenter = UserPresenter.new(user: user, view: self) %> -
  • <%= user_presenter.login_with_role %> - <%= link_to t('.switch_btn'), - registrar_switch_current_user_path(user), - method: :put, - id: "switch-current-user-#{user.id}-btn", - class: 'btn btn-primary btn-xs' %> -
  • - <% end %> -
-
-
- diff --git a/app/views/registrar/account/edit.html.erb b/app/views/registrar/account/edit.html.erb deleted file mode 100644 index 20aa88d2df..0000000000 --- a/app/views/registrar/account/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ - - - - -<%= render 'form' %> \ No newline at end of file diff --git a/app/views/registrar/account/show.html.erb b/app/views/registrar/account/show.html.erb deleted file mode 100644 index 75d0ce400b..0000000000 --- a/app/views/registrar/account/show.html.erb +++ /dev/null @@ -1,23 +0,0 @@ - - -
-
- <%= render 'details', registrar: current_registrar_user.registrar %> -
-
- -
-
- <%= render 'linked_users', linked_users: current_registrar_user.linked_users %> -
-
- -<% if can?(:manage, :balance_auto_reload) %> -
-
- <%= render 'balance_auto_reload', setting: balance_auto_reload_setting %> -
-
-<% end %> \ No newline at end of file diff --git a/app/views/registrar/account_activities/_search_form.html.erb b/app/views/registrar/account_activities/_search_form.html.erb deleted file mode 100644 index 92a7150963..0000000000 --- a/app/views/registrar/account_activities/_search_form.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -
-
- <%= search_form_for @q, url: [:registrar, :account_activities], html: { style: 'margin-bottom: 0;' } do |f| %> -
-
-
- <%= f.label t(:activity_type) %> - <%= f.select :activity_type_in, AccountActivity.types_for_select, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true %> -
-
- -
-
- <%= f.label t(:description) %> - <%= f.search_field :description_cont, class: 'form-control', placeholder: t(:description), autocomplete: 'off' %> -
-
-
- -
-
-
- <%= f.label t(:receipt_date_from) %> - <%= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_from) %> -
-
- -
-
- <%= f.label t(:receipt_date_until) %> - <%= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_until) %> -
-
- -
- - <%= button_tag t('.download_btn'), - formaction: registrar_account_activities_path(format: 'csv'), - class: 'btn btn-default' %> - <%= link_to(t('.reset_btn'), registrar_account_activities_path, class: 'btn btn-default') %> -
-
- <% end %> -
-
diff --git a/app/views/registrar/account_activities/index.html.erb b/app/views/registrar/account_activities/index.html.erb deleted file mode 100644 index aefcdd47f1..0000000000 --- a/app/views/registrar/account_activities/index.html.erb +++ /dev/null @@ -1,66 +0,0 @@ -<% content_for :actions do %> - <%= link_to(t(:back_to_billing), registrar_invoices_path, class: 'btn btn-default') %> -<% end %> - -<%= render 'shared/title', name: t(:account_activity) %> - -<%= render 'search_form' %> - -
- -
-
-
- - - - - - - - - - - - <% @account_activities.each do |x| %> - - - - - <% c = x.sum > 0.0 ? 'text-success' : 'text-danger' %> - <% s = x.sum > 0.0 ? "+#{x.sum} #{x.currency}" : "#{x.sum} #{x.currency}" %> - - - - <% end %> - -
- <%= sort_link(@q, 'description') %> - - <%= sort_link(@q, 'activity_type') %> - - <%= sort_link(@q, 'created_at', AccountActivity.human_attribute_name(:created_at)) %> - - <%= sort_link(@q, 'sum') %> - - <%= sort_link(@q, 'new_balance', 'New balance') %> -
- <%= x.description.present? ? x.description : '-' %> - - <%= x.activity_type ? t(x.activity_type) : '' %> - - <%= l(x.created_at) %> - - <%= s %> - - <%= x.new_balance.present? ? "#{currency(x.new_balance)} EUR" : 'N/A' %> -
-
-
-
- -
-
- <%= paginate @account_activities %> -
-
diff --git a/app/views/registrar/base/_current_user.html.erb b/app/views/registrar/base/_current_user.html.erb deleted file mode 100644 index a21792b3cf..0000000000 --- a/app/views/registrar/base/_current_user.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<% current_user_presenter = UserPresenter.new(user: current_registrar_user, view: self) %> -<%= link_to current_user_presenter.login_with_role, registrar_account_path, class: 'navbar-link' %> -| -<%= link_to t('.sign_out'), destroy_registrar_user_session_path, method: :delete, class: 'navbar-link' %> diff --git a/app/views/registrar/base/_form_errors.html.erb b/app/views/registrar/base/_form_errors.html.erb deleted file mode 100644 index 0f898c81d7..0000000000 --- a/app/views/registrar/base/_form_errors.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<% if target.errors.any? %> -
-

<%= pluralize(target.errors.count, 'error') %> prohibited this <%= target.model_name.human.downcase %> from being saved:

- - -
-<% end %> diff --git a/app/views/registrar/base/_navbar.haml b/app/views/registrar/base/_navbar.haml deleted file mode 100644 index 4361e8b31f..0000000000 --- a/app/views/registrar/base/_navbar.haml +++ /dev/null @@ -1,20 +0,0 @@ -.navbar-collapse.collapse - %ul.nav.navbar-nav - - if can? :view, Depp::Domain - - active_class = %w(registrar/domains registrar/check registrar/renew registrar/tranfer).include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:domains), registrar_domains_path - - - if can? :view, Depp::Contact - - active_class = ['registrar/contacts'].include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:contacts), registrar_contacts_path - - - if can? :show, Invoice - - active_class = ['registrar/invoices'].include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:billing), registrar_invoices_path - - - if !Rails.env.production? && can?(:manage, :xml_console) - - active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path - - %div.navbar-text.navbar-right - = render 'current_user' diff --git a/app/views/registrar/bulk_change/_admin_contact_form.html.erb b/app/views/registrar/bulk_change/_admin_contact_form.html.erb deleted file mode 100644 index 77734e872a..0000000000 --- a/app/views/registrar/bulk_change/_admin_contact_form.html.erb +++ /dev/null @@ -1,65 +0,0 @@ -<%= form_tag registrar_admin_contacts_path, method: :patch, class: 'form-horizontal' do %> - <% if @error %> -
- <%= @error %> -
- <% end %> - -
-
-
-

<%= t '.comment' %>

-
-
-
- <%= label_tag :current_contact_id, t('.current_contact_id') %> -
- -
- <%= text_field_tag :current_contact_id, params[:current_contact_id], - list: :contacts, - required: true, - autofocus: true, - class: 'form-control' %> -
-
- -
-
- <%= label_tag :new_contact_id, t('.new_contact_id') %> -
- -
- <%= text_field_tag :new_contact_id, params[:new_contact_id], - list: :contacts, - required: true, - class: 'form-control' %> -
-
- -
-
- -
-
- -
-
- <%= t '.help_btn' %> -
-
- <%= t '.help' %> -
-
-
-
-<% end %> - - - <% available_contacts.each do |data| %> - - <% end %> - diff --git a/app/views/registrar/bulk_change/_api_errors.html.erb b/app/views/registrar/bulk_change/_api_errors.html.erb deleted file mode 100644 index 8d8862959e..0000000000 --- a/app/views/registrar/bulk_change/_api_errors.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<% if @api_errors %> -
- -
-<% end %> diff --git a/app/views/registrar/bulk_change/_bulk_renew_form.html.erb b/app/views/registrar/bulk_change/_bulk_renew_form.html.erb deleted file mode 100644 index 5db40365f7..0000000000 --- a/app/views/registrar/bulk_change/_bulk_renew_form.html.erb +++ /dev/null @@ -1,57 +0,0 @@ -<%= form_with url: registrar_bulk_renew_path, multipart: true, class: 'form-horizontal' do |f|%> - <%= render 'api_errors' %> - -
-
- <%= f.label :current_balance, t('.current_balance') %> -
-
- <%= number_to_currency current_registrar_user.registrar.balance %> -
-
- - -
-
- <%= f.label :expire_date, t('.expire_date') %> -
-
- <%= f.text_field :expire_date, value: @expire_date, - class: 'form-control js-datepicker'%> -
-
- -
-
- <%= f.label :period, t('.period'), class: 'required' %> -
-
- <%= select_tag 'period', - options_for_select(Depp::Domain::PERIODS, @period), { class: 'form-control' } %> -
-
- - <% if @domains.present? %> -
-
- <%= f.label :domain_ids, t('.domain_ids') %> -
-
- <%= f.collection_check_boxes :domain_ids, @domains, :name, :name, - checked: @domains.map(&:name) do |b|%> -
- <%= b.check_box %> - <%= b.label %> -
- <% end %> -
-
- <% end %> - -
- <%= f.submit "#{t '.filter_btn'}", name: 'filter', class: 'btn btn-warning' %> - <% if @domains.present? %> - <%= f.submit "#{t '.renew_btn'}", name: 'renew', class: 'btn btn-primary' %> - <% end %> -
-<% end %> diff --git a/app/views/registrar/bulk_change/_bulk_transfer_form.html.erb b/app/views/registrar/bulk_change/_bulk_transfer_form.html.erb deleted file mode 100644 index 0a953845b1..0000000000 --- a/app/views/registrar/bulk_change/_bulk_transfer_form.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<%= form_tag registrar_domain_transfers_path, multipart: true, class: 'form-horizontal' do %> - <%= render 'registrar/domain_transfers/form/api_errors' %> - -
-
- <%= label_tag :batch_file %> -
-
- <%= file_field_tag :batch_file, required: true %> - <%= t '.file_field_hint' %> -
-
- -
-
- -
-
- -
-
- <%= t '.help_btn' %> - -
-
- <%= t '.help' %> -
-
-
-
-<% end %> diff --git a/app/views/registrar/bulk_change/_nameserver_form.html.erb b/app/views/registrar/bulk_change/_nameserver_form.html.erb deleted file mode 100644 index 45ae6a7dda..0000000000 --- a/app/views/registrar/bulk_change/_nameserver_form.html.erb +++ /dev/null @@ -1,77 +0,0 @@ -<%= form_tag registrar_nameservers_path, multipart: true, method: :patch, class: 'form-horizontal' do %> - <%= render 'registrar/domain_transfers/form/api_errors' %> - -
-
- <%= label_tag :old_hostname, t('.old_hostname') %> -
- -
- <%= text_field_tag :old_hostname, params[:old_hostname], required: false, - class: 'form-control' %> -
-
- -
-
- <%= label_tag :new_hostname %> -
- -
- <%= text_field_tag :new_hostname, params[:new_hostname], required: true, - class: 'form-control' %> -
-
- -
-
- <%= label_tag :ipv4 %> -
- -
- <%= text_area_tag :ipv4, params[:ipv4], class: 'form-control' %> -
-
- -
-
- <%= label_tag :ipv6 %> -
- -
- <%= text_area_tag :ipv6, params[:ipv6], class: 'form-control' %> - <%= t '.ip_hint' %> -
-
- -
-
- <%= label_tag 'List of domains' %> -
-
- <%= file_field_tag :puny_file, required: false, accept: 'text/csv' %> - CSV format, must have domain_name header. List of domains that nameserver change should be scoped to. -
-
- -
-
- -
-
- -
-
- <%= t '.help_btn' %> - -
-
- <%= t '.help' %> -
-
-
-
-<% end %> diff --git a/app/views/registrar/bulk_change/_tech_contact_form.html.erb b/app/views/registrar/bulk_change/_tech_contact_form.html.erb deleted file mode 100644 index 789db92bab..0000000000 --- a/app/views/registrar/bulk_change/_tech_contact_form.html.erb +++ /dev/null @@ -1,60 +0,0 @@ -<%= form_tag registrar_tech_contacts_path, method: :patch, class: 'form-horizontal' do %> - <% if @error %> -
- <%= @error %> -
- <% end %> - -
-
- <%= label_tag :current_contact_id, t('.current_contact_id') %> -
- -
- <%= text_field_tag :current_contact_id, params[:current_contact_id], - list: :contacts, - required: true, - autofocus: true, - class: 'form-control' %> -
-
- -
-
- <%= label_tag :new_contact_id, t('.new_contact_id') %> -
- -
- <%= text_field_tag :new_contact_id, params[:new_contact_id], - list: :contacts, - required: true, - class: 'form-control' %> -
-
- -
-
- -
-
- -
-
- <%= t '.help_btn' %> -
-
- <%= t '.help' %> -
-
-
-
-<% end %> - - - <% available_contacts.each do |data| %> - - <% end %> - diff --git a/app/views/registrar/bulk_change/new.html.erb b/app/views/registrar/bulk_change/new.html.erb deleted file mode 100644 index f3095a53d3..0000000000 --- a/app/views/registrar/bulk_change/new.html.erb +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - -
-
- <%= render 'tech_contact_form', available_contacts: available_contacts %> -
- -
- <%= render 'admin_contact_form', available_contacts: available_contacts %> -
- -
- <%= render 'nameserver_form' %> -
- -
- <%= render 'bulk_transfer_form' %> -
- -
- <%= render 'bulk_renew_form' %> -
-
diff --git a/app/views/registrar/contacts/_form.haml b/app/views/registrar/contacts/_form.haml deleted file mode 100644 index 953c502e54..0000000000 --- a/app/views/registrar/contacts/_form.haml +++ /dev/null @@ -1,26 +0,0 @@ -= render 'registrar/shared/error_messages', f: f -= f.hidden_field :id -= f.hidden_field :password -.row - .col-md-8 - = render 'registrar/contacts/form/general', f: f - -- if Contact.address_processing? - .row - .col-md-8 - = render 'registrar/contacts/form/address', f: f - -- if !@contact.persisted? - .row - .col-md-8 - = render 'registrar/contacts/form/code', f: f -.row - .col-md-8 - = render 'registrar/contacts/form/legal_document', f: f - -.row - .col-md-8.text-right - - if @contact.persisted? - = button_tag t(:save), class: 'btn btn-warning' - - else - = button_tag t(:create), class: 'btn btn-warning' diff --git a/app/views/registrar/contacts/_search_form.html.erb b/app/views/registrar/contacts/_search_form.html.erb deleted file mode 100644 index 73c1281e00..0000000000 --- a/app/views/registrar/contacts/_search_form.html.erb +++ /dev/null @@ -1,117 +0,0 @@ -<%= search_form_for [:registrar, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f| %> -
-
-
- <%= f.label :name %> - <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %> -
-
- -
-
- <%= f.label t(:id) %> - <%= f.search_field :code_eq, class: 'form-control', placeholder: t(:id) %> -
-
- -
-
- <%= f.label t(:ident) %> - <%= f.search_field :ident_matches, class: 'form-control', placeholder: t(:ident) %> -
-
- -
-
- <%= label_tag t(:ident_type) %> - <%= select_tag '[q][ident_type_eq]', options_for_select(ident_types, params[:q][:ident_type_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' } %> -
-
-
- -
-
-
- <%= f.label t(:email) %> - <%= f.search_field :email_matches, class: 'form-control', placeholder: t(:email) %> -
-
- -
-
- <%= label_tag t(:country) %> - <%= select_tag '[q][country_code_eq]', ApplicationController.helpers.all_country_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' } %> -
-
- -
-
- <%= label_tag t(:contact_type) %> - <%= 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' } %> -
-
-
- -
-
-
- <%= f.label t(:registrar_name) %> - <%= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control selectize', placeholder: t(:choose) %> -
-
- -
-
- <%= f.label t(:created_at_from) %> - <%= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_at_from) %> -
-
- -
-
- <%= f.label t(:created_at_until) %> - <%= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_at_until) %> -
-
- -
-
- <%= f.label t(:updated_at) %> - <%= f.search_field :updated_at_gteq, value: params[:q][:updated_at_gteq], class: 'form-control js-datepicker', placeholder: t(:updated_at) %> -
-
-
- -
-
-
- <%= label_tag t(:status) %> - <%= select_tag :statuses_contains, options_for_select(Contact::STATUSES, params[:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' } %> -
-
- -
-
- <%= label_tag t(:results_per_page) %> - <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %> -
-
- -
- - <%= button_tag t('.download_pdf_btn'), - formaction: registrar_contacts_path(format: :pdf), - name: nil, - class: 'btn btn-default' %> - <%= button_tag t('.download_csv_btn'), - formaction: registrar_contacts_path(format: :csv), - name: nil, - class: 'btn btn-default' %> - <%= link_to(t('.reset_btn'), registrar_contacts_path, class: 'btn btn-default') %> -
-
-<% end %> diff --git a/app/views/registrar/contacts/delete.haml b/app/views/registrar/contacts/delete.haml deleted file mode 100644 index 8662b738c8..0000000000 --- a/app/views/registrar/contacts/delete.haml +++ /dev/null @@ -1,20 +0,0 @@ -- if @contact.persisted? - = render 'shared/title', name: "#{t(:delete)}: #{@contact.name}" - - = form_for(@contact, url: registrar_contact_path(@contact), - class: 'form-horizontal', multipart: true, method: :delete) do |f| - - = render 'registrar/shared/error_messages', f: f - = f.hidden_field :id - = f.hidden_field :password - - .row - .col-md-8 - = render 'registrar/contacts/form/legal_document', f: f - - %hr - .row - .col-md-8.text-right - = button_tag t(:delete), class: 'btn btn-danger' -- else - %h2= "#{t(:delete)}: #{t(:not_found)}" diff --git a/app/views/registrar/contacts/edit.haml b/app/views/registrar/contacts/edit.haml deleted file mode 100644 index bfbcf21e9a..0000000000 --- a/app/views/registrar/contacts/edit.haml +++ /dev/null @@ -1,5 +0,0 @@ -= render 'shared/title', name: "#{t(:edit)}: #{@contact.name}" - -= form_for(@contact, url: registrar_contact_path(@contact), - html: {class: 'form-horizontal js-contact-form'}) do |f| - - render 'form', f: f diff --git a/app/views/registrar/contacts/form/_address.haml b/app/views/registrar/contacts/form/_address.haml deleted file mode 100644 index e70d00cd82..0000000000 --- a/app/views/registrar/contacts/form/_address.haml +++ /dev/null @@ -1,36 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - .pull-left= t(:address) - .panel-body - .form-group - .col-md-3.control-label - = f.label :street, t(:street) + '*' - .col-md-7 - = f.text_field :street, class: 'form-control', required: true - - .form-group - .col-md-3.control-label - = f.label :city, t(:city) + '*' - .col-md-7 - = f.text_field :city, class: 'form-control', required: true - - .form-group - .col-md-3.control-label - = f.label :zip, t(:zip) + '*' - .col-md-7 - = f.text_field :zip, class: 'form-control', required: true - - .form-group - .col-md-3.control-label - = f.label :state, t(:state) - .col-md-7 - = f.text_field :state, class: 'form-control' - - .form-group - .col-md-3.control-label - = f.label :country_code, t(:country) + '*' - .col-md-7 - - country_selected = f.object.persisted? ? f.object.country_code : 'EE' - = f.select(:country_code, ApplicationController.helpers.all_country_options(country_selected), - { include_blank: true }, required: true) - diff --git a/app/views/registrar/contacts/form/_code.haml b/app/views/registrar/contacts/form/_code.haml deleted file mode 100644 index f4bc2733f3..0000000000 --- a/app/views/registrar/contacts/form/_code.haml +++ /dev/null @@ -1,9 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - .pull-left= t(:id) - .panel-body - .form-group - .col-md-2.control-label - = f.label :code, t(:id) - .col-md-10 - = f.text_field :code, class: 'form-control' diff --git a/app/views/registrar/contacts/form/_general.haml b/app/views/registrar/contacts/form/_general.haml deleted file mode 100644 index 5f1c900987..0000000000 --- a/app/views/registrar/contacts/form/_general.haml +++ /dev/null @@ -1,67 +0,0 @@ -- ident_complete = f.object.ident_country_code.present? && f.object.ident_type.present? && f.object.ident.present? -- if @contact.persisted? - - country_selected = f.object.ident_country_code || (params[:depp_contact].try(:[], :ident_country_code)) - - type_selected = f.object.ident_type || (params[:depp_contact].try(:[], :ident_type)) -- else - - country_selected = (params[:depp_contact].try(:[], :ident_country_code) || 'EE') - - type_selected = (params[:depp_contact].try(:[], :ident_type) || 'org') - -.panel.panel-default - .panel-heading.clearfix - .pull-left= t(:ident) - .panel-body - .form-group - .col-md-3.control-label - = f.label :ident_country_code, t(:country) + '*' - .col-md-7 - - if ident_complete && @contact.persisted? && f.object.ident_country_code.present? - = f.text_field :ident_country_code, value: f.object.ident_country_code, :readonly => true - - else - = f.select(:ident_country_code, ApplicationController.helpers.all_country_options(country_selected), {}, - class: 'js-ident-country-code', required: true) - - .form-group - .col-md-3.control-label - = f.label :ident_type, t(:type) + '*' - .col-md-7 - - if ident_complete && @contact.persisted? && f.object.ident_type.present? - = f.text_field :ident_type, value: f.object.ident_type, :readonly => true - - else - = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: type_selected }, - class: 'js-ident-type', required: true) - - .form-group - .col-md-3.control-label - = f.label :ident, t(:ident) + '*' - .col-md-7 - - if ident_complete && @contact.persisted? && f.object.ident.present? - = f.text_field :ident, value: f.object.ident, :readonly => true - - else - = f.text_field :ident, class: 'form-control', required: true - - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none' - .js-ident-tip{ style: tip_visibility } - = t(:birthday_format) - -.panel.panel-default - .panel-heading.clearfix - .pull-left= t(:general) - .panel-body - .form-group - .col-md-3.control-label - = f.label :name, t(:name) + '*' - .col-md-7 - = f.text_field :name, class: 'form-control', required: true - - .form-group - .col-md-3.control-label - = f.label :email, t(:email) + '*' - .col-md-7 - = f.email_field :email, class: 'form-control', required: true, - pattern: "[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" - - .form-group - .col-md-3.control-label - = f.label :phone, t(:phone) + '*' - .col-md-7 - = f.text_field :phone, class: 'form-control', - placeholder: '+372.12323344', required: true diff --git a/app/views/registrar/contacts/form/_legal_document.haml b/app/views/registrar/contacts/form/_legal_document.haml deleted file mode 100644 index 6507da1d90..0000000000 --- a/app/views/registrar/contacts/form/_legal_document.haml +++ /dev/null @@ -1,13 +0,0 @@ -.form-group - .col-md-10 - -.panel.panel-default - .panel-heading.clearfix - .pull-left= t(:legal_document) - .panel-body - .form-group - .col-md-3.control-label - = f.label :legal_document, t(:legal_document) - %p.help-block= t(:legal_document_max_size) - .col-md-7 - = f.legal_document_field :legal_document diff --git a/app/views/registrar/contacts/index.html.erb b/app/views/registrar/contacts/index.html.erb deleted file mode 100644 index 4a7e8759a0..0000000000 --- a/app/views/registrar/contacts/index.html.erb +++ /dev/null @@ -1,77 +0,0 @@ -<% content_for :actions do %> - <%= link_to(t(:new), new_registrar_contact_path, class: 'btn btn-primary') %> -<% end %> -<%= render 'shared/title', name: t(:contacts) %> -
-
- <%= render 'search_form' %> -
-
-
-
-
-
- - - - - - - - - - - - - <% @contacts.each do |contact| %> - - - - - - - - - <% end %> - -
- <%= sort_link(@q, 'name', t(:name)) %> - - <%= sort_link(@q, 'code', t(:id)) %> - - <%= sort_link(@q, 'ident', t(:ident)) %> - - <%= sort_link(@q, 'email', t(:created_at)) %> - - <%= sort_link(@q, 'registrar_name', t(:registrar_name)) %> - - <%= t(:actions) %> -
- <%= link_to(contact.name, registrar_contact_path(id: contact.code)) %> - - <%= contact.code %> - - <%= ident_for(contact) %> - - <%= l(contact.created_at, format: :short) %> - - <% if contact.registrar %> - <%= contact.registrar %> - <% end %> - - <%= link_to(t(:edit), edit_registrar_contact_path(contact.code), class: 'btn btn-primary btn-xs') %> - <%= link_to(t(:delete), delete_registrar_contact_path(contact.code), class: 'btn btn-default btn-xs') %> -
-
-
-
-
-
- <%= paginate @contacts %> -
-
- -
-
diff --git a/app/views/registrar/contacts/info_index.haml b/app/views/registrar/contacts/info_index.haml deleted file mode 100644 index 8bec10ee05..0000000000 --- a/app/views/registrar/contacts/info_index.haml +++ /dev/null @@ -1,19 +0,0 @@ -= render 'shared/title', name: t(:contacts_info) - -.row - .col-md-12 - = form_tag registrar_contact_path, class: 'form-horizontal', method: :get do - .form-group - = label_tag :contact_id, t(:contact_id), class: 'col-md-2 control-label' - .col-md-10 - = text_field_tag :contact_id, params[:contact_id], class: 'form-control', autocomplete: 'off' - .form-group - = label_tag :password, t(:password), class: 'col-md-2 control-label' - .col-md-10 - = text_field_tag :password, params[:password], class: 'form-control', autocomplete: 'off' - .form-group - .col-md-offset-2.col-md-10 - %button.btn.btn-primary -   - %span.glyphicon.glyphicon-search -   diff --git a/app/views/registrar/contacts/list_pdf.html.erb b/app/views/registrar/contacts/list_pdf.html.erb deleted file mode 100644 index b9bbb1c0e8..0000000000 --- a/app/views/registrar/contacts/list_pdf.html.erb +++ /dev/null @@ -1,34 +0,0 @@ - - - -
-
-
- - - - - - - - - - - - - <% @contacts.each do |contact| %> - - - - - - - - <% end %> - -
<%= Contact.human_attribute_name :name %><%= Contact.human_attribute_name :code %><%= Contact.human_attribute_name :ident %><%= Contact.human_attribute_name :created_at %><%= Registrar.model_name.human %>
<%= contact %><%= contact.code %><%= ident_for(contact) %><%= l(contact.created_at, format: :short) %><%= contact.registrar %>
-
-
-
- - diff --git a/app/views/registrar/contacts/new.haml b/app/views/registrar/contacts/new.haml deleted file mode 100644 index d554da0153..0000000000 --- a/app/views/registrar/contacts/new.haml +++ /dev/null @@ -1,5 +0,0 @@ -= render 'shared/title', name: t(:new_contact) - -= form_for(@contact, url: registrar_contacts_path, - html: {class: 'form-horizontal js-contact-form'}) do |f| - - render 'form', f: f diff --git a/app/views/registrar/contacts/partials/_address.haml b/app/views/registrar/contacts/partials/_address.haml deleted file mode 100644 index ce26b56672..0000000000 --- a/app/views/registrar/contacts/partials/_address.haml +++ /dev/null @@ -1,23 +0,0 @@ -.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 - - %dt= t(:city) - %dd= @contact.city - - %dt= t(:zip) - %dd= @contact.zip - - %dt= t(:state) - %dd= @contact.state - - %dt= t(:country) - %dd= @contact.country_name diff --git a/app/views/registrar/contacts/partials/_domains.haml b/app/views/registrar/contacts/partials/_domains.haml deleted file mode 100644 index cf721cb862..0000000000 --- a/app/views/registrar/contacts/partials/_domains.haml +++ /dev/null @@ -1,31 +0,0 @@ -- domains = contact.all_domains(page: params[:domain_page], per: 20, - params: domain_filter_params.to_h) -.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_name), :registrar_name - %th{class: 'col-xs-3'}=custom_sort_link t(:valid_to), :valid_to - %th{class: 'col-xs-3'}= t('.roles') - %tbody - - domains.each do |x| - %tr - %td= link_to(x.name, info_registrar_domains_path(domain_name: x.name)) - %td= x.registrar.name - %td= l(x.valid_to, format: :short) - %td= x.roles.join(", ") - -= paginate domains, param_name: :domain_page diff --git a/app/views/registrar/contacts/partials/_general.haml b/app/views/registrar/contacts/partials/_general.haml deleted file mode 100644 index 5fc8ec0278..0000000000 --- a/app/views/registrar/contacts/partials/_general.haml +++ /dev/null @@ -1,23 +0,0 @@ -.panel.panel-default - .panel-heading - %h3.panel-title= t(:general) - .panel-body - %dl.dl-horizontal - %dt= t(:id) - %dd= @contact.id - - %dt= Contact.human_attribute_name :auth_info - %dd - = tag :input, type: 'text', value: @contact.password, readonly: true, - class: 'form-control input-sm' - - %br - - %dt= t(:ident) - %dd= ident_for(@contact) - - %dt= t(:email) - %dd= @contact.email - - %dt= t(:phone) - %dd= @contact.phone diff --git a/app/views/registrar/contacts/partials/_statuses.haml b/app/views/registrar/contacts/partials/_statuses.haml deleted file mode 100644 index c926c04cf1..0000000000 --- a/app/views/registrar/contacts/partials/_statuses.haml +++ /dev/null @@ -1,14 +0,0 @@ -.panel.panel-default - .panel-heading - %h3.panel-title= 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(:description) - %tbody - - statuses.each do |s| - %tr - %td= s.first - %td= s.second diff --git a/app/views/registrar/contacts/show.haml b/app/views/registrar/contacts/show.haml deleted file mode 100644 index 9fb23182d1..0000000000 --- a/app/views/registrar/contacts/show.haml +++ /dev/null @@ -1,19 +0,0 @@ -- if @contact.id.present? - - content_for :actions do - = link_to(t(:edit), edit_registrar_contact_path(@contact.id), class: 'btn btn-primary') - = link_to(t(:delete), delete_registrar_contact_path(@contact.id), class: 'btn btn-default') - = render 'shared/title', name: @contact.name - - .row - .col-md-6= render 'registrar/contacts/partials/general' - .col-md-6= render 'registrar/contacts/partials/address' if Contact.address_processing? - .row - .col-md-12= render 'registrar/contacts/partials/statuses', statuses: @contact.statuses - .row - - if @contact.ident.present? - .col-md-12= render 'registrar/contacts/partials/domains', contact: Contact.find_by(code: params[:id]) - -- else - .row - .col-sm-6 - %h1= t(:not_found) diff --git a/app/views/registrar/deposits/new.haml b/app/views/registrar/deposits/new.haml deleted file mode 100644 index abb04f916a..0000000000 --- a/app/views/registrar/deposits/new.haml +++ /dev/null @@ -1,28 +0,0 @@ -- content_for :actions do - = link_to(t(:back_to_billing), registrar_invoices_path, class: 'btn btn-default') -= render 'shared/title', name: t(:add_deposit) - -= form_for([:registrar, @deposit], method: :post, html: { class: 'form-horizontal' }) do |f| - = render 'shared/full_errors', object: @deposit - - .row - .col-md-8 - .form-group - .col-md-4.control-label - = f.label :amount, class: 'required' - .col-md-7 - .input-group - = f.text_field :amount, class: 'form-control', required: true - .input-group-addon - EUR - - .form-group - .col-md-4.control-label - = f.label :description - .col-md-7 - = f.text_area :description, class: 'form-control' - - %hr - .row - .col-md-8.text-right - = button_tag(t(:add), class: 'btn btn-warning') diff --git a/app/views/registrar/domain_transfers/_form.html.erb b/app/views/registrar/domain_transfers/_form.html.erb deleted file mode 100644 index 52dcca4683..0000000000 --- a/app/views/registrar/domain_transfers/_form.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<%= form_tag registrar_domain_transfers_path, multipart: true, class: 'form-horizontal' do %> - <%= render 'registrar/domain_transfers/form/api_errors' %> - -
-
- <%= label_tag :domain_name, nil, class: 'required' %> -
-
- <%= text_field_tag :domain_name, params[:domain_name], autofocus: true, required: true, - class: 'form-control' %> -
-
- -
-
- <%= label_tag :transfer_code, nil, class: 'required' %> -
-
- <%= text_field_tag :transfer_code, params[:transfer_code], class: 'form-control', required: true %> -
-
- -
-
- <%= label_tag 'legal_document', t(:legal_document) %> -
-
- <%= file_field_tag 'legal_document' %> -
-
- -
-
- -
-
-<% end %> diff --git a/app/views/registrar/domain_transfers/create.html.erb b/app/views/registrar/domain_transfers/create.html.erb deleted file mode 100644 index bf258e4760..0000000000 --- a/app/views/registrar/domain_transfers/create.html.erb +++ /dev/null @@ -1,27 +0,0 @@ - - -
-
-
-
-

- <%= t(:result) %> -

-
-
-
-
<%= t(:domain_name) %>
-
<%= @data.css('name').text %>
- - <% @data.css('trnData').children.each do |x| %> - <% next if x.blank? %> -
<%= t(x.name) %>
-
<%= x.text %>
- <% end %> -
-
-
-
-
diff --git a/app/views/registrar/domain_transfers/form/_api_errors.html.erb b/app/views/registrar/domain_transfers/form/_api_errors.html.erb deleted file mode 100644 index 8d8862959e..0000000000 --- a/app/views/registrar/domain_transfers/form/_api_errors.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<% if @api_errors %> -
- -
-<% end %> diff --git a/app/views/registrar/domain_transfers/new.html.erb b/app/views/registrar/domain_transfers/new.html.erb deleted file mode 100644 index 52dd3f900d..0000000000 --- a/app/views/registrar/domain_transfers/new.html.erb +++ /dev/null @@ -1,11 +0,0 @@ - - -<%= render 'registrar/domain_transfers/form/api_errors' %> - -
-
- <%= render 'form' %> -
-
diff --git a/app/views/registrar/domains/_check_form.haml b/app/views/registrar/domains/_check_form.haml deleted file mode 100644 index 2468fa69ae..0000000000 --- a/app/views/registrar/domains/_check_form.haml +++ /dev/null @@ -1,10 +0,0 @@ -= form_tag check_registrar_domains_path, class: 'form-horizontal', method: :get do - .col-md-11 - .form-group - = text_field_tag :domain_name, params[:domain_name], class: 'form-control', placeholder: t(:domain_name), autocomplete: 'off' - .col-md-1.text-right.text-center-xs - .form-group - %button.btn.btn-primary -   - %span.glyphicon.glyphicon-search -   diff --git a/app/views/registrar/domains/_domain.html.erb b/app/views/registrar/domains/_domain.html.erb deleted file mode 100644 index 8cc6da6f74..0000000000 --- a/app/views/registrar/domains/_domain.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - - <%= link_to truncate(domain.name), info_registrar_domains_path(domain_name: domain.name) %> - <%= link_to domain.registrant, registrar_contact_path(id: domain.registrant.code) %> - <%= l domain.expire_time %> - - <%= link_to t('.edit_btn'), edit_registrar_domains_path(domain_name: domain.name), - class: 'btn btn-primary btn-xs' %> - <%= link_to t('.renew_btn'), renew_registrar_domains_path(domain_name: domain.name), - class: 'btn btn-default btn-xs' %> - <% unless (domain.statuses & %w[pendingDelete pendingDeleteConfirmation]).any? %> - <%= link_to t('.delete_btn'), delete_registrar_domains_path(domain_name: domain.name), - class: 'btn btn-default btn-xs' %> - <% end %> - - diff --git a/app/views/registrar/domains/_form.haml b/app/views/registrar/domains/_form.haml deleted file mode 100644 index 690d0ee068..0000000000 --- a/app/views/registrar/domains/_form.haml +++ /dev/null @@ -1,30 +0,0 @@ -- path = (params[:domain_name]) ? update_registrar_domains_path : registrar_domains_path -- legaldoc_mandatory = params[:domain_name].blank? && current_registrar_user.legaldoc_mandatory? -= form_tag(path, class: 'form-horizontal', multipart: true) do - .row - .col-md-8 - #general-tab.tab-pane.active - = render 'registrar/domains/form/general' - = render 'registrar/domains/form/contacts' - = render 'registrar/domains/form/nameservers' - = render 'registrar/domains/form/dnskeys' - - .panel.panel-default - .panel-heading.clearfix - .pull-left= t(:legal_document) - .panel-body - .form-group - .col-md-3.control-label - - c, fr = 'required', true if legaldoc_mandatory - = label_tag 'domain[legal_document]', t(:legal_document), class: c - %p.help-block= t(:legal_document_max_size) - .col-md-7 - = legal_document_field_tag 'domain[legal_document]', required: fr - .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 - %p.domain-tech-contact-help= t(:domain_tech_contact_help).html_safe - - .row - .col-md-8.text-right - = button_tag(t('.save_btn'), class: 'btn btn-warning') diff --git a/app/views/registrar/domains/_search_form.html.erb b/app/views/registrar/domains/_search_form.html.erb deleted file mode 100644 index 584b15ba15..0000000000 --- a/app/views/registrar/domains/_search_form.html.erb +++ /dev/null @@ -1,89 +0,0 @@ -<%= search_form_for [:registrar, @q], html: { class: 'search-form', autocomplete: 'off' } do |f| %> -
-
-
- <%= f.label :name, for: nil %> - <%= f.search_field :name_matches, value: search_params[:name_matches], class: 'form-control', - placeholder: t(:name) %> -
-
- -
-
- <%= f.label :registrant_ident, for: nil %> - <%= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident) %> -
-
- -
-
- <%= f.label :contact_ident, for: nil %> - <%= f.search_field :contacts_ident_eq, value: search_params[:contacts_ident_eq], - class: 'form-control', placeholder: t(:contact_ident) %> -
-
- -
-
- <%= f.label :nameserver_hostname, for: nil %> - <%= f.search_field :nameservers_hostname_eq, class: 'form-control', - placeholder: t(:nameserver_hostname) %> -
-
-
- -
-
-
- <%= label_tag :status, nil, for: nil %> - <%= select_tag :statuses_contains, - options_for_select(DomainStatus::STATUSES, params[:statuses_contains]), - { multiple: true, class: 'form-control js-combobox' } %> -
-
- -
-
- <%= f.label :valid_to_gteq, for: nil %> - <%= f.search_field :valid_to_gteq, value: search_params[:valid_to_gteq], - class: 'form-control js-datepicker', - placeholder: t(:valid_to_from) %> -
-
- -
-
- <%= f.label :valid_to_lteq, for: nil %> - <%= f.search_field :valid_to_lteq, value: search_params[:valid_to_lteq], - class: 'form-control js-datepicker', - placeholder: t(:valid_to_until) %> -
-
-
- -
-
- <%= label_tag :results_per_page, nil, for: nil %> -
-
- -
-
-
- <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', - placeholder: t(:results_per_page) %> -
-
- -
- - <%= button_tag t('.download_btn'), formaction: registrar_domains_path(format: 'csv'), - class: 'btn btn-default' %> - <%= link_to t('.reset_btn'), registrar_domains_path, class: 'btn btn-default' %> -
-
-<% end %> diff --git a/app/views/registrar/domains/check.haml b/app/views/registrar/domains/check.haml deleted file mode 100644 index f8ebfeacae..0000000000 --- a/app/views/registrar/domains/check.haml +++ /dev/null @@ -1,25 +0,0 @@ -= render 'shared/title', name: t(:check_domain) - -.row - .col-md-12 - = render 'check_form' - -%hr - -.row - .col-md-12 - .panel.panel-default - .panel-heading - %h3.panel-title= t(:result) - .panel-body - %dl.dl-horizontal - %dt= t(:name) - %dd= @data.css('name').text - - - name = @data.css('name').first - %dt= t(:available) - %dd= name['avail'] - - - if @data.css('reason').text.present? - %dt= t(:reason) - %dd= @data.css('reason').text diff --git a/app/views/registrar/domains/check_index.haml b/app/views/registrar/domains/check_index.haml deleted file mode 100644 index ee4bf074b2..0000000000 --- a/app/views/registrar/domains/check_index.haml +++ /dev/null @@ -1,5 +0,0 @@ -= render 'shared/title', name: t(:check_domain) - -.row - .col-md-12 - = render 'check_form' diff --git a/app/views/registrar/domains/delete.haml b/app/views/registrar/domains/delete.haml deleted file mode 100644 index bea9ed118d..0000000000 --- a/app/views/registrar/domains/delete.haml +++ /dev/null @@ -1,25 +0,0 @@ -= render 'shared/title', name: "#{t(:delete)}: #{params[:domain_name]}" - -= form_tag(destroy_registrar_domains_path, class: 'form-horizontal', multipart: true, method: :delete) do - .col-md-8 - .panel.panel-default - .panel-heading.clearfix - = t(:legal_document) - .panel-body - .form-group - .col-md-4.control-label - = label_tag 'domain[verified]', t(:verified) - .col-md-6 - = check_box_tag 'domain[verified]', '1', params[:verified].eql?('1'), onclick: ("return (confirm('#{t(:verified_confirm)}') ? true : false);" if current_registrar_user.legaldoc_mandatory?) - - .form-group - .col-md-4.control-label - = label_tag 'domain[legal_document]', t(:legal_document) - %p.help-block= t(:legal_document_max_size) - .col-md-6 - = file_field_tag 'domain[legal_document]' - = hidden_field_tag 'domain[name]', params[:domain_name] - %hr - .row - .col-md-8.text-right - = button_tag t(:delete), class: 'btn btn-danger' diff --git a/app/views/registrar/domains/edit.haml b/app/views/registrar/domains/edit.haml deleted file mode 100644 index 4b8d5db6ba..0000000000 --- a/app/views/registrar/domains/edit.haml +++ /dev/null @@ -1,3 +0,0 @@ -= render 'shared/title', name: "#{t(:edit)}: #{params[:domain_name]}" - -= render 'form' diff --git a/app/views/registrar/domains/form/_contacts.haml b/app/views/registrar/domains/form/_contacts.haml deleted file mode 100644 index 8e01ffda36..0000000000 --- a/app/views/registrar/domains/form/_contacts.haml +++ /dev/null @@ -1,44 +0,0 @@ -#js-domain-contacts - - @domain_params['contacts_attributes'].each do |k, v| - .js-contact - .panel.panel-default - .panel-heading.clearfix - .pull-left= t(:contact) - .pull-right - = link_to(t(:add_another), '#', class: 'btn btn-default btn-xs add-domain-contact') - = link_to(t(:delete), '#', class: 'btn btn-default btn-xs destroy') - .panel-body - .form-group - .col-md-3.control-label - = label_tag "domain_contacts_attributes_#{k}_type", t(:contact_type), class: 'required' - .col-md-7 - = select_tag "domain[contacts_attributes][#{k}][type]", options_for_select(['admin', 'tech'], v['type']), {class: 'form-control js-contact-type'} - - .form-group - .col-md-3.control-label - = label_tag "domain_contacts_attributes_#{k}_code", t(:id), class: 'required' - .col-md-7.has-feedback - = text_field_tag "domain[contacts_attributes][#{k}][code]", v['code'], class: "hidden" - = text_field_tag "domain[contacts_attributes][#{k}][code_helper]", contacts.find_by(code: v['code']).try(:search_name), class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true - -:coffee - load_listener = -> - clone = $('.js-contact:first').clone() - $("#js-domain-contacts").nestedAttributes - bindAddTo: $(".add-domain-contact") - afterAdd: (item) -> - # preselect type - item.find('select.js-contact-type').each (k, v) -> - $(v).val($(v).find('option:last-child').val()) - # add combobex - item.find('select.js-contact-code').each (k, v) -> - $(v).select2 - width: "100%" - selectOnBlur: true - dropdownAutoWidth: if self==top then true else false - # remove link for temp - item.find('a.add-domain-contact').each (k, v) -> - $(v).hide() - new Autocomplete() - $clone: clone - window.addEventListener 'load', load_listener diff --git a/app/views/registrar/domains/form/_dnskeys.haml b/app/views/registrar/domains/form/_dnskeys.haml deleted file mode 100644 index 630e163039..0000000000 --- a/app/views/registrar/domains/form/_dnskeys.haml +++ /dev/null @@ -1,77 +0,0 @@ -#dnskeys - - @domain_params['dnskeys_attributes'].each do |k, v| - .panel.panel-default - .panel-heading.clearfix - .pull-left= t(:dnskey) - .pull-right - = link_to(t(:add_another), '#', class: 'btn btn-default btn-xs add-dnskey') - = link_to(t(:delete), '#', class: 'btn btn-default btn-xs destroy') - .panel-body - - if ENV['show_ds_data_fields'] == 'true' - .form-group - .col-md-3.control-label - = label_tag "domain_dnskeys_attributes_#{k}_ds_key_tag", t(:ds_key_tag) - .col-md-7 - = text_field_tag "domain[dnskeys_attributes][#{k}][ds_key_tag]", v['ds_key_tag'], - {class: 'form-control'} - - .form-group - .col-md-3.control-label - = label_tag "domain_dnskeys_attributes_#{k}_ds_alg", t(:ds_algorithm) - .col-md-7 - = select_tag "domain[dnskeys_attributes][#{k}][ds_alg]", - options_for_select(Depp::Dnskey::ALGORITHMS, v['ds_alg']), {class: 'form-control'} - - .form-group - .col-md-3.control-label - = label_tag "domain_dnskeys_attributes_#{k}_ds_digest_type", t(:ds_digest_type) - .col-md-7 - = select_tag "domain[dnskeys_attributes][#{k}][ds_digest_type]", - options_for_select(Depp::Dnskey::DS_DIGEST_TYPES, v['ds_digest_type']), - {class: 'form-control'} - - .form-group - .col-md-3.control-label - = label_tag "domain_dnskeys_attributes_#{k}_ds_digest", t(:ds_digest) - .col-md-7 - = text_field_tag "domain[dnskeys_attributes][#{k}][ds_digest]", v['ds_digest'], - {class: 'form-control'} - - .form-group - .col-md-3.control-label - = label_tag "domain_dnskeys_attributes_#{k}_flags", t('.flags') - .col-md-7 - = select_tag "domain[dnskeys_attributes][#{k}][flags]", - options_for_select(Depp::Dnskey::FLAGS, v['flags']), - { class: 'form-control' } - - .form-group - .col-md-3.control-label - = label_tag "domain_dnskeys_attributes_#{k}_protocol", t(:protocol) - .col-md-7 - = select_tag "domain[dnskeys_attributes][#{k}][protocol]", - options_for_select(Depp::Dnskey::PROTOCOLS, v['protocol']), - { class: 'form-control' } - - .form-group - .col-md-3.control-label - = label_tag "domain_dnskeys_attributes_#{k}_alg", t('.alg') - .col-md-7 - = select_tag "domain[dnskeys_attributes][#{k}][alg]", - options_for_select(Depp::Dnskey::ALGORITHMS, v['alg']), { class: 'form-control' } - - .form-group - .col-md-3.control-label - = label_tag "domain_dnskeys_attributes_#{k}_public_key", t(:public_key) - .col-md-7 - = text_field_tag "domain[dnskeys_attributes][#{k}][public_key]", v['public_key'], - class: 'form-control' - -:coffee - load_listener = -> - $("#dnskeys").nestedAttributes - bindAddTo: $(".add-dnskey") - afterAdd: (item) -> - item.find('select').each (k, v) -> - $(v).val($(v).find('option:first-child').val()) - window.addEventListener 'load', load_listener diff --git a/app/views/registrar/domains/form/_general.haml b/app/views/registrar/domains/form/_general.haml deleted file mode 100644 index 5fa4d2a894..0000000000 --- a/app/views/registrar/domains/form/_general.haml +++ /dev/null @@ -1,39 +0,0 @@ -.general-tab.panel.panel-default - .panel-body - .form-group - .col-md-3.control-label - = label_tag :domain_name, t(:name), class: 'required' - .col-md-7 - - readonly = params[:domain_name] ? true : false - = text_field_tag('domain[name]', @domain_params[:name], - class: 'form-control', readonly: readonly, required: true) - - - unless params[:domain_name] - .form-group - .col-md-3.control-label - = label_tag :domain_period, t(:period), class: 'required' - .col-md-7 - = select_tag 'domain[period]', - options_for_select(Depp::Domain::PERIODS, @domain_params[:period]), { class: 'form-control' } - - .form-group - .col-md-3.control-label - = label_tag :domain_registrant, t('.registrant'), class: 'required' - .col-md-7 - = text_field_tag 'domain[registrant]', @domain_params[:registrant], class: "hidden" - = text_field_tag 'domain[registrant_helper]', contacts.find_by(code: @domain_params[:registrant]).try(:search_name), - class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true - - - if params[:domain_name] - .form-group - .col-md-3.control-label - = label_tag :verified, t(:verified) - .col-md-7 - = check_box_tag 'domain[verified]', '1', @domain_params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" - - - if !params[:domain_name] || @dispute.present? - .form-group - .col-md-3.control-label - = label_tag :domain_reserved_pw, t(:reserved_pw) - .col-md-7 - = text_field_tag('domain[reserved_pw]', @domain_params[:reserved_pw], class: 'form-control') diff --git a/app/views/registrar/domains/form/_nameservers.haml b/app/views/registrar/domains/form/_nameservers.haml deleted file mode 100644 index 75d34b924c..0000000000 --- a/app/views/registrar/domains/form/_nameservers.haml +++ /dev/null @@ -1,33 +0,0 @@ -#nameservers - - @domain_params['nameservers_attributes'].each do |k, v| - .panel.panel-default - .panel-heading.clearfix - .pull-left= t(:nameserver) - .pull-right - = link_to(t(:add_another), '#', class: 'btn btn-default btn-xs add-nameserver') - = link_to(t(:delete), '#', class: 'btn btn-default btn-xs destroy') - .panel-body - .form-group - .col-md-3.control-label - = label_tag "domain_nameservers_attributes_#{k}_hostname", t(:hostname), - class: Domain.nameserver_required? ? 'required' : nil - .col-md-7 - = text_field_tag "domain[nameservers_attributes][#{k}][hostname]", v['hostname'], - class: 'form-control', required: Domain.nameserver_required? - .form-group - .col-md-3.control-label - = label_tag "domain_nameservers_attributes_#{k}_ipv4", t(:ipv4) - .col-md-7 - = text_field_tag "domain[nameservers_attributes][#{k}][ipv4]", v['ipv4'], - class: 'form-control'#, ipv4: true - .form-group - .col-md-3.control-label - = label_tag "domain_nameservers_attributes_#{k}_ipv6", t(:ipv6) - .col-md-7 - = text_field_tag "domain[nameservers_attributes][#{k}][ipv6]", v['ipv6'], - class: 'form-control'#, ipv6: true -:coffee - load_listener = -> - $("#nameservers").nestedAttributes - bindAddTo: $(".add-nameserver") - window.addEventListener 'load', load_listener diff --git a/app/views/registrar/domains/index.html.erb b/app/views/registrar/domains/index.html.erb deleted file mode 100644 index c643fd613a..0000000000 --- a/app/views/registrar/domains/index.html.erb +++ /dev/null @@ -1,59 +0,0 @@ - - -
-
- <%= render 'search_form' %> -
-
- -
-
-
- - - - - - - - - - - - <%= render partial: 'domain', collection: @domains %> - -
- <%= sort_link(@q, 'name') %> - - <%= sort_link @q, 'registrant_name', Registrant.model_name.human %> - - <%= sort_link @q, 'valid_to', Domain.human_attribute_name(:expire_time) %> -
-
-
-
- -
-
- <%= paginate @domains %> -
- -
- -
-
diff --git a/app/views/registrar/domains/info.html.erb b/app/views/registrar/domains/info.html.erb deleted file mode 100644 index c2f219bf90..0000000000 --- a/app/views/registrar/domains/info.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -<% content_for :actions do %> - <% if @data.css('pw').text.present? %> - <%= link_to(t(:edit), edit_registrar_domains_path(domain_name: params[:domain_name]), - class: 'btn btn-default') %> - <%= link_to(t(:renew), renew_registrar_domains_path(domain_name: params[:domain_name]), - class: 'btn btn-default') %> - <% unless @pending_delete %> - <%= link_to(t(:delete), delete_registrar_domains_path(domain_name: params[:domain_name]), - class: 'btn btn-default') %> - <% end %> - <% if @client_holded %> - <%= link_to(t(:remove_client_hold), remove_hold_registrar_domains_path(domain_name: params[:domain_name]), - class: 'btn btn-default') %> - <% end %> - <% else %> - <%= link_to t('.transfer_btn'), new_registrar_domain_transfer_path(domain_name: params[:domain_name]), - class: 'btn btn-default' %> - <% end %> -<% end %> -<%= render 'shared/title', name: truncate(@data.css('name').text) %> -
-
- <% if @data.css('result').first['code'] == '1000' %> -
-
- <%= render 'registrar/domains/partials/general' %> -
-
-
-
- <%= render 'registrar/domains/partials/contacts' %> -
-
-
-
- <%= render 'registrar/domains/partials/statuses' %> -
-
-
-
- <%= render 'registrar/domains/partials/nameservers' %> -
-
-
-
- <%= render 'registrar/domains/partials/dnskeys' %> -
-
- <% else %> -
-
-

- <%= t(:not_found) %> -

-
-
- <% end %> -
-
diff --git a/app/views/registrar/domains/new.haml b/app/views/registrar/domains/new.haml deleted file mode 100644 index 50808df227..0000000000 --- a/app/views/registrar/domains/new.haml +++ /dev/null @@ -1,3 +0,0 @@ -= render 'shared/title', name: t(:new_domain) - -= render 'form' diff --git a/app/views/registrar/domains/partials/_contacts.haml b/app/views/registrar/domains/partials/_contacts.haml deleted file mode 100644 index e6ef9aa8fe..0000000000 --- a/app/views/registrar/domains/partials/_contacts.haml +++ /dev/null @@ -1,17 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - %h3.panel-title= t(:contacts) - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-4'}= t(:type) - %th{class: 'col-xs-4'}= t(:name) - %th{class: 'col-xs-4'}= t(:id) - %tbody - - @data.css('contact').each do |x| - - registrant = Contact.find_by_code(x.text) - %tr - %td= x['type'] - %td= registrant.registrar == current_registrar_user.registrar ? registrant.name : 'N/A' - %td= x.text diff --git a/app/views/registrar/domains/partials/_dnskeys.haml b/app/views/registrar/domains/partials/_dnskeys.haml deleted file mode 100644 index 7e8e5b940a..0000000000 --- a/app/views/registrar/domains/partials/_dnskeys.haml +++ /dev/null @@ -1,66 +0,0 @@ -.panel.panel-default - .panel-heading - %h3.panel-title= t(:dnskeys) - .panel-body{style: 'word-wrap: break-word;'} - .table-responsive - %table.table.table-hover.table-condensed - %tbody - - @data.css('dsData').each_with_index do |x, index| - - if x.css('digest').text.present? - %tr - %td - %b= "#{t(:ds_key_tag)}:" - = x.css('keyTag').text - %tr - %td - %b= "#{t(:ds_algorithm)}:" - = x.css('alg').first.text - %tr - %td - %b= "#{t(:ds_digest_type)}:" - = x.css('digestType').text - %tr - %td - %b= "#{t(:ds_digest)}:" - = x.css('digest').text - %tr - %td - %b= "#{t(:flag)}:" - = x.css('keyData').css('flags').text - %tr - %td - %b= "#{t(:protocol)}:" - = x.css('keyData').css('protocol').text - %tr - %td - %b= "#{t(:algorithm)}:" - = x.css('alg').last.text - %tr - %td{:colspan => "3"} - %b= "#{t(:public_key)}:" - = x.css('keyData').css('pubKey').text - - if index != @data.css('keyData').size - 1 - %tr - %td{:colspan => "3"} - = " ".html_safe - - - if @data.css('dsData').empty? - - @data.css('keyData').each_with_index do |x, index| - %tr - %td - %b= "#{t(:flag)}:" - = x.css('flags').text - %td - %b= "#{t(:protocol)}:" - = x.css('protocol').text - %td - %b= "#{t(:algorithm)}:" - = x.css('alg').text - %tr - %td{:colspan => "3"} - %b= "#{t(:public_key)}:" - = x.css('pubKey').text - - if index != @data.css('keyData').size - 1 - %tr - %td{:colspan => "3"} - = " ".html_safe \ No newline at end of file diff --git a/app/views/registrar/domains/partials/_general.html.erb b/app/views/registrar/domains/partials/_general.html.erb deleted file mode 100644 index ff064857c2..0000000000 --- a/app/views/registrar/domains/partials/_general.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -
-
-

- <%= t(:general) %> -

-
- -
-
-
<%= Domain.human_attribute_name :transfer_code %>
-
- <% if @data.css('pw').text.present? %> - <%= tag(:input, type: 'text', value: @data.css('pw').text, readonly: true, - class: 'form-control input-sm') %> - <% end %> -
- - - <% if @data.css('pw').text.blank? %> -
<%= t(:registrar_name) %>
-
<%= @data.css('clID').text %>
- <% end %> - - <% registrant = Contact.find_by_code(@data.css('registrant').text) %> -
<%= t('.registrant') %>
-
<%= registrant.registrar == current_registrar_user.registrar ? "#{registrant.name} (#{@data.css('registrant').text})" : @data.css('registrant').text %>
- -
<%= t('.registered') %>
-
<%= @data.css('crDate').text %>
- -
<%= t(:valid_to) %>
-
<%= @data.css('exDate').text %>
- -
<%= t('.created') %>
-
<%= @data.css('crDate').text %>
- -
<%= t('.updated') %>
-
<%= @data.css('upDate').text %>
-
-
-
diff --git a/app/views/registrar/domains/partials/_nameservers.haml b/app/views/registrar/domains/partials/_nameservers.haml deleted file mode 100644 index 69f147bc42..0000000000 --- a/app/views/registrar/domains/partials/_nameservers.haml +++ /dev/null @@ -1,17 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - %h3.panel-title= 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 - - @data.css('hostAttr').each do |x| - %tr - %td= x.css('hostName').text - %td= Array(x.css('hostAddr[ip="v4"]')).map(&:text).join(", ") - %td= Array(x.css('hostAddr[ip="v6"]')).map(&:text).join(", ") - diff --git a/app/views/registrar/domains/partials/_statuses.haml b/app/views/registrar/domains/partials/_statuses.haml deleted file mode 100644 index 125309cafb..0000000000 --- a/app/views/registrar/domains/partials/_statuses.haml +++ /dev/null @@ -1,14 +0,0 @@ -#domain_statuses.panel.panel-default - .panel-heading.clearfix - %h3.panel-title= 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 - - @data.css('status').each do |x| - %tr - %td= x['s'] - %td= x.text diff --git a/app/views/registrar/domains/renew.haml b/app/views/registrar/domains/renew.haml deleted file mode 100644 index aebcac4b41..0000000000 --- a/app/views/registrar/domains/renew.haml +++ /dev/null @@ -1,14 +0,0 @@ -= render 'shared/title', name: t(:renew_domain) - -.row - .col-md-8 - .panel.panel-default - .panel-heading - %h3.panel-title= t(:result) - .panel-body - %dl.dl-horizontal - %dt= t(:domain_name) - %dd= @data.css('name').text - - %dt= t(:valid_to) - %dd= @data.css('exDate').text diff --git a/app/views/registrar/domains/renew_index.haml b/app/views/registrar/domains/renew_index.haml deleted file mode 100644 index 92f7a81084..0000000000 --- a/app/views/registrar/domains/renew_index.haml +++ /dev/null @@ -1,30 +0,0 @@ -= render 'shared/title', name: t(:renew_domain) - -.row - .col-md-8 - = form_tag renew_registrar_domains_path, class: 'form-horizontal', method: :get do - .form-group - .col-md-3.control-label - = label_tag :domain_name, t(:name), class: 'required' - .col-md-7 - = text_field_tag :domain_name, params[:domain_name], - class: 'form-control', placeholder: t(:domain_name), autocomplete: 'off', required: true - - .form-group - .col-md-3.control-label - = label_tag :cur_exp_date, t(:cur_exp_date), class: 'required' - .col-md-7 - = text_field_tag :cur_exp_date, params[:cur_exp_date], - class: 'form-control', placeholder: 'yyyy-mm-dd', autocomplete: 'off', required: true - - .form-group - .col-md-3.control-label - = label_tag :domain_period, t(:period), class: 'required' - .col-md-7 - = select_tag :period, - options_for_select(Depp::Domain::PERIODS, params[:period]), { class: 'form-control' } - - %hr - .form-group - .col-md-10.text-right - %button.btn.btn-warning= t(:renew) diff --git a/app/views/registrar/invoices/delivery/new.html.erb b/app/views/registrar/invoices/delivery/new.html.erb deleted file mode 100644 index 20db814189..0000000000 --- a/app/views/registrar/invoices/delivery/new.html.erb +++ /dev/null @@ -1,25 +0,0 @@ - - - - -<%= form_tag(registrar_invoice_delivery_path(@invoice)) do %> -
-
-
- <%= label_tag :recipient %> - <%= email_field_tag :recipient, @recipient, required: true, autofocus: true, - class: 'form-control' %> -
-
-
- <%= submit_tag t('.submit_btn'), class: 'btn btn-warning' %> -
-
-
-
-<% end %> \ No newline at end of file diff --git a/app/views/registrar/invoices/index.haml b/app/views/registrar/invoices/index.haml deleted file mode 100644 index cc15beeb8b..0000000000 --- a/app/views/registrar/invoices/index.haml +++ /dev/null @@ -1,73 +0,0 @@ -- content_for :actions do - = link_to(t(:add_deposit), new_registrar_deposit_path, class: 'btn btn-primary') - = link_to(t(:account_activity), registrar_account_activities_path, class: 'btn btn-default') -= render 'shared/title', name: t(:your_account) - -= t(:your_current_account_balance_is, - balance: currency(current_registrar_user.registrar.cash_account.balance), - currency: current_registrar_user.registrar.cash_account.currency) - -%h1= t(:invoices) -.row - .col-md-12 - %hr - = search_form_for @q, url: [:registrar, :invoices], html: { style: 'margin-bottom: 0;' } do |f| - .row - .col-md-3 - .form-group - = f.label t(:minimum_invoice_no) - = f.search_field :number_gteq, class: 'form-control', placeholder: t(:minimum_invoice_no), autocomplete: 'off' - .col-md-3 - .form-group - = f.label t(:maximum_invoice_no) - = f.search_field :number_lteq, class: 'form-control', placeholder: t(:maximum_invoice_no), autocomplete: 'off' - .col-md-3 - .form-group - = f.label t(:due_date_from) - = f.search_field :due_date_gteq, value: params[:q][:due_date_gteq], class: 'form-control js-datepicker', placeholder: t(:due_date_from) - .col-md-3 - .form-group - = f.label t(:due_date_until) - = f.search_field :due_date_lteq, value: params[:q][:due_date_lteq], class: 'form-control js-datepicker', placeholder: t(:due_date_until) - .row - .col-md-3 - .form-group - = f.label t(:minimum_total) - = f.search_field :total_gteq, class: 'form-control', placeholder: t(:minimum_total), autocomplete: 'off' - .col-md-3 - .form-group - = f.label t(:maximum_total) - = f.search_field :total_lteq, class: 'form-control', placeholder: t(:maximum_total), autocomplete: 'off' - .col-md-3{style: 'padding-top: 25px;'} - %button.btn.btn-default -   - %span.glyphicon.glyphicon-search -   - = link_to(t('.reset_btn'), registrar_invoices_path, class: 'btn btn-default') -%hr -.row - .col-md-12 - .table-responsive - %table.table.table-hover.table-condensed - %thead - %tr - %th{class: 'col-xs-3'}= t('invoice.title') - %th{class: 'col-xs-3'}= Invoice.human_attribute_name :receipt_date - %th{class: 'col-xs-3'}= t(:due_date) - %th{class: 'col-xs-3'}= t(:total) - %tbody - - @invoices.each do |invoice| - %tr - %td= link_to(invoice, [:registrar, invoice]) - - if invoice.paid? - %td= l invoice.receipt_date - - elsif invoice.cancelled? - %td.text-grey= t(:cancelled) - - else - %td{class: 'text-danger'}= t(:unpaid) - - %td= l invoice.due_date - %td= currency(invoice.total) -.row - .col-md-12 - = paginate @invoices diff --git a/app/views/registrar/invoices/partials/_banklinks.haml b/app/views/registrar/invoices/partials/_banklinks.haml deleted file mode 100644 index 339ae47050..0000000000 --- a/app/views/registrar/invoices/partials/_banklinks.haml +++ /dev/null @@ -1,8 +0,0 @@ -%h4= t('registrar.invoices.pay_invoice') -%hr - - - if @invoice.payment_link.present? - = link_to @invoice.payment_link, target: :_blank do - = image_tag("everypay.png", class: 'everypay', style: "width: 100px; height: 20px;") - - else - = "No everypay link" diff --git a/app/views/registrar/invoices/partials/_buyer.haml b/app/views/registrar/invoices/partials/_buyer.haml deleted file mode 100644 index 30824ff010..0000000000 --- a/app/views/registrar/invoices/partials/_buyer.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h4= t(:buyer) -%hr -%dl.dl-horizontal - %dt= t(:name) - %dd= @invoice.buyer_name - - %dt= t(:reg_no) - %dd= @invoice.buyer_reg_no - - %dt= t(:address) - %dd= @invoice.buyer_address - - %dt= t(:country) - %dd= @invoice.buyer_country - - %dt= t(:phone) - %dd= @invoice.buyer_phone - - %dt= t(:url) - %dd= @invoice.buyer_url - - %dt= t(:email) - %dd= @invoice.buyer_email diff --git a/app/views/registrar/invoices/partials/_details.haml b/app/views/registrar/invoices/partials/_details.haml deleted file mode 100644 index c5e6193a49..0000000000 --- a/app/views/registrar/invoices/partials/_details.haml +++ /dev/null @@ -1,36 +0,0 @@ -%h4= t(:details) -%hr -%dl.dl-horizontal - %dt= t(:issue_date) - %dd= l @invoice.issue_date - - - if @invoice.cancelled? - %dt= Invoice.human_attribute_name :cancelled_at - %dd= l @invoice.cancelled_at - - %dt= t(:due_date) - - if @invoice.cancelled? - %dd.text-grey= t(:cancelled) - - else - %dd= l @invoice.due_date - - %dt= Invoice.human_attribute_name :receipt_date - - if @invoice.paid? - %dd= l @invoice.receipt_date - - elsif @invoice.cancelled? - %dd.text-grey= t(:cancelled) - - else - %dd{class: 'text-danger'}= t(:unpaid) - - %dt= t(:payment_term) - %dd Prepayment - - %dt= t(:invoice_number) - %dd= @invoice.number - - - if @invoice.description.present? - %dt= t(:description) - %dd=@invoice.description - - %dt= Invoice.human_attribute_name :reference_no - %dd= @invoice.reference_no diff --git a/app/views/registrar/invoices/partials/_items.haml b/app/views/registrar/invoices/partials/_items.haml deleted file mode 100644 index 26985b1c1b..0000000000 --- a/app/views/registrar/invoices/partials/_items.haml +++ /dev/null @@ -1,32 +0,0 @@ -%h4= t(:items) -%hr -.table-responsive - %table.table.table-hover.table-condensed - %thead - %tr - %th{class: 'col-xs-4'}= t(:description) - %th{class: 'col-xs-2'}= t(:unit) - %th{class: 'col-xs-2'}= InvoiceItem.human_attribute_name :quantity - %th{class: 'col-xs-2'}= t(:price) - %th{class: 'col-xs-2'}= t(:total) - %tbody - - @invoice.each do |invoice_item| - %tr - %td= invoice_item.description - %td= invoice_item.unit - %td= invoice_item.quantity - %td= currency(invoice_item.price) - %td= currency(invoice_item.item_sum_without_vat) - %tfoot - %tr - %th{colspan: 3} - %th= Invoice.human_attribute_name :subtotal - %td= number_to_currency @invoice.subtotal - %tr - %th.no-border{colspan: 3} - %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}" - %td= number_to_currency @invoice.vat_amount - %tr - %th.no-border{colspan: 3} - %th= t(:total) - %td= number_to_currency @invoice.total diff --git a/app/views/registrar/invoices/partials/_payment_orders.haml b/app/views/registrar/invoices/partials/_payment_orders.haml deleted file mode 100644 index d418ea1ace..0000000000 --- a/app/views/registrar/invoices/partials/_payment_orders.haml +++ /dev/null @@ -1,19 +0,0 @@ -%h4= "Payment Orders" -%hr -.table-responsive - %table.table.table-hover.table-condensed - %thead - %tr - %th{class: 'col-xs-1'}= "#" - %th{class: 'col-xs-1'}= "Channel" - %th{class: 'col-xs-2'}= "Status" - %th{class: 'col-xs-3'}= "Initiated" - %th{class: 'col-xs-4'}= "Notes" - %tbody - - @invoice.payment_orders.each do |payment_order| - %tr - %td= payment_order.id - %td= payment_order.channel - %td= payment_order.status - %td= payment_order.created_at - %td= payment_order.notes diff --git a/app/views/registrar/invoices/partials/_seller.haml b/app/views/registrar/invoices/partials/_seller.haml deleted file mode 100644 index 30f27bcef9..0000000000 --- a/app/views/registrar/invoices/partials/_seller.haml +++ /dev/null @@ -1,38 +0,0 @@ -%h4= t(:seller) -%hr -%dl.dl-horizontal - %dt= t(:name) - %dd= @invoice.seller_name - - %dt= Registrar.human_attribute_name :reg_no - %dd= @invoice.seller_reg_no - - %dt= t(:iban) - %dd= @invoice.seller_iban - - %dt= t(:bank) - %dd= @invoice.seller_bank - - %dt= t(:swift) - %dd= @invoice.seller_swift - - %dt= Registrar.human_attribute_name :vat_no - %dd= @invoice.seller_vat_no - - %dt= t(:address) - %dd= @invoice.seller_address - - %dt= t(:country) - %dd= @invoice.seller_country - - %dt= t(:phone) - %dd= @invoice.seller_phone - - %dt= t(:url) - %dd= @invoice.seller_url - - %dt= t(:email) - %dd= @invoice.seller_email - - %dt= t(:issuer) - %dd= @invoice.seller_contact_name diff --git a/app/views/registrar/invoices/show.haml b/app/views/registrar/invoices/show.haml deleted file mode 100644 index 5e6104091c..0000000000 --- a/app/views/registrar/invoices/show.haml +++ /dev/null @@ -1,20 +0,0 @@ -- content_for :actions do - = link_to(t('.download_btn'), download_registrar_invoice_path(@invoice), class: 'btn btn-default') - = link_to(t('.deliver_btn'), new_registrar_invoice_delivery_path(@invoice), class: 'btn btn-default') - - if @invoice.cancellable? - = link_to(t(:cancel), cancel_registrar_invoice_path(@invoice), method: :patch, class: 'btn btn-warning') - = link_to(t(:back), registrar_invoices_path, class: 'btn btn-default') -= render 'shared/title', name: @invoice.to_s -= render 'shared/full_errors', object: @invoice - -.row - .col-md-6= render 'registrar/invoices/partials/details' -.row - .col-md-6= render 'registrar/invoices/partials/seller' - .col-md-6= render 'registrar/invoices/partials/buyer' -.row - .col-md-12= render 'registrar/invoices/partials/items' - -- if @invoice.payable? - .row.semifooter - .col-md-6-offset-6.text-right= render 'registrar/invoices/partials/banklinks', locals: { payment_channels: PaymentOrder::CUSTOMER_PAYMENT_METHODS } diff --git a/app/views/registrar/payments/pay.html.haml b/app/views/registrar/payments/pay.html.haml deleted file mode 100644 index dd3fc982fb..0000000000 --- a/app/views/registrar/payments/pay.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.h3 - = t('registrar.invoices.redirected_to_intermediary') - -.payment-form - = form_tag @payment_order.form_url, method: :post do - - @payment_order.form_fields.each do |k, v| - = hidden_field_tag k, v - = submit_tag t('registrar.invoices.go_to_intermediary') - -:javascript - function load_listener() { - $('.payment-form form').submit(); - } - window.addEventListener('load', load_listener) diff --git a/app/views/registrar/polls/show.haml b/app/views/registrar/polls/show.haml deleted file mode 100644 index c97d7a5d57..0000000000 --- a/app/views/registrar/polls/show.haml +++ /dev/null @@ -1,48 +0,0 @@ -- if @data.css('msgQ').any? - - msg_q = @data.css('msgQ').first - .row - .col-sm-12 - %h2= t '.header', count: msg_q['count'] - %hr - .row - .col-md-12 - .panel.panel-default - .panel-heading.clearfix - .pull-left= t('message_no', id: msg_q['id']) - .pull-right - - if @data.css('trnData trStatus').any? # this is a transfer request - - unless ['serverApproved', 'clientApproved'].include?(@data.css('trStatus').first.text) - = link_to(t(:confirm), 'javascript: void(0);', class: 'btn btn-warning btn-xs js-transfer-confirm') - = link_to(t(:dequeue), registrar_poll_path(id: msg_q['id']), method: :delete, class: 'btn btn-primary btn-xs') - .panel-body - %dl.dl-horizontal - %dt= t(:message) - %dd= msg_q.css('msg').text - - %dt= t(:queue_date) - %dd= @data.css('qDate').text - - %dl.dl-horizontal - - if @data.css('trnData trStatus').any? # this is a transfer request - = form_tag confirm_transfer_registrar_poll_path, class: 'js-transfer-form' do - = hidden_field_tag 'domain[name]', @data.css('name').text - - - @data.css('trnData').children.each do |x| - - next if x.blank? - %dt= t(x.name) - %dd= x.text - -- else - .row - .col-sm-12 - %h2= t '.header', count: 0 - %hr - .row - .col-md-12 - %p.bg-info{style: 'padding: 15px;'}= t(:you_have_no_new_messages) - -:coffee - load_listener = -> - $(".js-transfer-confirm").on "click", -> - $(".js-transfer-form").submit() - window.addEventListener 'load', load_listener diff --git a/app/views/registrar/sessions/new.html.erb b/app/views/registrar/sessions/new.html.erb deleted file mode 100644 index 2ce0b0f1ae..0000000000 --- a/app/views/registrar/sessions/new.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -
- -
diff --git a/app/views/registrar/settings/balance_auto_reload/_form.html.erb b/app/views/registrar/settings/balance_auto_reload/_form.html.erb deleted file mode 100644 index ecd34980ea..0000000000 --- a/app/views/registrar/settings/balance_auto_reload/_form.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'registrar/settings/balance_auto_reload/form/types/threshold', type: @type %> \ No newline at end of file diff --git a/app/views/registrar/settings/balance_auto_reload/edit.html.erb b/app/views/registrar/settings/balance_auto_reload/edit.html.erb deleted file mode 100644 index 20aa88d2df..0000000000 --- a/app/views/registrar/settings/balance_auto_reload/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ - - - - -<%= render 'form' %> \ No newline at end of file diff --git a/app/views/registrar/settings/balance_auto_reload/form/types/_threshold.erb b/app/views/registrar/settings/balance_auto_reload/form/types/_threshold.erb deleted file mode 100644 index bcb6494212..0000000000 --- a/app/views/registrar/settings/balance_auto_reload/form/types/_threshold.erb +++ /dev/null @@ -1,40 +0,0 @@ -

<%= t '.description' %>

- -<%= form_for type, as: :type, url: registrar_settings_balance_auto_reload_path, method: :patch, - html: { class: 'form-horizontal' } do |f| %> - <%= render 'form_errors', target: type %> - -
- <%= f.label :amount, class: 'col-md-2 control-label' %> - -
-
- <%= f.money_field :amount, required: true, autofocus: true, class: 'form-control' %> -
<%= Money::default_currency.symbol %>
-
-
- -
- <%= t '.amount_hint', min_amount: f.object.min_amount %> -
-
- -
- <%= f.label :threshold, class: 'col-md-2 control-label' %> - -
-
- <%= f.money_field :threshold, required: true, class: 'form-control' %> -
<%= Money::default_currency.symbol %>
-
-
-
- -
- -
-
- <%= f.submit t('.submit_btn'), class: 'btn btn-success' %> -
-
-<% end %> \ No newline at end of file diff --git a/app/views/registrar/shared/_epp_results.haml b/app/views/registrar/shared/_epp_results.haml deleted file mode 100644 index 4dfaadaedd..0000000000 --- a/app/views/registrar/shared/_epp_results.haml +++ /dev/null @@ -1,31 +0,0 @@ -- if @data && @data.css('result') - - @results ||= @data.css('result') - -- if @results || flash[:epp_results] - - success_codes = %(1000, 1300, 1301, 200) - - - if @results - - @results.each do |x| - - next if success_codes.include?(x['code']) - .row - .col-md-12 - %p{class: "alert alert-danger"} - = x.css('msg').text.split('[').first - - if x.css('value').text.present? - = " - #{x.css('value').text}" - %span.pull-right - = "[code: #{x['code']}]" - - - if flash[:epp_results] - - flash[:epp_results].each do |x| - - next if success_codes.include?(x['code']) && x['show'] != true - - c = 'alert-danger' - - c = 'alert-success' if success_codes.include?(x['code']) - .row - .col-md-12 - %p{class: "alert #{c}"} - = x['msg'].split('[').first - - if x['value'].present? - = " - #{x['value']}" - %span.pull-right - = "[code: #{x['code']}]" diff --git a/app/views/registrar/shared/_error_messages.haml b/app/views/registrar/shared/_error_messages.haml deleted file mode 100644 index fd9b5bfbcd..0000000000 --- a/app/views/registrar/shared/_error_messages.haml +++ /dev/null @@ -1,5 +0,0 @@ -- if f.object.errors.present? - .alert.alert-warning - %ul - - f.object.errors.messages.each do |message| - %li= message.second.first.split('[').first diff --git a/app/views/registrar/tara/callback.html.erb b/app/views/registrar/tara/callback.html.erb deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/check.xml b/app/views/registrar/xml_consoles/epp_requests/contact/check.xml deleted file mode 100644 index f4c10d8bdd..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/contact/check.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - sh8013 - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml b/app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml deleted file mode 100644 index bdcff03dd4..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - sh8013 - sh13 - vsdfvq - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/create.xml b/app/views/registrar/xml_consoles/epp_requests/contact/create.xml deleted file mode 100644 index fc60b8311f..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/contact/create.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - Sillius Soddus - - 123 Example Dr. - Suite 100 - - Megaton - F3 - 201-33 - EE - - - +372.1234567 - example@test.example - - - - - 123 - - dGVzdCBmYWlsCg== - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/delete.xml b/app/views/registrar/xml_consoles/epp_requests/contact/delete.xml deleted file mode 100644 index 28b50af643..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/contact/delete.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - sh8013 - - wrong-one - - - - - - - dGVzdCBmYWlsCg== - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/info.xml b/app/views/registrar/xml_consoles/epp_requests/contact/info.xml deleted file mode 100644 index 44e5d5a1ef..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/contact/info.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - sh8013 - - Aas34fq - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml b/app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml deleted file mode 100644 index 61ea43202c..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - sh8013 - - - John Doe - - 123 Example Dr. - Suite 100 - Dulles - VA - 20166-6503 - EE - - - +123.7035555555 - jdoe@example.com - - 2fooBAR - - - - - - - - dGVzdCBmYWlsCg== - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/check.xml b/app/views/registrar/xml_consoles/epp_requests/domain/check.xml deleted file mode 100644 index 06492bcfe2..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/domain/check.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - example.ee - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/client_hold.xml b/app/views/registrar/xml_consoles/epp_requests/domain/client_hold.xml deleted file mode 100644 index 68f0b778ec..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/domain/client_hold.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - example.ee - - - - - - timo-1579351654 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/create.xml b/app/views/registrar/xml_consoles/epp_requests/domain/create.xml deleted file mode 100644 index f57fcfe30d..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/domain/create.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - example.ee - 1 - - - ns1.example.net - - - ns2.example.net - 192.0.2.2 - 1080:0:0:0:8:800:200C:417A - - - jd1234 - sh8013 - sh8013 - sh801333 - - - - - - 257 - 3 - 8 - AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8 - - - - - dGVzdCBmYWlsCg== - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/delete.xml b/app/views/registrar/xml_consoles/epp_requests/domain/delete.xml deleted file mode 100644 index f47bb79eb0..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/domain/delete.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - example.ee - - - - - - dGVzdCBmYWlsCg== - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/info.xml b/app/views/registrar/xml_consoles/epp_requests/domain/info.xml deleted file mode 100644 index 210396c3ba..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/domain/info.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - example.ee - - 2fooBAR - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/renew.xml b/app/views/registrar/xml_consoles/epp_requests/domain/renew.xml deleted file mode 100644 index 6ef479468a..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/domain/renew.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - example.ee - 2014-08-07 - 1 - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml b/app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml deleted file mode 100644 index f6ee87b79e..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - example.ee - - 2BARfoo - - - - - - - dGVzdCBmYWlsCg== - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/update.xml b/app/views/registrar/xml_consoles/epp_requests/domain/update.xml deleted file mode 100644 index c087245e78..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/domain/update.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - example.ee - - - - ns1.example.com - - - ns2.example.com - - - mak21 - - - - - ns1.example.net - - - mak21 - - - mak21 - - newpw - - - - - - - - - 257 - 3 - 8 - 700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f - - - - - - dGVzdCBmYWlsCg== - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/epp_requests/poll/poll.xml b/app/views/registrar/xml_consoles/epp_requests/poll/poll.xml deleted file mode 100644 index 5ffed010e6..0000000000 --- a/app/views/registrar/xml_consoles/epp_requests/poll/poll.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - ABC-12345 - - diff --git a/app/views/registrar/xml_consoles/show.haml b/app/views/registrar/xml_consoles/show.haml deleted file mode 100644 index bb66116eef..0000000000 --- a/app/views/registrar/xml_consoles/show.haml +++ /dev/null @@ -1,73 +0,0 @@ -= render 'shared/title', name: t(:xml_console) - -.row - .col-md-8 - = form_tag(registrar_xml_console_path) do - .form-group - = text_area_tag(:payload, params[:payload], class: 'form-control', rows: 15, style: 'font-family:monospace; font-size: 11px;') - - = button_tag t(:send_epp_request), class: 'btn btn-default' - .col-md-4 - %h4 Domain - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'create'}} - Create - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'update'}} - Update - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'info'}} - Info - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'renew'}} - Renew - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'check'}} - Check - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'transfer'}} - Transfer - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'delete'}} - Delete - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'client_hold'}} - Remove Client Hold - - %h4 Poll - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'poll', epp_action: 'poll'}} - Poll - - %h4 Contact - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'contact', epp_action: 'create'}} - Create - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'contact', epp_action: 'check'}} - Check - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'contact', epp_action: 'check_multiple'}} - Check(multiple) - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'contact', epp_action: 'delete'}} - Delete - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'contact', epp_action: 'info'}} - Info - , - %a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'contact', epp_action: 'update_chg'}} - Update(chg) - -- if @result - %hr - .row - .col-md-12 - = preserve do - = CodeRay.scan(@result.to_s.force_encoding("UTF-8"), :xml).div().html_safe - -:javascript - window.addEventListener('load', - function(){ - $('.js-load-xml').click(function() { - $.get('xml_console/load_xml', {obj: $(this).data('obj'), epp_action: $(this).data('epp-action')}, function(data) { - $('textarea[name="payload"]').html(data); - }); - });}); From 70d8c5bad35e384dd1da269cb199dfc171625929 Mon Sep 17 00:00:00 2001 From: Thiago Youssef Date: Sun, 4 Sep 2022 17:13:54 -0300 Subject: [PATCH 2/7] Remove registrar portal tests --- .../registrar_area/contacts_test.rb | 25 --- .../registrar_area/domains_test.rb | 22 --- .../invoices/payment_callback_test.rb | 65 ------ .../invoices/payment_return_test.rb | 137 ------------- .../registrar_area/invoices_test.rb | 19 -- .../settings/balance_auto_reload_test.rb | 32 --- .../registrar_area/xml_consoles_test.rb | 112 ----------- .../registrar_area/account_activities_test.rb | 44 ----- test/system/registrar_area/account_test.rb | 26 --- .../registrar_area/add_deposits_test.rb | 12 -- test/system/registrar_area/base_test.rb | 51 ----- .../billing/balance_top_up_test.rb | 46 ----- .../bulk_change/admin_contact_test.rb | 49 ----- .../bulk_change/bulk_renew_test.rb | 70 ------- .../bulk_change/bulk_transfer_test.rb | 42 ---- .../bulk_change/nameserver_test.rb | 185 ------------------ .../bulk_change/tech_contact_test.rb | 47 ----- test/system/registrar_area/contact_test.rb | 45 ----- test/system/registrar_area/domains_test.rb | 21 -- .../registrar_area/invoices/list_test.rb | 40 ---- .../invoices/new_invoice_payment_test.rb | 28 --- .../registrar_area/invoices/new_test.rb | 100 ---------- test/system/registrar_area/invoices_test.rb | 61 ------ .../registrar_area/protected_area_test.rb | 25 --- .../settings/balance_auto_reload_test.rb | 74 ------- .../registrar_area/sign_in/password_test.rb | 52 ----- test/system/registrar_area/sign_out_test.rb | 15 -- .../registrar_area/tara/tara_users_test.rb | 63 ------ .../registrar_area/xml_consoles_test.rb | 33 ---- 29 files changed, 1541 deletions(-) delete mode 100644 test/integration/registrar_area/contacts_test.rb delete mode 100644 test/integration/registrar_area/domains_test.rb delete mode 100644 test/integration/registrar_area/invoices/payment_callback_test.rb delete mode 100644 test/integration/registrar_area/invoices/payment_return_test.rb delete mode 100644 test/integration/registrar_area/invoices_test.rb delete mode 100644 test/integration/registrar_area/settings/balance_auto_reload_test.rb delete mode 100644 test/integration/registrar_area/xml_consoles_test.rb delete mode 100644 test/system/registrar_area/account_activities_test.rb delete mode 100644 test/system/registrar_area/account_test.rb delete mode 100644 test/system/registrar_area/add_deposits_test.rb delete mode 100644 test/system/registrar_area/base_test.rb delete mode 100644 test/system/registrar_area/billing/balance_top_up_test.rb delete mode 100644 test/system/registrar_area/bulk_change/admin_contact_test.rb delete mode 100644 test/system/registrar_area/bulk_change/bulk_renew_test.rb delete mode 100644 test/system/registrar_area/bulk_change/bulk_transfer_test.rb delete mode 100644 test/system/registrar_area/bulk_change/nameserver_test.rb delete mode 100644 test/system/registrar_area/bulk_change/tech_contact_test.rb delete mode 100644 test/system/registrar_area/contact_test.rb delete mode 100644 test/system/registrar_area/domains_test.rb delete mode 100644 test/system/registrar_area/invoices/list_test.rb delete mode 100644 test/system/registrar_area/invoices/new_invoice_payment_test.rb delete mode 100644 test/system/registrar_area/invoices/new_test.rb delete mode 100644 test/system/registrar_area/invoices_test.rb delete mode 100644 test/system/registrar_area/protected_area_test.rb delete mode 100644 test/system/registrar_area/settings/balance_auto_reload_test.rb delete mode 100644 test/system/registrar_area/sign_in/password_test.rb delete mode 100644 test/system/registrar_area/sign_out_test.rb delete mode 100644 test/system/registrar_area/tara/tara_users_test.rb delete mode 100644 test/system/registrar_area/xml_consoles_test.rb diff --git a/test/integration/registrar_area/contacts_test.rb b/test/integration/registrar_area/contacts_test.rb deleted file mode 100644 index a8e50aafa4..0000000000 --- a/test/integration/registrar_area/contacts_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'test_helper' - -class RegistrarAreaContactsIntegrationTest < ApplicationIntegrationTest - setup do - sign_in users(:api_bestnames) - end - - def test_downloads_list_as_csv - get registrar_contacts_path(format: :csv) - - assert_response :ok - assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type'] - assert_equal "attachment; filename=\"contacts.csv\"; filename*=UTF-8''contacts.csv", response.headers['Content-Disposition'] - assert_not_empty response.body - end - - def test_downloads_list_as_pdf - get registrar_contacts_path(format: :pdf) - - assert_response :ok - assert_equal Mime[:pdf], response.headers['Content-Type'] - assert_equal "attachment; filename=\"contacts.pdf\"; filename*=UTF-8''contacts.pdf", response.headers['Content-Disposition'] - assert_not_empty response.body - end -end diff --git a/test/integration/registrar_area/domains_test.rb b/test/integration/registrar_area/domains_test.rb deleted file mode 100644 index 307bcae5ef..0000000000 --- a/test/integration/registrar_area/domains_test.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'test_helper' - -class RegistrarAreaDomainsIntegrationTest < ApplicationIntegrationTest - include FormTagHelper - - setup do - sign_in users(:api_bestnames) - end - - def test_downloads_list_as_csv - now = Time.zone.parse('2010-07-05 08:00') - travel_to now - - get registrar_domains_path(format: :csv) - - assert_response :ok - assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type'] - assert_equal %(attachment; filename="Domains_#{l(now, format: :filename)}.csv"; filename*=UTF-8''Domains_#{l(now, format: :filename)}.csv), - response.headers['Content-Disposition'] - assert_not_empty response.body - end -end diff --git a/test/integration/registrar_area/invoices/payment_callback_test.rb b/test/integration/registrar_area/invoices/payment_callback_test.rb deleted file mode 100644 index 94ca6e3736..0000000000 --- a/test/integration/registrar_area/invoices/payment_callback_test.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'test_helper' - -class PaymentCallbackTest < ApplicationIntegrationTest - def setup - super - - @user = users(:api_bestnames) - sign_in @user - - @payment_order = payment_orders(:everypay_issued) - @invoice = invoices(:one) - @invoice.update!(account_activity: nil, total: 12) - end - - def test_every_pay_callback_returns_status_200 - request_params = every_pay_request_params - post "/registrar/pay/callback/#{@payment_order.id}", params: request_params - - assert_response :ok - end - - def test_invoice_is_marked_as_paid - request_params = every_pay_request_params - post "/registrar/pay/callback/#{@payment_order.id}", params: request_params - - assert @payment_order.invoice.paid? - end - - def failure_log_is_created_if_unsuccessful_payment - request_params = every_pay_request_params.dup - request_params['payment_state'] = 'cancelled' - request_params['transaction_result'] = 'failed' - - post "/registrar/pay/callback/#{@payment_order.id}", params: request_params - - @payment_order.reload - assert @payment_order.cancelled? - assert_includes @payment_order.notes, 'Payment state: cancelled' - end - - private - - def every_pay_request_params - { - nonce: "392f2d7748bc8cb0d14f263ebb7b8932", - timestamp: "1524136727", - api_username: "ca8d6336dd750ddb", - transaction_result: "completed", - payment_reference: "fd5d27b59a1eb597393cd5ff77386d6cab81ae05067e18d530b10f3802e30b56", - payment_state: "settled", - amount: "12.00", - order_reference: "e468a2d59a731ccc546f2165c3b1a6", - account_id: "EUR3D1", - cc_type: "master_card", - cc_last_four_digits: "0487", - cc_month: "10", - cc_year: "2018", - cc_holder_name: "John Doe", - hmac_fields: "account_id,amount,api_username,cc_holder_name,cc_last_four_digits,cc_month,cc_type,cc_year,hmac_fields,nonce,order_reference,payment_reference,payment_state,timestamp,transaction_result", - hmac: "efac1c732835668cd86023a7abc140506c692f0d", - invoice_id: "12900000", - payment_method: "every_pay" - } - end -end diff --git a/test/integration/registrar_area/invoices/payment_return_test.rb b/test/integration/registrar_area/invoices/payment_return_test.rb deleted file mode 100644 index a4adb81605..0000000000 --- a/test/integration/registrar_area/invoices/payment_return_test.rb +++ /dev/null @@ -1,137 +0,0 @@ -require 'test_helper' - -class PaymentReturnTest < ApplicationIntegrationTest - def setup - super - - @user = users(:api_bestnames) - sign_in @user - - @invoice = invoices(:one) - @invoice.update!(account_activity: nil, total: 12) - @everypay_order = payment_orders(:everypay_issued) - @banklink_order = payment_orders(:banklink_issued) - end - - def every_pay_request_params - { - nonce: "392f2d7748bc8cb0d14f263ebb7b8932", - timestamp: "1524136727", - api_username: "ca8d6336dd750ddb", - transaction_result: "completed", - payment_reference: "fd5d27b59a1eb597393cd5ff77386d6cab81ae05067e18d530b10f3802e30b56", - payment_state: "settled", - amount: "12.00", - order_reference: "e468a2d59a731ccc546f2165c3b1a6", - account_id: "EUR3D1", - cc_type: "master_card", - cc_last_four_digits: "0487", - cc_month: "10", - cc_year: "2018", - cc_holder_name: "John Doe", - hmac_fields: "account_id,amount,api_username,cc_holder_name,cc_last_four_digits,cc_month,cc_type,cc_year,hmac_fields,nonce,order_reference,payment_reference,payment_state,timestamp,transaction_result", - hmac: "efac1c732835668cd86023a7abc140506c692f0d", - invoice_id: "12900000", - payment_method: "every_pay" - } - end - - def bank_link_request_params - { - "VK_SERVICE": "1111", - "VK_VERSION": "008", - "VK_SND_ID": "testvpos", - "VK_REC_ID": "seb", - "VK_STAMP": 1, - "VK_T_NO": "1", - "VK_AMOUNT": "12.00", - "VK_CURR": "EUR", - "VK_REC_ACC": "1234", - "VK_REC_NAME": "Eesti Internet", - "VK_SND_ACC": "1234", - "VK_SND_NAME": "John Doe", - "VK_REF": "", - "VK_MSG": "Order nr 1", - "VK_T_DATETIME": "2018-04-01T00:30:00+0300", - "VK_MAC": "CZZvcptkxfuOxRR88JmT4N+Lw6Hs4xiQfhBWzVYldAcRTQbcB/lPf9MbJzBE4e1/HuslQgkdCFt5g1xW2lJwrVDBQTtP6DAHfvxU3kkw7dbk0IcwhI4whUl68/QCwlXEQTAVDv1AFnGVxXZ40vbm/aLKafBYgrirB5SUe8+g9FE=", - "VK_ENCODING": "UTF-8", - "VK_LANG": "ENG", - payment_method: "seb" - } - end - - def test_successful_bank_payment_marks_invoice_as_paid - @invoice.update!(account_activity: nil) - request_params = bank_link_request_params - - post "/registrar/pay/return/#{@banklink_order.id}", params: request_params - - @banklink_order.reload - assert @banklink_order.invoice.paid? - end - - def test_every_pay_return_creates_activity_redirects_to_invoice_path - request_params = every_pay_request_params - - post "/registrar/pay/return/#{@everypay_order.id}", params: request_params - assert_equal(302, response.status) - assert_redirected_to(registrar_invoice_path(@invoice)) - end - - def test_every_pay_return_raises_record_not_found - request_params = every_pay_request_params - assert_raises(ActiveRecord::RecordNotFound) do - post '/registrar/pay/return/123456', params: request_params - end - end - - def test_bank_link_return_redirects_to_invoice_paths - request_params = bank_link_request_params - - post "/registrar/pay/return/#{@banklink_order.id}", params: request_params - assert_equal(302, response.status) - assert_redirected_to(registrar_invoice_path(@invoice)) - end - - def test_bank_link_return - request_params = bank_link_request_params - assert_raises(ActiveRecord::RecordNotFound) do - post '/registrar/pay/return/123456', params: request_params - end - end - - def test_marks_as_paid_and_adds_notes_if_failed_to_bind - request_params = bank_link_request_params - - post "/registrar/pay/return/#{@banklink_order.id}", params: request_params - post "/registrar/pay/return/#{@banklink_order.id}", params: request_params - @banklink_order.reload - - assert @banklink_order.notes.present? - assert @banklink_order.paid? - assert_includes @banklink_order.notes, 'Failed to bind' - end - - def test_failed_bank_link_payment_creates_brief_error_explanation - request_params = bank_link_request_params.dup - request_params['VK_SERVICE'] = '1911' - - post "/registrar/pay/return/#{@banklink_order.id}", params: request_params - - @banklink_order.reload - - assert_includes @banklink_order.notes, 'Bank responded with code 1911' - end - - def test_failed_every_pay_payment_creates_brief_error_explanation - request_params = every_pay_request_params.dup - request_params['payment_state'] = 'cancelled' - request_params['transaction_result'] = 'failed' - - post "/registrar/pay/return/#{@everypay_order.id}", params: request_params - - @everypay_order.reload - - assert_includes @everypay_order.notes, 'Payment state: cancelled' - end -end diff --git a/test/integration/registrar_area/invoices_test.rb b/test/integration/registrar_area/invoices_test.rb deleted file mode 100644 index 91c6afbd80..0000000000 --- a/test/integration/registrar_area/invoices_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'test_helper' - -class RegistrarAreaInvoicesIntegrationTest < ApplicationIntegrationTest - setup do - @invoice = invoices(:one) - sign_in users(:api_bestnames) - end - - def test_downloads_invoice - assert_equal 1, @invoice.number - - get download_registrar_invoice_path(@invoice) - - assert_response :ok - assert_equal 'application/pdf', response.headers['Content-Type'] - assert_equal "attachment; filename=\"invoice-1.pdf\"; filename*=UTF-8''invoice-1.pdf", response.headers['Content-Disposition'] - assert_not_empty response.body - end -end diff --git a/test/integration/registrar_area/settings/balance_auto_reload_test.rb b/test/integration/registrar_area/settings/balance_auto_reload_test.rb deleted file mode 100644 index 1a2c3f835b..0000000000 --- a/test/integration/registrar_area/settings/balance_auto_reload_test.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'test_helper' - -class RegistrarAreaSettingsBalanceAutoReloadIntegrationTest < ActionDispatch::IntegrationTest - include Devise::Test::IntegrationHelpers - - setup do - @registrar = registrars(:bestnames) - sign_in users(:api_bestnames) - end - - def test_updates_balance_auto_reload_setting - amount = 100 - threshold = 10 - assert_nil @registrar.settings['balance_auto_reload'] - - patch registrar_settings_balance_auto_reload_path, params: { type: { amount: amount, - threshold: threshold } } - @registrar.reload - - assert_equal amount, @registrar.settings['balance_auto_reload']['type']['amount'] - assert_equal threshold, @registrar.settings['balance_auto_reload']['type']['threshold'] - end - - def test_disables_balance_auto_reload_setting - @registrar.update!(settings: { balance_auto_reload: { amount: 'any', threshold: 'any' } }) - - delete registrar_settings_balance_auto_reload_path - @registrar.reload - - assert_nil @registrar.settings['balance_auto_reload'] - end -end \ No newline at end of file diff --git a/test/integration/registrar_area/xml_consoles_test.rb b/test/integration/registrar_area/xml_consoles_test.rb deleted file mode 100644 index 443abfb78f..0000000000 --- a/test/integration/registrar_area/xml_consoles_test.rb +++ /dev/null @@ -1,112 +0,0 @@ -require 'test_helper' - -class RegistrarXmlConsolesIntegrationTest < ApplicationIntegrationTest - setup do - sign_in users(:api_bestnames) - end - - def test_check_schema_path - post registrar_xml_console_path, params: { frame: payload }, - headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } - - assert_response :ok - end - - def test_load_schema_path - get load_xml_registrar_xml_console_path, params: { obj: 'domain', epp_action: 'update' } - - assert_response :ok - assert_equal update_payload, response.body - end - - private - - def payload - <<~XML - - - - - - auction.test - - - - - XML - end - - def wrong_payload - <<~XML - - - - - - auction.test - - - - - XML - end - - def update_payload - <<~XML - - - - - - example.ee - - - - ns1.example.com - - - ns2.example.com - - - mak21 - - - - - ns1.example.net - - - mak21 - - - mak21 - - newpw - - - - - - - - - 257 - 3 - 8 - 700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f - - - - - - dGVzdCBmYWlsCg== - - - - test_bestnames-#{Time.zone.now.to_i} - - - XML - end -end diff --git a/test/system/registrar_area/account_activities_test.rb b/test/system/registrar_area/account_activities_test.rb deleted file mode 100644 index 08ffe447f5..0000000000 --- a/test/system/registrar_area/account_activities_test.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAccountActivitiesTest < ApplicationSystemTestCase - setup do - @registrar = registrars(:bestnames) - sign_in users(:api_bestnames) - end - - def test_show_account_activity_page - account_activities(:one).update(sum: "123.00") - visit registrar_account_activities_path - assert_text 'Account activity' - end - - def test_download_account_activity - now = Time.zone.parse('2010-07-05 08:00') - travel_to now - account_activities(:one).update(sum: "123.00") - - get registrar_account_activities_path(format: :csv) - - assert_response :ok - assert_equal "text/csv", response.headers['Content-Type'] - assert_equal %(attachment; filename="account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv"; filename*=UTF-8''account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv), - response.headers['Content-Disposition'] - assert_not_empty response.body - end - - def test_search_account_activity_with_invalid_date - account_activities(:one).update(description: "Description of activity one", - sum: "123.00", - activity_type: "create", - created_at: Time.zone.parse('2021-07-05 10:00')) - - visit registrar_account_activities_path - - find('#q_activity_type_in').click - find(:option, "Renew").select_option - fill_in('q_created_at_lteq', with: '2021-12--') - find(:xpath, ".//button[./span[contains(@class, 'glyphicon-search')]]").click - - assert_text 'Description of activity renew_cash' - end -end diff --git a/test/system/registrar_area/account_test.rb b/test/system/registrar_area/account_test.rb deleted file mode 100644 index 708f8dc8f6..0000000000 --- a/test/system/registrar_area/account_test.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAccountTest < ApplicationSystemTestCase - setup do - @registrar = registrars(:bestnames) - sign_in users(:api_bestnames) - end - - def test_updates_account - new_billing_email = 'new@registrar.test' - new_iban = 'GB77BARC20201530093459' - assert_not_equal new_billing_email, @registrar.billing_email - assert_not_equal new_iban, @registrar.iban - - visit registrar_account_path - click_on 'Edit' - - fill_in 'Billing email', with: new_billing_email - fill_in 'IBAN', with: new_iban - click_on 'Save changes' - - assert_text 'Your account has been updated' - assert_text new_billing_email - assert_text new_iban - end -end \ No newline at end of file diff --git a/test/system/registrar_area/add_deposits_test.rb b/test/system/registrar_area/add_deposits_test.rb deleted file mode 100644 index 3ca7691cef..0000000000 --- a/test/system/registrar_area/add_deposits_test.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'application_system_test_case' - -class AddDepositsTest < ApplicationSystemTestCase - include ActionMailer::TestHelper - - setup do - sign_in users(:api_bestnames) - @invoice = invoices(:one) - - ActionMailer::Base.deliveries.clear - end -end diff --git a/test/system/registrar_area/base_test.rb b/test/system/registrar_area/base_test.rb deleted file mode 100644 index 2529b009a3..0000000000 --- a/test/system/registrar_area/base_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaBaseTestTest < ApplicationSystemTestCase - setup do - @original_registrar_area_ip_whitelist = Setting.registrar_ip_whitelist_enabled - end - - teardown do - Setting.registrar_ip_whitelist_enabled = @original_registrar_area_ip_whitelist - end - - def test_user_cannot_access_without_ip_address_being_whitelisted - Setting.registrar_ip_whitelist_enabled = true - WhiteIp.delete_all - - visit new_registrar_user_session_url - - assert_text 'Access denied from IP 127.0.0.1' - assert_no_button 'Login' - end - - def test_user_can_access_when_ip_is_whitelisted - white_ips(:one).update!(ipv4: '127.0.0.1', interfaces: [WhiteIp::REGISTRAR]) - Setting.registrar_ip_whitelist_enabled = true - - visit new_registrar_user_session_url - - assert_no_text 'Access denied from IP 127.0.0.1' - assert_button 'Login' - end - - def test_user_can_access_when_ip_is_whitelisted_with_subnet - white_ips(:one).update!(ipv4: '127.0.0.1/32', interfaces: [WhiteIp::REGISTRAR]) - Setting.registrar_ip_whitelist_enabled = true - - visit new_registrar_user_session_url - - assert_no_text 'Access denied from IP 127.0.0.1' - assert_button 'Login' - end - - def test_user_can_access_when_ip_is_not_whitelisted_and_whitelist_is_disabled - Setting.registrar_ip_whitelist_enabled = false - WhiteIp.delete_all - - visit new_registrar_user_session_url - - assert_no_text 'Access denied from IP 127.0.0.1' - assert_button 'Login' - end -end diff --git a/test/system/registrar_area/billing/balance_top_up_test.rb b/test/system/registrar_area/billing/balance_top_up_test.rb deleted file mode 100644 index 5cb32361fc..0000000000 --- a/test/system/registrar_area/billing/balance_top_up_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'application_system_test_case' - -class BalanceTopUpTest < ApplicationSystemTestCase - setup do - sign_in users(:api_bestnames) - @original_registry_vat_rate = Setting.registry_vat_prc - - eis_response = OpenStruct.new(body: "{\"payment_link\":\"http://link.test\"}") - Spy.on_instance_method(EisBilling::AddDeposits, :send_invoice).and_return(eis_response) - Spy.on_instance_method(EisBilling::BaseController, :authorized).and_return(true) - end - - teardown do - Setting.registry_vat_prc = @original_registry_vat_rate - end - - def test_creates_new_invoice - if Feature.billing_system_integrated? - invoice_n = Invoice.order(number: :desc).last.number - stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {}) - - stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response") - .to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {}) - - stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice") - .to_return(status: 200, body: "", headers: {}) - - Setting.registry_vat_prc = 0.1 - - visit registrar_invoices_url - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '25.5' - - assert_difference 'Invoice.count' do - click_link_or_button 'Add' - end - - invoice = Invoice.last - - assert_equal BigDecimal(10), invoice.vat_rate - assert_equal BigDecimal('28.05'), invoice.total - assert_text 'Please pay the following invoice' - end - end -end diff --git a/test/system/registrar_area/bulk_change/admin_contact_test.rb b/test/system/registrar_area/bulk_change/admin_contact_test.rb deleted file mode 100644 index 8847812cbd..0000000000 --- a/test/system/registrar_area/bulk_change/admin_contact_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaAdminContactBulkChangeTest < ApplicationSystemTestCase - setup do - sign_in users(:api_bestnames) - end - - def test_replace_domain_contacts_of_current_registrar - request_stub = stub_request(:patch, /domains\/admin_contacts/) - .with(body: { current_contact_id: 'william-001', new_contact_id: 'john-001' }, - basic_auth: ['test_bestnames', 'testtest']) - .to_return(body: { data: { affected_domains: %w[foo.test bar.test], - skipped_domains: %w[baz.test qux.test] } }.to_json, - status: 200) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Admin contact' - - find('.current_admin_contact').fill_in 'Current contact ID', with: 'william-001' - find('.new_admin_contact').fill_in 'New contact ID', with: 'john-001' - click_on 'Replace admin contacts' - - assert_requested request_stub - assert_current_path registrar_domains_path - assert_text 'Admin contacts have been successfully replaced' - assert_text 'Affected domains: foo.test, bar.test' - assert_text 'Skipped domains: baz.test, qux.test' - end - - def test_fails_gracefully - stub_request(:patch, /domains\/admin_contacts/) - .to_return(status: 400, - body: { message: 'epic fail' }.to_json, - headers: { 'Content-type' => Mime[:json] }) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Admin contact' - - find('.current_admin_contact').fill_in 'Current contact ID', with: 'william-001' - find('.new_admin_contact').fill_in 'New contact ID', with: 'john-001' - click_on 'Replace admin contacts' - - assert_text 'epic fail' - assert_field 'Current contact ID', with: 'william-001' - assert_field 'New contact ID', with: 'john-001' - end -end diff --git a/test/system/registrar_area/bulk_change/bulk_renew_test.rb b/test/system/registrar_area/bulk_change/bulk_renew_test.rb deleted file mode 100644 index 5e1704afd4..0000000000 --- a/test/system/registrar_area/bulk_change/bulk_renew_test.rb +++ /dev/null @@ -1,70 +0,0 @@ -require 'application_system_test_case' - -class BulkRenewTest < ApplicationSystemTestCase - setup do - @registrar = users(:api_bestnames).registrar - @price = billing_prices(:renew_one_year) - end - - def test_shows_domain_list - sign_in users(:api_bestnames) - travel_to Time.zone.parse('2010-07-05 10:30') - - visit new_registrar_bulk_change_url - click_link('Bulk renew') - assert_text 'Current balance' - page.has_css?('#registrar_balance', text: - ApplicationController.helpers.number_to_currency(@registrar.balance)) - - select '1 year', from: 'Period' - click_button 'Filter' - - @registrar.domains.pluck(:name).each do |domain_name| - assert_text domain_name - end - end - - def test_makes_bulk_renew - sign_in users(:api_bestnames) - travel_to Time.zone.parse('2010-07-05 10:30') - - req_body = { domains: ["shop.test", "airport.test", "library.test", "invalid.test"], renew_period: "1y" } - stub_request(:post, "#{ENV['repp_url']}domains/renew/bulk").with(body: req_body) - .to_return(status: 400, body: { - code: 2304, - message: "Domain renew error for invalid.test", - data: {} - }.to_json) - - visit new_registrar_bulk_change_url - click_link('Bulk renew') - select '1 year', from: 'Period' - click_button 'Filter' - click_button 'Renew' - - assert_text 'Domain renew error for invalid.test' - end - - def test_bulk_renew_checks_balance - sign_in users(:api_bestnames) - @price.update(price_cents: 99999999) - travel_to Time.zone.parse('2010-07-05 10:30') - - req_body = { domains: ["shop.test", "airport.test", "library.test", "invalid.test"], renew_period: "1y" } - stub_request(:post, "#{ENV['repp_url']}domains/renew/bulk").with(body: req_body) - .to_return(status: 400, body: { - code: 2304, - message: "Not enough funds for renew domains", - data: {} - }.to_json) - - visit new_registrar_bulk_change_url - click_link('Bulk renew') - select '1 year', from: 'Period' - click_button 'Filter' - click_button 'Renew' - - assert_text 'Not enough funds for renew domains' - - end -end diff --git a/test/system/registrar_area/bulk_change/bulk_transfer_test.rb b/test/system/registrar_area/bulk_change/bulk_transfer_test.rb deleted file mode 100644 index 820b1cf96a..0000000000 --- a/test/system/registrar_area/bulk_change/bulk_transfer_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaBulkTransferTest < ApplicationSystemTestCase - setup do - sign_in users(:api_goodnames) - end - - def test_transfer_multiple_domains_in_bulk - request_body = { data: { domain_transfers: [{ domain_name: 'shop.test', transfer_code: '65078d5' }] } } - headers = { 'Content-type' => Mime[:json] } - request_stub = stub_request(:post, /domains\/transfer/).with(body: request_body, - headers: headers, - basic_auth: ['test_goodnames', 'testtest']) - .to_return(body: { data: { success: [{ type: 'domain_transfer', domain_name: 'shop.test' }], - failed: [] - } }.to_json, status: 200) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Bulk transfer' - attach_file 'Batch file', Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_transfer.csv').to_s - click_button 'Transfer' - - assert_requested request_stub - assert_current_path registrar_domains_path - assert_text '1 domains have been successfully transferred' - end - - def test_fail_gracefully - body = { message: 'epic fail' }.to_json - headers = { 'Content-type' => Mime[:json] } - stub_request(:post, /domains\/transfer/).to_return(status: 400, body: body, headers: headers) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Bulk transfer' - attach_file 'Batch file', Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_transfer.csv').to_s - click_button 'Transfer' - - assert_text 'epic fail' - end -end diff --git a/test/system/registrar_area/bulk_change/nameserver_test.rb b/test/system/registrar_area/bulk_change/nameserver_test.rb deleted file mode 100644 index cfde8e6d16..0000000000 --- a/test/system/registrar_area/bulk_change/nameserver_test.rb +++ /dev/null @@ -1,185 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase - setup do - sign_in users(:api_goodnames) - Capybara.default_max_wait_time = 10 - end - - def test_replaces_current_registrar_nameservers - request_body = { data: { type: 'nameserver', - id: 'ns1.bestnames.test', - domains: [], - attributes: { hostname: 'new-ns.bestnames.test', - ipv4: %w[192.0.2.55 192.0.2.56], - ipv6: %w[2001:db8::55 2001:db8::56] } } } - request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body, - headers: { 'Content-type' => Mime[:json] }, - basic_auth: ['test_goodnames', 'testtest']) - .to_return(body: { data: { - type: 'nameserver', - id: 'new-ns.bestnames.test', - affected_domains: ["airport.test", "shop.test"], - skipped_domains: [] - } - }.to_json, status: 200) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Nameserver' - - fill_in 'Old hostname (optional)', with: 'ns1.bestnames.test' - fill_in 'New hostname', with: 'new-ns.bestnames.test' - fill_in 'ipv4', with: "192.0.2.55\n192.0.2.56" - fill_in 'ipv6', with: "2001:db8::55\n2001:db8::56" - click_on 'Replace/Add nameserver' - - assert_requested request_stub - assert_current_path registrar_domains_path - assert_text 'Nameserver have been successfully replaced' - assert_text 'Affected domains: airport.test, shop.test' - end - - def test_fails_gracefully - stub_request(:put, /registrar\/nameservers/).to_return(status: 400, - body: { message: 'epic fail' }.to_json, - headers: { 'Content-type' => Mime[:json] }) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Nameserver' - - fill_in 'Old hostname (optional)', with: 'old hostname' - fill_in 'New hostname', with: 'new hostname' - fill_in 'ipv4', with: 'ipv4' - fill_in 'ipv6', with: 'ipv6' - click_on 'Replace/Add nameserver' - - assert_text 'epic fail' - assert_field 'Old hostname (optional)', with: 'old hostname' - assert_field 'New hostname', with: 'new hostname' - assert_field 'ipv4', with: 'ipv4' - assert_field 'ipv6', with: 'ipv6' - end - - def test_replaces_nameservers_only_for_scoped_domains - request_body = { data: { type: 'nameserver', - id: 'ns1.bestnames.test', - domains: ['shop.test'], - attributes: { hostname: 'new-ns.bestnames.test', - ipv4: %w[192.0.2.55 192.0.2.56], - ipv6: %w[2001:db8::55 2001:db8::56] } } } - request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body, - headers: { 'Content-type' => Mime[:json] }, - basic_auth: ['test_goodnames', 'testtest']) - .to_return(body: { data: { - type: 'nameserver', - id: 'new-ns.bestnames.test', - affected_domains: ["shop.test"], - skipped_domains: []}}.to_json, status: 200) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Nameserver' - - fill_in 'Old hostname (optional)', with: 'ns1.bestnames.test' - fill_in 'New hostname', with: 'new-ns.bestnames.test' - fill_in 'ipv4', with: "192.0.2.55\n192.0.2.56" - fill_in 'ipv6', with: "2001:db8::55\n2001:db8::56" - attach_file :puny_file, Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_ns_replacement.csv').to_s - - click_on 'Replace/Add nameserver' - - assert_requested request_stub - assert_current_path registrar_domains_path - assert_text 'Nameserver have been successfully replaced' - assert_text 'Affected domains: shop.test' - end - - def test_replaces_nameservers_with_invalid_domains_list - nameserver = nameservers(:shop_ns1) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Nameserver' - - fill_in 'Old hostname (optional)', with: nameserver.hostname - fill_in 'New hostname', with: 'new-ns.bestnames.test' - fill_in 'ipv4', with: "192.0.2.55\n192.0.2.56" - fill_in 'ipv6', with: "2001:db8::55\n2001:db8::56" - attach_file :puny_file, Rails.root.join('test', 'fixtures', 'files', 'invalid_domains_for_ns_replacement.csv').to_s - - assert_no_changes -> { nameserver.hostname } do - click_on 'Replace/Add nameserver' - end - - assert_current_path registrar_domains_path - assert_text 'CSV scoped domain list seems empty. Make sure that domains are added and "Domain" header is present.' - end - - def test_adding_current_registrar_nameservers - request_body = { data: { type: 'nameserver', - id: '', - domains: [], - attributes: { hostname: 'new-ns2.bestnames.test', - ipv4: %w[192.0.2.55 192.0.2.56], - ipv6: %w[2001:db8::55 2001:db8::56] } } } - request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body, - headers: { 'Content-type' => Mime[:json] }, - basic_auth: ['test_goodnames', 'testtest']) - .to_return(body: { data: { - type: 'nameserver', - id: 'new-ns2.bestnames.test', - affected_domains: ["airport.test", "shop.test"], - skipped_domains: [] - } - }.to_json, status: 200) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Nameserver' - - fill_in 'New hostname', with: 'new-ns2.bestnames.test' - fill_in 'ipv4', with: "192.0.2.55\n192.0.2.56" - fill_in 'ipv6', with: "2001:db8::55\n2001:db8::56" - click_on 'Replace/Add nameserver' - - assert_requested request_stub - assert_current_path registrar_domains_path - assert_text 'Nameserver have been successfully added' - assert_text 'Affected domains: airport.test, shop.test' - end - - def test_adding_nameservers_only_for_scoped_domains - request_body = { data: { type: 'nameserver', - id: '', - domains: ['shop.test'], - attributes: { hostname: 'new-ns1.bestnames.test', - ipv4: %w[192.0.2.55 192.0.2.56], - ipv6: %w[2001:db8::55 2001:db8::56] } } } - request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body, - headers: { 'Content-type' => Mime[:json] }, - basic_auth: ['test_goodnames', 'testtest']) - .to_return(body: { data: { - type: 'nameserver', - id: 'new-ns1.bestnames.test', - affected_domains: ["shop.test"], - skipped_domains: []}}.to_json, status: 200) - - visit registrar_domains_url - click_link 'Bulk change' - click_link 'Nameserver' - - fill_in 'New hostname', with: 'new-ns1.bestnames.test' - fill_in 'ipv4', with: "192.0.2.55\n192.0.2.56" - fill_in 'ipv6', with: "2001:db8::55\n2001:db8::56" - attach_file :puny_file, Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_ns_replacement.csv').to_s - - click_on 'Replace/Add nameserver' - - assert_requested request_stub - assert_current_path registrar_domains_path - assert_text 'Nameserver have been successfully added' - assert_text 'Affected domains: shop.test' - end -end diff --git a/test/system/registrar_area/bulk_change/tech_contact_test.rb b/test/system/registrar_area/bulk_change/tech_contact_test.rb deleted file mode 100644 index 055ec25ca6..0000000000 --- a/test/system/registrar_area/bulk_change/tech_contact_test.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaTechContactBulkChangeTest < ApplicationSystemTestCase - setup do - sign_in users(:api_bestnames) - end - - def test_replace_domain_contacts_of_current_registrar - request_stub = stub_request(:patch, /domains\/contacts/) - .with(body: { current_contact_id: 'william-001', new_contact_id: 'john-001' }, - basic_auth: ['test_bestnames', 'testtest']) - .to_return(body: { data: { affected_domains: %w[foo.test bar.test], - skipped_domains: %w[baz.test qux.test] } }.to_json, - status: 200) - - visit registrar_domains_url - click_link 'Bulk change' - - find('.current_tech_contact').fill_in 'Current contact ID', with: 'william-001' - find('.new_tech_contact').fill_in 'New contact ID', with: 'john-001' - click_on 'Replace technical contacts' - - assert_requested request_stub - assert_current_path registrar_domains_path - assert_text 'Technical contacts have been successfully replaced' - assert_text 'Affected domains: foo.test, bar.test' - assert_text 'Skipped domains: baz.test, qux.test' - end - - def test_fails_gracefully - stub_request(:patch, /domains\/contacts/) - .to_return(status: 400, - body: { message: 'epic fail' }.to_json, - headers: { 'Content-type' => Mime[:json] }) - - visit registrar_domains_url - click_link 'Bulk change' - - find('.current_tech_contact').fill_in 'Current contact ID', with: 'william-001' - find('.new_tech_contact').fill_in 'New contact ID', with: 'john-001' - click_on 'Replace technical contacts' - - assert_text 'epic fail' - assert_field 'Current contact ID', with: 'william-001' - assert_field 'New contact ID', with: 'john-001' - end -end diff --git a/test/system/registrar_area/contact_test.rb b/test/system/registrar_area/contact_test.rb deleted file mode 100644 index 8d156f1b80..0000000000 --- a/test/system/registrar_area/contact_test.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaContactTest < ApplicationSystemTestCase - setup do - @registrar = registrars(:bestnames) - @contact = contacts(:john) - sign_in users(:api_bestnames) - end - - def test_creates_contact_with_invalid_phone - visit registrar_contacts_path - click_on 'New' - - fill_in 'depp_contact_ident', with: @contact.ident - fill_in 'depp_contact_name', with: @contact.name - fill_in 'depp_contact_email', with: @contact.email - fill_in 'depp_contact_phone', with: '372' - click_on 'Create' - - assert_text 'Phone number must be in +XXX.YYYYYYY format' - end - - def test_updates_contact_with_invalid_phone - depp_contact = Depp::Contact.new( - id: @contact.id, - name: @contact.name, - code: @contact.code, - email: @contact.email, - phone: @contact.phone, - ident: @contact.ident, - ident_type: @contact.ident_type, - ident_country_code: @contact.ident_country_code) - - Spy.on(Depp::Contact, :find_by_id).and_return(depp_contact) - - visit edit_registrar_contact_path(depp_contact.code) - - assert_text "Edit: #{depp_contact.name}" - - fill_in 'depp_contact_phone', with: '372' - click_on 'Save' - - assert_text 'Phone number must be in +XXX.YYYYYYY format' - end -end diff --git a/test/system/registrar_area/domains_test.rb b/test/system/registrar_area/domains_test.rb deleted file mode 100644 index 7a2f5f7f1d..0000000000 --- a/test/system/registrar_area/domains_test.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'application_system_test_case' - -class RegistrarDomainsTest < ApplicationSystemTestCase - def test_downloads_domain_list_as_csv - sign_in users(:api_bestnames) - travel_to Time.zone.parse('2010-07-05 10:30') - - expected_csv = <<-CSV.strip_heredoc - Domain,Transfer code,Registrant name,Registrant code,Date of expiry - library.test,45118f5,Acme Ltd,acme-ltd-001,2010-07-05 - shop.test,65078d5,John,john-001,2010-07-05 - invalid.test,1438d6,any,invalid,2010-07-05 - airport.test,55438j5,John,john-001,2010-07-05 - CSV - - visit registrar_domains_url - click_button 'Download CSV' - assert_equal "attachment; filename=\"Domains_2010-07-05_10.30.csv\"; filename*=UTF-8''Domains_2010-07-05_10.30.csv", response_headers['Content-Disposition'] - assert_equal expected_csv, page.body - end -end diff --git a/test/system/registrar_area/invoices/list_test.rb b/test/system/registrar_area/invoices/list_test.rb deleted file mode 100644 index ffab9c202b..0000000000 --- a/test/system/registrar_area/invoices/list_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'application_system_test_case' - -class ListInvoicesTest < ApplicationSystemTestCase - setup do - @user = users(:api_bestnames) - @invoice = invoices(:one) - - sign_in @user - end - - def test_show_balance - visit registrar_invoices_path - assert_text "Your current account balance is 100,00 EUR" - end - - def test_shows_invoice_title - visit registrar_invoices_path - assert_text 'Invoice', minimum: 2 - end - - def test_shows_invoice_owned_by_current_user - owning_registrar = registrars(:bestnames) - assert_equal owning_registrar, @user.registrar - @invoice.update!(buyer: owning_registrar) - - visit registrar_invoices_url - - assert_text @invoice.to_s - end - - def test_hides_invoice_owned_by_other_user - other_registrar = registrars(:goodnames) - assert_not_equal other_registrar, @user.registrar - @invoice.update!(buyer: other_registrar) - - visit registrar_invoices_url - - assert_no_text @invoice.to_s - end -end diff --git a/test/system/registrar_area/invoices/new_invoice_payment_test.rb b/test/system/registrar_area/invoices/new_invoice_payment_test.rb deleted file mode 100644 index 77050f12ad..0000000000 --- a/test/system/registrar_area/invoices/new_invoice_payment_test.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'application_system_test_case' - -class NewInvoicePaymentTest < ApplicationSystemTestCase - def setup - super - eis_response = OpenStruct.new(body: "{\"payment_link\":\"http://link.test\"}") - Spy.on_instance_method(EisBilling::AddDeposits, :send_invoice).and_return(eis_response) - - @original_vat_prc = Setting.registry_vat_prc - Setting.registry_vat_prc = 0.2 - @user = users(:api_bestnames) - sign_in @user - end - - def teardown - super - - Setting.registry_vat_prc = @original_vat_prc - end - - def create_invoice_and_visit_its_page - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '200.00' - fill_in 'Description', with: 'My first invoice' - click_link_or_button 'Add' - end -end diff --git a/test/system/registrar_area/invoices/new_test.rb b/test/system/registrar_area/invoices/new_test.rb deleted file mode 100644 index a1b66ac47d..0000000000 --- a/test/system/registrar_area/invoices/new_test.rb +++ /dev/null @@ -1,100 +0,0 @@ -require 'application_system_test_case' - -class NewInvoiceTest < ApplicationSystemTestCase - def setup - super - - @user = users(:api_bestnames) - sign_in @user - - eis_response = OpenStruct.new(body: "{\"payment_link\":\"http://link.test\"}") - Spy.on_instance_method(EisBilling::AddDeposits, :send_invoice).and_return(eis_response) - end - - def test_show_balance - visit registrar_invoices_path - assert_text "Your current account balance is 100,00 EUR" - end - - def test_create_new_invoice_with_positive_amount - if Feature.billing_system_integrated? - invoice_n = Invoice.order(number: :desc).last.number - stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {}) - - stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {}) - - stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice"). - to_return(status: 200, body: "", headers: {}) - - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '200.00' - fill_in 'Description', with: 'My first invoice' - - assert_difference 'Invoice.count', 1 do - click_link_or_button 'Add' - end - - assert_text 'Please pay the following invoice' - assert_text "Invoice no. #{invoice_n + 3}" - assert_text 'Subtotal 200,00 €' - assert_text 'Pay invoice' - end - end - - def test_create_new_invoice_with_comma_in_number - if Feature.billing_system_integrated? - invoice_n = Invoice.order(number: :desc).last.number - stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {}) - - stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {}) - - stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice"). - to_return(status: 200, body: "", headers: {}) - - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '200,00' - fill_in 'Description', with: 'My first invoice' - - assert_difference 'Invoice.count', 1 do - click_link_or_button 'Add' - end - - assert_text 'Please pay the following invoice' - assert_text "Invoice no. #{invoice_n + 3}" - assert_text 'Subtotal 200,00 €' - assert_text 'Pay invoice' - end - end - - def test_create_new_invoice_fails_when_amount_is_0 - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '0.00' - fill_in 'Description', with: 'My first invoice' - - assert_no_difference 'Invoice.count' do - click_link_or_button 'Add' - end - - assert_text 'Amount is too small. Minimum deposit is 0.01 EUR' - end - - def test_create_new_invoice_fails_when_amount_is_negative - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '-120.00' - fill_in 'Description', with: 'My first invoice' - - assert_no_difference 'Invoice.count' do - click_link_or_button 'Add' - end - - assert_text 'Amount is too small. Minimum deposit is 0.01 EUR' - end -end diff --git a/test/system/registrar_area/invoices_test.rb b/test/system/registrar_area/invoices_test.rb deleted file mode 100644 index 1c6d1d7806..0000000000 --- a/test/system/registrar_area/invoices_test.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaInvoicesTest < ApplicationSystemTestCase - include ActionMailer::TestHelper - - setup do - sign_in users(:api_bestnames) - @invoice = invoices(:one) - - ActionMailer::Base.deliveries.clear - eis_response = OpenStruct.new(body: "{\"payment_link\":\"http://link.test\"}") - Spy.on_instance_method(EisBilling::AddDeposits, :send_invoice).and_return(eis_response) - end - - def test_cancels_an_invoice - Spy.on(EisBilling::SendInvoiceStatus, :send_info).and_return(true) - - @invoice.account_activity = nil - assert @invoice.cancellable? - - visit registrar_invoice_url(@invoice) - click_on 'Cancel' - @invoice.reload - - assert @invoice.cancelled? - assert_text 'Invoice has been cancelled' - end - - def test_invoice_delivery_form_is_pre_populated_with_billing_email_of_a_registrar - assert_equal 'billing@bestnames.test', @invoice.buyer.billing_email - visit new_registrar_invoice_delivery_url(@invoice) - assert_field 'Recipient', with: 'billing@bestnames.test' - end - - def test_delivers_an_invoice - visit registrar_invoice_url(@invoice) - click_on 'Send' - fill_in 'Recipient', with: 'billing@registrar.test' - click_on 'Send' - - assert_emails 1 - email = ActionMailer::Base.deliveries.first - assert_equal ['billing@registrar.test'], email.to - assert_current_path registrar_invoice_path(@invoice) - assert_text 'Invoice has been sent' - end - - def test_if_invoice_unpaid_and_not_generated_link_comes_then_should_render_no_everypay_link - invoice = invoices(:unpaid) - visit registrar_invoice_url(invoice) - - assert_text 'No everypay link' - end - - def test_if_invoice_aldready_paid_there_should_not_any_everypay_link - visit registrar_invoice_url(@invoice) - - assert_no_text 'No everypay link' - assert_no_text 'Everypay link' - end -end diff --git a/test/system/registrar_area/protected_area_test.rb b/test/system/registrar_area/protected_area_test.rb deleted file mode 100644 index f1be6008de..0000000000 --- a/test/system/registrar_area/protected_area_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaProtectedAreaTest < ApplicationSystemTestCase - def test_anonymous_user_is_asked_to_authenticate_when_navigating_to_protected_area - visit registrar_domains_url - assert_text 'You need to sign in before continuing' - assert_current_path new_registrar_user_session_path - end - - def test_authenticated_user_can_access_protected_area - sign_in users(:api_bestnames) - visit registrar_domains_url - - assert_no_text 'You need to sign in before continuing' - assert_current_path registrar_domains_path - end - - def test_authenticated_user_is_not_asked_to_authenticate_again - sign_in users(:api_bestnames) - visit new_registrar_user_session_url - - assert_text 'You are already signed in' - assert_current_path registrar_root_path - end -end \ No newline at end of file diff --git a/test/system/registrar_area/settings/balance_auto_reload_test.rb b/test/system/registrar_area/settings/balance_auto_reload_test.rb deleted file mode 100644 index 066fb61867..0000000000 --- a/test/system/registrar_area/settings/balance_auto_reload_test.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaSettingsBalanceAutoReloadTest < ApplicationSystemTestCase - setup do - @registrar = registrars(:bestnames) - @user = users(:api_bestnames) - sign_in @user - end - - def test_enables_balance_auto_reload - amount = 100 - threshold = 10 - assert_nil @registrar.settings['balance_auto_reload'] - - visit registrar_account_path - click_on 'Enable' - fill_in 'Amount', with: amount - fill_in 'Threshold', with: threshold - click_button 'Save' - - assert_current_path registrar_account_path - assert_text 'Balance Auto-Reload setting has been updated' - - # Using `number_to_currency` leads to `expected to find text "Reload 100,00 € when your balance - # drops to 10,00 €" in "...Reload 100,00 € when your balance drops to 10,00 €...` - assert_text 'Reload 100,00 € when your balance drops to 10,00 €' - end - - def test_disables_balance_auto_reload - @registrar.update!(settings: { balance_auto_reload: { type: {} } }) - - visit registrar_account_path - click_on 'Disable' - - assert_current_path registrar_account_path - assert_text 'Balance Auto-Reload setting has been disabled' - end - - def test_edits_balance_auto_reload - @registrar.update!(settings: { balance_auto_reload: { type: { name: 'threshold', - amount: 100, - threshold: 10 } } }) - - visit registrar_account_path - within '.balance-auto-reload' do - click_on 'Edit' - end - fill_in 'Amount', with: '101' - fill_in 'Threshold', with: '11' - click_button 'Save' - - assert_current_path registrar_account_path - assert_text 'Balance Auto-Reload setting has been updated' - end - - def test_form_is_pre_populated_when_editing - amount = 100 - threshold = 10 - @registrar.update!(settings: { balance_auto_reload: { type: { name: 'threshold', - amount: amount, - threshold: threshold } } }) - - visit edit_registrar_settings_balance_auto_reload_path - - assert_field 'Amount', with: amount - assert_field 'Threshold', with: threshold - end - - def test_user_of_epp_role_cannot_edit_balance_auto_reload_setting - @user.update!(roles: [ApiUser::EPP]) - visit registrar_account_path - assert_no_text 'Balance Auto-Reload' - end -end \ No newline at end of file diff --git a/test/system/registrar_area/sign_in/password_test.rb b/test/system/registrar_area/sign_in/password_test.rb deleted file mode 100644 index a362e98e31..0000000000 --- a/test/system/registrar_area/sign_in/password_test.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaPasswordSignInTest < ApplicationSystemTestCase - setup do - @user = users(:api_bestnames) - end - - def test_correct_username_and_password - login_with_correct_credentials - assert_text 'Log out' - assert_current_path registrar_root_path - end - - def test_after_successful_sign_in_super_user_sees_service_message_list - @user.update!(roles: [ApiUser::SUPER]) - login_with_correct_credentials - assert_current_path registrar_root_path - end - - def test_after_successful_sign_in_billing_user_sees_account - @user.update!(roles: [ApiUser::BILLING]) - login_with_correct_credentials - assert_current_path registrar_account_path - end - - def test_wrong_password - visit new_registrar_user_session_url - fill_in 'registrar_user_username', with: @user.username - fill_in 'registrar_user_password', with: 'wrong' - click_button 'Login' - - assert_text 'No such user' - assert_current_path new_registrar_user_session_path - end - - def test_inactive_user - @user.update!(active: false) - login_with_correct_credentials - - assert_text 'User is not active' - assert_current_path new_registrar_user_session_path - end - - private - - def login_with_correct_credentials - visit new_registrar_user_session_url - fill_in 'registrar_user_username', with: @user.username - fill_in 'registrar_user_password', with: 'testtest' - click_button 'Login' - end -end \ No newline at end of file diff --git a/test/system/registrar_area/sign_out_test.rb b/test/system/registrar_area/sign_out_test.rb deleted file mode 100644 index 0408366003..0000000000 --- a/test/system/registrar_area/sign_out_test.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaSignOutTest < ApplicationSystemTestCase - setup do - sign_in users(:api_bestnames) - end - - def test_logout - visit registrar_root_url - click_on 'Log out' - - assert_text 'Signed out successfully' - assert_current_path new_registrar_user_session_path - end -end \ No newline at end of file diff --git a/test/system/registrar_area/tara/tara_users_test.rb b/test/system/registrar_area/tara/tara_users_test.rb deleted file mode 100644 index 0055040432..0000000000 --- a/test/system/registrar_area/tara/tara_users_test.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'application_system_test_case' - -class TaraUsersTest < ApplicationSystemTestCase - def setup - super - - OmniAuth.config.test_mode = true - @user = users(:api_bestnames) - - @existing_user_hash = { - 'provider' => 'tara', - 'uid' => "EE" + @user.identity_code - } - - @new_user_hash = { - 'provider' => 'tara', - 'uid' => 'EE51007050604' - } - end - - def teardown - super - - OmniAuth.config.test_mode = false - OmniAuth.config.mock_auth['tara'] = nil - end - - def test_existing_user_gets_signed_in - OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@existing_user_hash) - - visit new_registrar_user_session_path - click_link('Sign in') - - assert_text('Signed in successfully') - end - - def test_existing_user_logs_in_without_cookie_overflow - @existing_user_hash['credentials'] = massive_hash - OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@existing_user_hash) - - visit new_registrar_user_session_path - assert_nothing_raised do - click_link('Sign in') - end - - assert_text('Signed in successfully') - end - - def test_nonexisting_user_gets_error_message - OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@new_user_hash) - - visit new_registrar_user_session_path - click_link('Sign in') - - assert_text('No such user') - end - - def massive_hash - o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten - string = (0...5000).map { o[rand(o.length)] }.join - {"access_token":"AT-540-Fj5gbPvJp4jPkO-4EdgzIhIhhJapoRTM","token_type":"bearer","expires_in":600,"id_token":string} - end -end diff --git a/test/system/registrar_area/xml_consoles_test.rb b/test/system/registrar_area/xml_consoles_test.rb deleted file mode 100644 index 51cc362eb8..0000000000 --- a/test/system/registrar_area/xml_consoles_test.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaXmlConsolesTest < ApplicationSystemTestCase - setup do - sign_in users(:api_bestnames) - end - - def test_epp_server_does_not_response - visit registrar_xml_console_path - fill_in 'payload', with: schema_example - click_on 'Send EPP Request' - - el = page.find('.CodeRay', visible: :all) - assert el.text.include? 'CONNECTION ERROR - Is the EPP server running?' - end - - private - - def schema_example - <<~XML - - - - - - auction.test - - - - - XML - end -end From 56f41b00bf23bd2c463f0eb2534dbde593389a96 Mon Sep 17 00:00:00 2001 From: Thiago Youssef Date: Sun, 4 Sep 2022 17:51:47 -0300 Subject: [PATCH 3/7] Remove registrar routes --- app/views/admin/invoices/show.haml | 158 ++++++++++++++++++++++++++++- config/routes.rb | 91 ----------------- 2 files changed, 153 insertions(+), 96 deletions(-) diff --git a/app/views/admin/invoices/show.haml b/app/views/admin/invoices/show.haml index b121c8337a..c9500180dc 100644 --- a/app/views/admin/invoices/show.haml +++ b/app/views/admin/invoices/show.haml @@ -19,11 +19,159 @@ = render 'shared/full_errors', object: @invoice .row - .col-md-6= render 'registrar/invoices/partials/details' + .col-md-6 + %h4= t(:details) + %hr + %dl.dl-horizontal + %dt= t(:issue_date) + %dd= l @invoice.issue_date + + - if @invoice.cancelled? + %dt= Invoice.human_attribute_name :cancelled_at + %dd= l @invoice.cancelled_at + + %dt= t(:due_date) + - if @invoice.cancelled? + %dd.text-grey= t(:cancelled) + - else + %dd= l @invoice.due_date + + %dt= Invoice.human_attribute_name :receipt_date + - if @invoice.paid? + %dd= l @invoice.receipt_date + - elsif @invoice.cancelled? + %dd.text-grey= t(:cancelled) + - else + %dd{class: 'text-danger'}= t(:unpaid) + + %dt= t(:payment_term) + %dd Prepayment + + %dt= t(:invoice_number) + %dd= @invoice.number + + - if @invoice.description.present? + %dt= t(:description) + %dd=@invoice.description + + %dt= Invoice.human_attribute_name :reference_no + %dd= @invoice.reference_no .row - .col-md-6= render 'registrar/invoices/partials/seller' - .col-md-6= render 'registrar/invoices/partials/buyer' + .col-md-6 + %h4= t(:seller) + %hr + %dl.dl-horizontal + %dt= t(:name) + %dd= @invoice.seller_name + + %dt= Registrar.human_attribute_name :reg_no + %dd= @invoice.seller_reg_no + + %dt= t(:iban) + %dd= @invoice.seller_iban + + %dt= t(:bank) + %dd= @invoice.seller_bank + + %dt= t(:swift) + %dd= @invoice.seller_swift + + %dt= Registrar.human_attribute_name :vat_no + %dd= @invoice.seller_vat_no + + %dt= t(:address) + %dd= @invoice.seller_address + + %dt= t(:country) + %dd= @invoice.seller_country + + %dt= t(:phone) + %dd= @invoice.seller_phone + + %dt= t(:url) + %dd= @invoice.seller_url + + %dt= t(:email) + %dd= @invoice.seller_email + + %dt= t(:issuer) + %dd= @invoice.seller_contact_name + .col-md-6 + %h4= t(:buyer) + %hr + %dl.dl-horizontal + %dt= t(:name) + %dd= @invoice.buyer_name + + %dt= t(:reg_no) + %dd= @invoice.buyer_reg_no + + %dt= t(:address) + %dd= @invoice.buyer_address + + %dt= t(:country) + %dd= @invoice.buyer_country + + %dt= t(:phone) + %dd= @invoice.buyer_phone + + %dt= t(:url) + %dd= @invoice.buyer_url + + %dt= t(:email) + %dd= @invoice.buyer_email .row - .col-md-12= render 'registrar/invoices/partials/items' + .col-md-12 + %h4= t(:items) + %hr + .table-responsive + %table.table.table-hover.table-condensed + %thead + %tr + %th{class: 'col-xs-4'}= t(:description) + %th{class: 'col-xs-2'}= t(:unit) + %th{class: 'col-xs-2'}= InvoiceItem.human_attribute_name :quantity + %th{class: 'col-xs-2'}= t(:price) + %th{class: 'col-xs-2'}= t(:total) + %tbody + - @invoice.each do |invoice_item| + %tr + %td= invoice_item.description + %td= invoice_item.unit + %td= invoice_item.quantity + %td= currency(invoice_item.price) + %td= currency(invoice_item.item_sum_without_vat) + %tfoot + %tr + %th{colspan: 3} + %th= Invoice.human_attribute_name :subtotal + %td= number_to_currency @invoice.subtotal + %tr + %th.no-border{colspan: 3} + %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}" + %td= number_to_currency @invoice.vat_amount + %tr + %th.no-border{colspan: 3} + %th= t(:total) + %td= number_to_currency @invoice.total .row - .col-md-12= render 'registrar/invoices/partials/payment_orders' + .col-md-12 + %h4= "Payment Orders" + %hr + .table-responsive + %table.table.table-hover.table-condensed + %thead + %tr + %th{class: 'col-xs-1'}= "#" + %th{class: 'col-xs-1'}= "Channel" + %th{class: 'col-xs-2'}= "Status" + %th{class: 'col-xs-3'}= "Initiated" + %th{class: 'col-xs-4'}= "Notes" + %tbody + - @invoice.payment_orders.each do |payment_order| + %tr + %td= payment_order.id + %td= payment_order.channel + %td= payment_order.status + %td= payment_order.created_at + %td= payment_order.notes diff --git a/config/routes.rb b/config/routes.rb index 180a4687dd..b4da3eb1e8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -186,97 +186,6 @@ as: 'cors_preflight_check' end - # REGISTRAR ROUTES - namespace :registrar do - root 'polls#show' - - devise_for :users, path: '', class_name: 'ApiUser', skip: %i[sessions] - - resources :invoices, except: %i[new create edit update destroy] do - resource :delivery, controller: 'invoices/delivery', only: %i[new create] - - member do - get 'download' - patch 'cancel' - end - end - - resources :deposits - resources :account_activities - - put 'current_user/switch/:new_user_id', to: 'current_user#switch', as: :switch_current_user - resource :account, controller: :account, only: %i[show edit update] - - resources :domains do - collection do - post 'update', as: 'update' - post 'destroy', as: 'destroy' - get 'renew' - get 'edit' - get 'info' - get 'check' - get 'delete' - get 'search_contacts' - get 'remove_hold' - end - end - resources :domain_transfers, only: %i[new create] - resource :bulk_change, controller: :bulk_change, only: :new - post '/bulk_renew/new', to: 'bulk_change#bulk_renew', as: :bulk_renew - resource :tech_contacts, only: :update - resource :admin_contacts, only: :update - resource :nameservers, only: :update - resources :contacts, constraints: {:id => /[^\/]+(?=#{ ActionController::Renderers::RENDERERS.map{|e| "\\.#{e}\\z"}.join("|") })|[^\/]+/} do - member do - get 'delete' - end - - collection do - get 'check' - end - end - - resource :poll, only: %i[show destroy] do - collection do - post 'confirm_transfer' - end - end - - resource :xml_console do - collection do - get 'load_xml' - end - end - - get 'pay/return/:payment_order' => 'payments#back', as: 'return_payment_with' - post 'pay/return/:payment_order' => 'payments#back' - put 'pay/return/:payment_order' => 'payments#back' - post 'pay/callback/:payment_order' => 'payments#callback', as: 'response_payment_with' - get 'pay/go/:bank' => 'payments#pay', as: 'payment_with' - - namespace :settings do - resource :balance_auto_reload, controller: :balance_auto_reload, only: %i[edit update destroy] - end - end - - scope :registrar do - devise_scope :registrar_user do - get 'sign_in', to: 'registrar/sessions#new', as: :new_registrar_user_session - - # /registrar/sessions path is hardcoded in Apache config for certificate-based authentication - # See https://github.com/internetee/registry/blob/master/README.md#installation - # Client certificate is asked only on login form submission, therefore the path must be - # different from the one in `new_registrar_user_session` route - post 'sessions', to: 'registrar/sessions#create', as: :registrar_user_session - - delete 'sign_out', to: 'registrar/sessions#destroy', as: :destroy_registrar_user_session - - # TARA - match '/open_id/callback', via: %i[get post], to: 'sso/tara#registrar_callback' - match '/open_id/cancel', via: %i[get post delete], to: 'sso/tara#cancel' - end - end - namespace :registrant do devise_for :users, path: '', class_name: 'RegistrantUser' end From c8d758c25aff6bab84fa73a37178f83c373a9502 Mon Sep 17 00:00:00 2001 From: Thiago Youssef Date: Sun, 4 Sep 2022 17:57:32 -0300 Subject: [PATCH 4/7] Fix merge --- app/views/admin/invoices/show.haml | 74 +++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/app/views/admin/invoices/show.haml b/app/views/admin/invoices/show.haml index 5b5640608e..80da77bc81 100644 --- a/app/views/admin/invoices/show.haml +++ b/app/views/admin/invoices/show.haml @@ -123,9 +123,79 @@ %dd= @invoice.buyer_email .row - if @invoice.monthly_invoice - .col-md-12= render 'registrar/invoices/partials/monthly_invoice_items' + .col-md-12 + %h4= t(:items) + %hr + .table-responsive + %table.table.table-hover.table-condensed + %thead + %tr + %th{class: 'col-xs-1'}= t(:code) + %th{class: 'col-xs-1'}= InvoiceItem.human_attribute_name :quantity + %th{class: 'col-xs-1'}= t(:unit) + %th{class: 'col-xs-5'}= t(:description) + %th{class: 'col-xs-2'}= t(:price) + %th{class: 'col-xs-2'}= t(:total) + %tbody + - @invoice.each do |invoice_item| + %tr + %td= invoice_item.product_id + %td= invoice_item.quantity + %td= invoice_item.unit + %td= invoice_item.description + - if invoice_item.price && invoice_item.quantity + %td= currency(invoice_item.price) + %td= "#{currency((invoice_item.price * invoice_item.quantity).round(3))} #{@invoice.currency}" + - else + %td= '' + %td= '' + %tfoot + %tr + %th{colspan: 4} + %th= Invoice.human_attribute_name :subtotal + %td= number_to_currency(0) + %tr + %th.no-border{colspan: 4} + %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}" + %td= number_to_currency(0) + %tr + %th.no-border{colspan: 4} + %th= t(:total) + %td= number_to_currency(0) - else - .col-md-12= render 'registrar/invoices/partials/items' + .col-md-12 + %h4= t(:items) + %hr + .table-responsive + %table.table.table-hover.table-condensed + %thead + %tr + %th{class: 'col-xs-4'}= t(:description) + %th{class: 'col-xs-2'}= t(:unit) + %th{class: 'col-xs-2'}= InvoiceItem.human_attribute_name :quantity + %th{class: 'col-xs-2'}= t(:price) + %th{class: 'col-xs-2'}= t(:total) + %tbody + - @invoice.each do |invoice_item| + %tr + %td= invoice_item.description + %td= invoice_item.unit + %td= invoice_item.quantity + %td= currency(invoice_item.price) + %td= currency(invoice_item.item_sum_without_vat) + %tfoot + %tr + %th{colspan: 3} + %th= Invoice.human_attribute_name :subtotal + %td= number_to_currency @invoice.subtotal + %tr + %th.no-border{colspan: 3} + %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}" + %td= number_to_currency @invoice.vat_amount + %tr + %th.no-border{colspan: 3} + %th= t(:total) + %td= number_to_currency @invoice.total .row .col-md-12 %h4= "Payment Orders" From 3a269bb6b3d49ae971577b1c71cacef0a6907905 Mon Sep 17 00:00:00 2001 From: Thiago Youssef Date: Sun, 4 Sep 2022 20:36:36 -0300 Subject: [PATCH 5/7] Fix tests --- config/routes.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index b4da3eb1e8..df3ad058ff 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -186,6 +186,11 @@ as: 'cors_preflight_check' end + # REGISTRAR ROUTES + namespace :registrar do + devise_for :users, path: '', class_name: 'ApiUser', skip: %i[sessions] + end + namespace :registrant do devise_for :users, path: '', class_name: 'RegistrantUser' end From 04b55068dfe5e218976c1876ff8c4f5767ae23cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergei=20Ts=C3=B5ganov?= Date: Thu, 13 Oct 2022 14:06:33 +0300 Subject: [PATCH 6/7] Removed and updated additional files --- .../registrar/domains_controller.rb | 227 ----------- .../repp/v1/domains/renews_controller.rb | 2 +- app/helpers/registrar/application_helper.rb | 6 - app/models/ability.rb | 3 - app/models/depp/concerns/.keep | 0 app/models/depp/contact.rb | 318 ---------------- app/models/depp/dnskey.rb | 26 -- app/models/depp/domain.rb | 351 ------------------ app/models/depp/user.rb | 66 ---- app/models/dnskey.rb | 8 +- app/models/domain.rb | 16 + .../registrar/domain_list_csv_presenter.rb | 45 --- app/views/admin/invoices/index.haml | 2 +- app/views/admin/invoices/partials/_buyer.haml | 23 ++ .../invoices/partials/_details.haml | 2 +- app/views/admin/invoices/partials/_items.haml | 32 ++ .../partials/_monthly_invoice_items.haml | 0 .../invoices/partials/_payment_orders.haml | 19 + .../{ => partials}/_search_form.html.erb | 6 +- .../admin/invoices/partials/_seller.haml | 38 ++ app/views/admin/invoices/show.haml | 200 +--------- app/views/layouts/registrar/base.html.erb | 64 ---- app/views/registrar/invoices/show.haml | 23 -- config/application.yml.sample | 10 - config/locales/en.yml | 23 -- .../repp/v1/domains/dnssec_test.rb | 24 +- test/models/depp_contact_test.rb | 14 - .../billing/balance_top_up_test.rb | 44 --- .../registrar_area/invoices/new_test.rb | 96 ----- 29 files changed, 154 insertions(+), 1534 deletions(-) delete mode 100644 app/controllers/registrar/domains_controller.rb delete mode 100644 app/helpers/registrar/application_helper.rb delete mode 100644 app/models/depp/concerns/.keep delete mode 100644 app/models/depp/contact.rb delete mode 100644 app/models/depp/dnskey.rb delete mode 100644 app/models/depp/domain.rb delete mode 100644 app/models/depp/user.rb delete mode 100644 app/presenters/registrar/domain_list_csv_presenter.rb create mode 100644 app/views/admin/invoices/partials/_buyer.haml rename app/views/{registrar => admin}/invoices/partials/_details.haml (96%) create mode 100644 app/views/admin/invoices/partials/_items.haml rename app/views/{registrar => admin}/invoices/partials/_monthly_invoice_items.haml (100%) create mode 100644 app/views/admin/invoices/partials/_payment_orders.haml rename app/views/admin/invoices/{ => partials}/_search_form.html.erb (91%) create mode 100644 app/views/admin/invoices/partials/_seller.haml delete mode 100644 app/views/layouts/registrar/base.html.erb delete mode 100644 app/views/registrar/invoices/show.haml delete mode 100644 test/models/depp_contact_test.rb delete mode 100644 test/system/registrar_area/billing/balance_top_up_test.rb delete mode 100644 test/system/registrar_area/invoices/new_test.rb diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb deleted file mode 100644 index 5168d25b8c..0000000000 --- a/app/controllers/registrar/domains_controller.rb +++ /dev/null @@ -1,227 +0,0 @@ -class Registrar - class DomainsController < DeppController - before_action :init_domain, except: :new - helper_method :contacts - helper_method :search_params - - def index - authorize! :view, Depp::Domain - - if search_params.to_h.delete_if { |_key, value| value.blank? }.length == 1 && - search_params[:name_matches].present? - domain = Domain.find_by(name: search_params[:name_matches]) - - redirect_to info_registrar_domains_url(domain_name: domain.name) and return if domain - end - - domains = if params[:statuses_contains] - current_domain_scope.where('domains.statuses @> ?::varchar[]', - "{#{params[:statuses_contains].join(',')}}") - else - current_domain_scope - end - - domains = domains.where(contacts: { ident: params[:contacts_ident_eq] }) if params[:contacts_ident_eq] - - normalize_search_parameters do - @q = domains.ransack(search_params.except(:contacts_ident_eq)) - @domains = @q.result.page(params[:page]) - - # if we do not get any results, add wildcards to the name field and search again - if @domains.count == 0 && search_params[:name_matches] !~ /^%.+%$/ - new_search_params = search_params.to_h.except(:contacts_ident_eq) - new_search_params[:name_matches] = "%#{new_search_params[:name_matches]}%" - @q = domains.ransack(new_search_params) - @domains = @q.result.page(params[:page]) - end - end - - respond_to do |format| - format.html - format.csv do - domain_presenters = [] - - @q.result.find_each do |domain| - domain_presenters << ::DomainPresenter.new(domain: domain, view: view_context) - end - - raw_csv = Registrar::DomainListCsvPresenter.new(domains: domain_presenters, - view: view_context).to_s - filename = "Domains_#{l(Time.zone.now, format: :filename)}.csv" - send_data raw_csv, filename: filename, type: "#{Mime[:csv]}; charset=utf-8" - end - end - end - - def current_domain_scope - current_registrar_user.registrar.domains.includes(:registrar, :registrant) - end - - def info - authorize! :info, Depp::Domain - @data = @domain.info(params[:domain_name]) if params[:domain_name] - @pending_delete = domain_delete_pending(@data) - @client_holded = client_holded(@data) - if response_ok? - render 'info' - else - flash[:alert] = @data.css('msg').text - redirect_to registrar_domains_url and return - end - end - - def check - authorize! :check, Depp::Domain - if params[:domain_name] - @data = @domain.check(params[:domain_name]) - render 'check_index' and return unless response_ok? - else - render 'check_index' - end - end - - def new - authorize! :create, Depp::Domain - @domain_params = Depp::Domain.default_params - @domain_params[:period] = Depp::Domain.default_period - end - - # rubocop:disable Metrics/CognitiveComplexity - def create - authorize! :create, Depp::Domain - @domain_params = domain_params.to_h - @data = @domain.create(@domain_params) - - if @data && response_ok? - redirect_to info_registrar_domains_url(domain_name: @domain_params[:name]) - else - flash[:alert] = t('.email_error_message') unless @emails_check_result - render 'new' - end - end - - def edit - authorize! :update, Depp::Domain - @data = @domain.info(params[:domain_name]) - @domain_params = Depp::Domain.construct_params_from_server_data(@data) - @dispute = Dispute.active.find_by(domain_name: params[:domain_name]) - end - - def update - authorize! :update, Depp::Domain - @domain_params = params[:domain] - @data = @domain.update(@domain_params) - @dispute = Dispute.active.find_by(domain_name: @domain_params[:name]) - - if @data && response_ok? - redirect_to info_registrar_domains_url(domain_name: @domain_params[:name]) - else - flash[:alert] = t('.email_error_message') unless @emails_check_result - params[:domain_name] = @domain_params[:name] - render 'new' - end - end - # rubocop:enable Metrics/CognitiveComplexity - - def delete - authorize! :delete, Depp::Domain - end - - def destroy - authorize! :delete, Depp::Domain - @data = @domain.delete(params[:domain]) - @results = @data.css('result') - if response_ok? - flash[:notice] = t('.deleting_request') - redirect_to info_registrar_domains_url(domain_name: params[:domain][:name]) - else - params[:domain_name] = params[:domain][:name] - render 'delete' - end - end - - def renew - authorize! :renew, Depp::Domain - if params[:domain_name] && params[:cur_exp_date] - @data = @domain.renew(params) - render 'renew_index' and return unless response_ok? - else - params[:period] = Depp::Domain.default_period - render 'renew_index' - end - end - - def search_contacts - authorize! :create, Depp::Domain - - scope = current_registrar_user.registrar.contacts.limit(10) - if params[:query].present? - escaped_str = ActiveRecord::Base.connection.quote_string params[:query] - scope = scope.where("name ilike '%#{escaped_str}%' OR code ilike '%#{escaped_str}%' ") - end - - render json: scope.pluck(:name, :code).map { |c| { display_key: "#{c.second} #{c.first}", value: c.second } } - end - - def remove_hold - authorize! :remove_hold, Depp::Domain - return unless params[:domain_name] - - @data = @domain.remove_hold(params) - - flash[:alert] = @data.css('msg').text unless response_ok? - redirect_to info_registrar_domains_url(domain_name: params[:domain_name]) - end - - private - - def init_domain - @domain = Depp::Domain.new(current_user: depp_current_user) - end - - def client_holded(data) - data.css('status')&.map { |element| element.attribute('s').value } - &.any? { |status| status == DomainStatus::CLIENT_HOLD } - end - - def domain_delete_pending(data) - data.css('status')&.map { |element| element.attribute('s').value } - &.any? { |status| status.include?(DomainStatus::PENDING_DELETE) } - end - - def contacts - current_registrar_user.registrar.contacts - end - - def normalize_search_parameters - ca_cache = search_params[:valid_to_lteq] - begin - end_time = search_params[:valid_to_lteq].try(:to_date) - search_params[:valid_to_lteq] = end_time.try(:end_of_day) - rescue - logger.warn('Invalid date') - end - - yield - - search_params[:valid_to_lteq] = ca_cache - end - - def search_params - params.fetch(:q, {}).permit(:name_matches, - :registrant_ident_eq, - :contacts_ident_eq, - :nameservers_hostname_eq, - :valid_to_gteq, - :valid_to_lteq, - :s) - end - - def domain_params - params.require(:domain).permit(:name, :period, :registrant, :registrant_helper, :reserved_pw, - :verified, :legal_document, contacts_attributes: {}, - nameservers_attributes: {}, - dnskeys_attributes: {}) - end - end -end diff --git a/app/controllers/repp/v1/domains/renews_controller.rb b/app/controllers/repp/v1/domains/renews_controller.rb index 9aba3e41b8..b47710c7e1 100644 --- a/app/controllers/repp/v1/domains/renews_controller.rb +++ b/app/controllers/repp/v1/domains/renews_controller.rb @@ -43,7 +43,7 @@ def renew_params def validate_renew_period @epp_errors ||= ActiveModel::Errors.new(self) - periods = Depp::Domain::PERIODS.map { |p| p[1] } + periods = Domain::PERIODS.map { |p| p[1] } return if periods.include? bulk_renew_params[:renew_period] @epp_errors.add(:epp_errors, msg: 'Invalid renew period', code: '2005') diff --git a/app/helpers/registrar/application_helper.rb b/app/helpers/registrar/application_helper.rb deleted file mode 100644 index 7710cf55c4..0000000000 --- a/app/helpers/registrar/application_helper.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Registrar::ApplicationHelper - def env_style - return '' if unstable_env.nil? - "background-image: url(#{image_path("registrar/bg-#{unstable_env}.png")});" - end -end diff --git a/app/models/ability.rb b/app/models/ability.rb index 31543a5861..491c2a1ac1 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -32,9 +32,7 @@ def super # Registrar/api_user dynamic role def epp # Registrar/api_user dynamic role if @user.registrar.api_ip_white?(@ip) - can :manage, Depp::Contact can :manage, :xml_console - can :manage, Depp::Domain end can :manage, Account @@ -122,7 +120,6 @@ def static_registrant customer_service can :manage, :registrant_domains can :manage, :registrant_whois - can :manage, Depp::Domain can :manage, Domain end diff --git a/app/models/depp/concerns/.keep b/app/models/depp/concerns/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/models/depp/contact.rb b/app/models/depp/contact.rb deleted file mode 100644 index 7007bcd00e..0000000000 --- a/app/models/depp/contact.rb +++ /dev/null @@ -1,318 +0,0 @@ -module Depp - class Contact - include ActiveModel::Model - - attr_accessor :id, :name, :email, :phone, :org_name, - :ident, :ident_type, :ident_country_code, - :street, :city, :zip, :state, :country_code, - :password, :legal_document, :statuses, :code, - :email_history - - DISABLED = 'Disabled' - DISCLOSURE_TYPES = [DISABLED, '1', '0'] - TYPES = %w( org priv birthday ) - SELECTION_TYPES = [ - ['Business code', 'org'], - ['Personal identification code', 'priv'], - ['Birthday', 'birthday'] - ] - - validates :phone, e164: true, phone: true - - class << self - attr_reader :epp_xml, :user - - def new_from_params(params) - new( - id: params[:code], - code: params[:code], - email: params[:email], - phone: params[:phone], - ident: params[:ident], - ident_type: params[:ident_type], - ident_country_code: params[:ident_country_code], - - # postalInfo - name: params[:name], - org_name: params[:org_name], - - # address - street: params[:street], - city: params[:city], - zip: params[:zip], - state: params[:state], - country_code: params[:country_code] - ) - end - - def find_by_id(id) - data = info_xml(id) - - res = data.css('epp response resData infData') - ext = data.css('epp response extension') - new( - id: res.css('id').text, - code: res.css('id').text, - email: res.css('email').text, - phone: res.css('voice').text, - ident: ext.css('ident').text, - ident_type: ext.css('ident').first.try(:attributes).try(:[], 'type').try(:value), - ident_country_code: ext.css('ident').first.try(:attributes).try(:[], 'cc').try(:value), - - # postalInfo - name: res.css('postalInfo name').text, - org_name: res.css('postalInfo org').text, - - # address - street: res.css('postalInfo addr street').text, - city: res.css('postalInfo addr city').text, - zip: res.css('postalInfo addr pc').text, - state: res.css('postalInfo addr sp').text, - country_code: res.css('postalInfo addr cc').text, - - # authInfo - password: res.css('authInfo pw').text, - - # statuses - statuses: data.css('status').map { |s| [s['s'], s.text] } - ) - end - - def user=(user) - @user = user - @epp_xml = EppXml::Contact.new(cl_trid_prefix: user.tag, schema_prefix: 'contact-ee', - schema_version: '1.1') - end - - def info_xml(id, password = nil) - xml = epp_xml.info( - id: { value: id }, - authInfo: { pw: { value: password } } - ) - user.request(xml) - end - - def construct_check_hash_from_data(data) - res = data.css('epp response resData chkData cd') - @contacts = [] - res.each do |_r| - id = res.css('id').try(:text) - reason = res.css('reason').present? ? res.css('reason').text : I18n.t(:available) - @contacts << { id: id, reason: reason } - end - @contacts - end - - def contact_id_from_xml(data) - id = data.css('epp response resData creData id').text - id.blank? ? nil : id - end - - def construct_create_disclosure_xml(cph, flag) - xml = { disclose: {} } - cph.each do |k, v| - xml[:disclose][k] = {} - xml[:disclose][k][:value] = v - end - xml[:disclose][:attrs] = {} - xml[:disclose][:attrs][:flag] = flag - xml.with_indifferent_access - end - - # cpd = contact_params[:disclose] - def extract_disclosure_hash(cpd) - return {} unless cpd - - cpd.delete_if { |k, v| v if v != '1' && k == 'flag' } - end - - def extract_info_disclosure(data) - hash = {} - data.css('disclose').each do |d| - flag = d.attributes['flag'].value - next unless flag - hash[flag] = {} - d.children.each do |c| - hash[flag][c.name] = flag if %w( name email fax voice addr org_name ).include?(c.name) - end - end - hash - end - - def type_string(type_code) - return '' if type_code.blank? - t = SELECTION_TYPES.select { |tp| tp.second == type_code } - t.try(:first).try(:first) - end - end - - def save - return false unless valid? - - hash = { - id: { value: code }, - postalInfo: { - name: { value: name }, - org: { value: org_name }, - }, - voice: { value: phone }, - email: { value: email } - } - - if ::Contact.address_processing? - hash[:postalInfo][:addr] = { - street: { value: street }, - city: { value: city }, - sp: { value: state }, - pc: { value: zip }, - cc: { value: country_code }, - } - end - - hash[:id] = nil if code.blank? - create_xml = Depp::Contact.epp_xml.create(hash, extension_xml(:create)) - data = Depp::Contact.user.request(create_xml) - self.id = data.css('id').text - handle_errors(data) - end - - # rubocop:disable Metrics/MethodLength - def update_attributes(params) - return false unless valid? - - self.ident_country_code = params[:ident_country_code] - self.ident_type = params[:ident_type] - self.ident = params[:ident] - - self.name = params[:name] - self.email = params[:email] - self.phone = params[:phone] - - self.org_name = params[:org_name] - - if ::Contact.address_processing? - self.street = params[:street] - self.city = params[:city] - self.zip = params[:zip] - self.state = params[:state] - self.country_code = params[:country_code] - end - - attributes = { - id: { value: id }, - chg: { - postalInfo: { - name: { value: name }, - org: { value: org_name }, - }, - voice: { value: phone }, - email: { value: email }, - authInfo: { - pw: { value: password } - } - } - } - - if ::Contact.address_processing? - attributes[:chg][:postalInfo][:addr] = { - street: { value: street }, - city: { value: city }, - sp: { value: state }, - pc: { value: zip }, - cc: { value: country_code } - } - end - - update_xml = Depp::Contact.epp_xml.update(attributes, extension_xml(:update)) - data = Depp::Contact.user.request(update_xml) - handle_errors(data) - end - # rubocop:enable Metrics/MethodLength - - def delete - delete_xml = Contact.epp_xml.delete( - { - id: { value: id }, - authInfo: { pw: { value: password } } - }, - extension_xml(:delete) - ) - data = Depp::Contact.user.request(delete_xml) - handle_errors(data) - end - - def extension_xml(action) - xml = { _anonymus: [] } - - case action - when :create - ident = ident_xml[:_anonymus].try(:first) - when :update - # detect if any ident has changed, nb! ident and self.ident is not always same - unless ident == self.ident && ident == ident_type && ident_country_code == self.ident_country_code - ident = ident_xml[:_anonymus].try(:first) - end - end - - legal = legal_document_xml[:_anonymus].try(:first) - xml[:_anonymus] << ident if ident.present? - xml[:_anonymus] << legal if legal.present? - xml - end - - def ident_xml - { - _anonymus: [ - ident: { value: ident, attrs: { type: ident_type, cc: ident_country_code } } - ] - } - end - - def legal_document_xml - return {} if legal_document.blank? - - type = legal_document.original_filename.split('.').last.downcase - { - _anonymus: [ - legalDocument: { value: Base64.encode64(legal_document.read), attrs: { type: type } } - ] - } - end - - def check(id) - xml = epp_xml.check(id: { value: id }) - current_user.request(xml) - end - - def country_name - Country.new(country_code) || 'No access' - end - - def org? - ident_type == 'org' - end - - def priv? - ident_type == 'priv' - end - - def persisted? - id.present? - end - - def handle_errors(data) - data.css('result').each do |x| - success_codes = %(1000, 1300, 1301) - next if success_codes.include?(x['code']) - - message = "#{x.css('msg').text} #{x.css('value').text}" - attr = message.split('[').last.strip.sub(']', '') if message.include?('[') - attr = :base if attr.nil? - attr = 'phone' if attr == 'voice' - attr = 'zip' if attr == 'pc' - errors.add(attr, message) - end - errors.blank? - end - end -end diff --git a/app/models/depp/dnskey.rb b/app/models/depp/dnskey.rb deleted file mode 100644 index f4e99eb6d5..0000000000 --- a/app/models/depp/dnskey.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Depp - class Dnskey - FLAGS = [ - ['0 - not for DNSSEC validation', 0], - ['256 - ZSK', 256], - ['257 - KSK', 257] - ] - - ALGORITHMS = [ - ['3 - DSA/SHA-1', 3], - ['5 - RSA/SHA-1', 5], - ['6 - DSA-NSEC3-SHA1', 6], - ['7 - RSASHA1-NSEC3-SHA1', 7], - ['8 - RSA/SHA-256', 8], - ['10 - RSA/SHA-512', 10], - ['13 - ECDSA Curve P-256 with SHA-256', 13], - ['14 - ECDSA Curve P-384 with SHA-384', 14], - ['15 - Ed25519', 15], - ['16 - Ed448', 16], - ].freeze - - PROTOCOLS = [3] - - DS_DIGEST_TYPES = [1, 2] - end -end diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb deleted file mode 100644 index 0df6ae2b1a..0000000000 --- a/app/models/depp/domain.rb +++ /dev/null @@ -1,351 +0,0 @@ -module Depp - class Domain - include ActiveModel::Conversion - include RemoveHold - extend ActiveModel::Naming - - attr_accessor :name, :current_user, :epp_xml - - STATUSES = %w[ - clientDeleteProhibited - clientHold - clientRenewProhibited - clientTransferProhibited - clientUpdateProhibited - ].freeze - - PERIODS = [ - ['3 months', '3m'], - ['6 months', '6m'], - ['9 months', '9m'], - ['1 year', '1y'], - ['2 years', '2y'], - ['3 years', '3y'], - ['4 years', '4y'], - ['5 years', '5y'], - ['6 years', '6y'], - ['7 years', '7y'], - ['8 years', '8y'], - ['9 years', '9y'], - ['10 years', '10y'], - ].freeze - - def initialize(args = {}) - self.current_user = args[:current_user] - self.epp_xml = EppXml::Domain.new( - cl_trid_prefix: current_user.tag, - schema_prefix: 'domain-ee', - schema_version: '1.1' - ) - end - - def info(domain_name) - xml = epp_xml.info(name: { value: domain_name }) - current_user.request(xml) - end - - def check(domain_name) - xml = epp_xml.check( - _anonymus: [ - name: { value: domain_name } - ] - ) - current_user.request(xml) - end - - def create(domain_params) - dns_hash = {} - keys = Domain.create_dnskeys_hash(domain_params) - dns_hash[:_anonymus] = keys if keys.any? - - period = domain_params[:period].to_i.to_s - period_unit = domain_params[:period][-1].to_s - - xml = if domain_params[:nameservers_attributes] - .select { |_key, value| value['hostname'].present? }.any? - epp_xml.create({ - name: { value: domain_params[:name] }, - period: { value: period, attrs: { unit: period_unit } }, - ns: Domain.create_nameservers_hash(domain_params), - registrant: { value: domain_params[:registrant] }, - _anonymus: Domain.create_contacts_hash(domain_params) - }, dns_hash, Domain.construct_custom_params_hash(domain_params)) - else - epp_xml.create({ - name: { value: domain_params[:name] }, - period: { value: period, attrs: { unit: period_unit } }, - registrant: { value: domain_params[:registrant] }, - _anonymus: Domain.create_contacts_hash(domain_params) - }, dns_hash, Domain.construct_custom_params_hash(domain_params)) - end - - current_user.request(xml) - end - - def update(domain_params) - data = current_user.request(epp_xml.info(name: { value: domain_params[:name] })) - old_domain_params = Depp::Domain.construct_params_from_server_data(data) - - xml = epp_xml.update( - Depp::Domain.construct_edit_hash(domain_params, old_domain_params), - Depp::Domain.construct_ext_edit_hash(domain_params, old_domain_params), - Depp::Domain.construct_custom_params_hash(domain_params) - ) - - current_user.request(xml) - end - - def delete(domain_params) - xml = epp_xml.delete({ - name: { value: domain_params[:name] }, - }, - Depp::Domain.construct_custom_params_hash(domain_params), - (domain_params[:verified].present? && 'yes')) - - current_user.request(xml) - end - - def renew(params) - period = params[:period].to_i.to_s - period_unit = params[:period][-1].to_s - - current_user.request(epp_xml.renew(name: { value: params[:domain_name] }, - curExpDate: { value: params[:cur_exp_date] }, - period: { value: period, attrs: { unit: period_unit } })) - end - - def transfer(params) - op = params[:request] ? 'request' : nil - op = params[:query] ? 'query' : op - op = params[:approve] ? 'approve' : op - op = params[:reject] ? 'reject' : op - - current_user.request(epp_xml.transfer({ - name: { value: params[:domain_name] }, - authInfo: { pw: { value: params[:transfer_code] } } - }, op, Domain.construct_custom_params_hash(params))) - end - - def confirm_transfer(domain_params) - data = current_user.request(epp_xml.info(name: { value: domain_params[:name] })) - pw = data.css('pw').text - - xml = epp_xml.transfer({ - name: { value: domain_params[:name] }, - authInfo: { pw: { value: pw } } - }, 'approve') - - current_user.request(xml) - end - - class << self - def default_period - '1y' - end - - def default_params - ret = {} - - ret[:contacts_attributes] ||= {} - ENV['default_admin_contacts_count'].to_i.times do |i| - ret[:contacts_attributes][i] = { code: '', type: 'admin' } - end - - ret[:nameservers_attributes] ||= {} - ENV['default_nameservers_count'].to_i.times do |i| - ret[:nameservers_attributes][i] = {} - end - - ret[:dnskeys_attributes] ||= { 0 => {} } - ret[:statuses_attributes] ||= { 0 => {} } - ret.with_indifferent_access - end - - def construct_params_from_server_data(data) - ret = default_params - ret[:name] = data.css('name').text - ret[:registrant] = data.css('registrant').text - - data.css('contact').each_with_index do |x, i| - ret[:contacts_attributes][i] = { code: x.text, type: x['type'] } - end - - data.css('hostAttr').each_with_index do |x, i| - ret[:nameservers_attributes][i] = { - hostname: x.css('hostName').text, - ipv4: Array(x.css('hostAddr[ip="v4"]')).map(&:text).join(','), - ipv6: Array(x.css('hostAddr[ip="v6"]')).map(&:text).join(',') - } - end - - data.css('keyData').each_with_index do |x, i| - ret[:dnskeys_attributes][i] = { - flags: x.css('flags').text, - protocol: x.css('protocol').text, - alg: x.css('alg').text, - public_key: x.css('pubKey').text, - ds_key_tag: x.css('keyTag').first.try(:text), - ds_alg: x.css('alg').first.try(:text), - ds_digest_type: x.css('digestType').first.try(:text), - ds_digest: x.css('digest').first.try(:text) - } - end - - data.css('status').each_with_index do |x, i| - next unless STATUSES.include?(x['s']) - - ret[:statuses_attributes][i] = { - code: x['s'], - description: x.text - } - end - - ret - end - - def construct_custom_params_hash(domain_params) - custom_params = { _anonymus: [] } - if domain_params[:legal_document].present? - type = domain_params[:legal_document].original_filename.split('.').last.downcase - custom_params[:_anonymus] << { - legalDocument: { value: Base64.encode64(domain_params[:legal_document].read), attrs: { type: type } } - } - end - - if domain_params[:reserved_pw].present? - custom_params[:_anonymus] << { reserved: { pw: { value: domain_params[:reserved_pw] } } } - end - - custom_params - end - - def construct_edit_hash(domain_params, old_domain_params) - contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params)) - add_anon = contacts - - contacts = array_difference(create_contacts_hash(old_domain_params), create_contacts_hash(domain_params)) - rem_anon = contacts - - add_arr = [] - add_ns = create_nameservers_hash(domain_params) - create_nameservers_hash(old_domain_params) - add_arr << { ns: add_ns } if add_ns.any? - add_arr << { _anonymus: add_anon } if add_anon.any? - - rem_arr = [] - rem_ns = create_nameservers_hash(old_domain_params) - create_nameservers_hash(domain_params) - rem_arr << { ns: rem_ns } if rem_ns.any? - rem_arr << { _anonymus: rem_anon } if rem_anon.any? - - if domain_params[:registrant] != old_domain_params[:registrant] - chg = [{ registrant: { value: domain_params[:registrant] } }] unless domain_params[:verified].present? - if domain_params[:verified] - chg = [{ registrant: { value: domain_params[:registrant], attrs: { verified: 'yes' } } }] - end - end - - add_arr = nil if add_arr.none? - rem_arr = nil if rem_arr.none? - - { - name: { value: domain_params[:name] }, - add: add_arr, - rem: rem_arr, - chg: chg - } - end - - def construct_ext_edit_hash(domain_params, old_domain_params) - rem_keys = create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params) - add_keys = create_dnskeys_hash(domain_params) - create_dnskeys_hash(old_domain_params) - hash = {} - hash[:rem] = rem_keys if rem_keys.any? - hash[:add] = add_keys if add_keys.any? - hash - end - - def create_nameservers_hash(domain_params) - ret = [] - domain_params[:nameservers_attributes].each do |_k, v| - next if v['hostname'].blank? - - host_attr = [] - host_attr << { hostName: { value: v['hostname'] } } - if v['ipv4'].present? - v['ipv4'].to_s.split(',').each do |ip| - host_attr << { hostAddr: { value: ip, attrs: { ip: 'v4' } } } - end - end - - if v['ipv6'].present? - v['ipv6'].to_s.split(',').each do |ip| - host_attr << { hostAddr: { value: ip, attrs: { ip: 'v6' } } } - end - end - - ret << { hostAttr: host_attr } - end - - ret - end - - def create_contacts_hash(domain_params) - ret = [] - domain_params[:contacts_attributes].each do |_k, v| - next if v['code'].blank? - - ret << { - contact: { value: v['code'], attrs: { type: v['type'] } } - } - end - - ret - end - - def create_dnskeys_hash(domain_params) - ret = [] - domain_params[:dnskeys_attributes].each do |_k, v| - if v['ds_key_tag'].blank? - kd = create_key_data_hash(v) - if kd - ret << { - keyData: kd - } - end - else - ret << { - dsData: [ - keyTag: { value: v['ds_key_tag'] }, - alg: { value: v['ds_alg'] }, - digestType: { value: v['ds_digest_type'] }, - digest: { value: v['ds_digest'] }, - keyData: create_key_data_hash(v) - ] - } - end - end - - ret - end - - def create_key_data_hash(key_data_params) - return nil if key_data_params['public_key'].blank? - - { - flags: { value: key_data_params['flags'] }, - protocol: { value: key_data_params['protocol'] }, - alg: { value: key_data_params['alg'] }, - pubKey: { value: key_data_params['public_key'] } - } - end - - def array_difference(x, y) - ret = x.dup - y.each do |element| - index = ret.index(element) - ret.delete_at(index) if index - end - ret - end - end - end -end diff --git a/app/models/depp/user.rb b/app/models/depp/user.rb deleted file mode 100644 index 36fc48fdc9..0000000000 --- a/app/models/depp/user.rb +++ /dev/null @@ -1,66 +0,0 @@ -module Depp - class User - include ActiveModel::Validations - include ActiveModel::Conversion - extend ActiveModel::Naming - - attr_accessor :tag, :password, :pki - - validates :tag, :password, presence: true - - validate :validate_existance_in_server - - def initialize(args = {}) - args.each { |k, v| send("#{k}=", v) } - end - - def server - client_cert = File.read(ENV['cert_path']) - client_key = File.read(ENV['key_path']) - port = ENV['epp_port'] || '700' - - @server_cache ||= Epp::Server.new({ - server: ENV['epp_hostname'], - tag: tag, - password: password, - port: port, - cert: OpenSSL::X509::Certificate.new(client_cert), - key: OpenSSL::PKey::RSA.new(client_key) - }) - end - - def request(xml) - Nokogiri::XML(server.request(xml)).remove_namespaces! - rescue EppErrorResponse => e - Nokogiri::XML(e.response_xml.to_s).remove_namespaces! - end - - private - - def validate_existance_in_server - return if errors.any? - res = server.open_connection - unless Nokogiri::XML(res).css('greeting') - errors.add(:base, :failed_to_open_connection_to_epp_server) - server.close_connection # just in case - return - end - - ex = EppXml::Session.new(cl_trid_prefix: tag) - xml = ex.login(clID: { value: tag }, pw: { value: password }) - res = server.send_request(xml) - - if Nokogiri::XML(res).css('result').first['code'] != '1000' - errors.add(:base, Nokogiri::XML(res).css('result').text) - end - - server.close_connection - - rescue OpenSSL::SSL::SSLError => e - Rails.logger.error "INVALID CERT: #{e}" - Rails.logger.error "INVALID CERT DEBUG INFO: epp_hostname: #{ENV['epp_hostname']}," \ - "port: #{ENV['epp_port']}, cert_path: #{ENV['cert_path']}, key_path: #{ENV['key_path']}" - errors.add(:base, :invalid_cert) - end - end -end diff --git a/app/models/dnskey.rb b/app/models/dnskey.rb index 86584b700a..08c6126624 100644 --- a/app/models/dnskey.rb +++ b/app/models/dnskey.rb @@ -25,10 +25,10 @@ class Dnskey < ApplicationRecord } # IANA numbers, single authority list - ALGORITHMS = Depp::Dnskey::ALGORITHMS.map {|pair| pair[1].to_s}.freeze - PROTOCOLS = %w(3) - FLAGS = %w(0 256 257) # 256 = ZSK, 257 = KSK - DS_DIGEST_TYPE = [1,2] + ALGORITHMS = %w[3 5 6 7 8 10 13 14 15 16].freeze + PROTOCOLS = %w[3].freeze + FLAGS = %w[0 256 257].freeze # 256 = ZSK, 257 = KSK + DS_DIGEST_TYPE = [1, 2].freeze RESOLVERS = ENV['dnssec_resolver_ips'].to_s.strip.split(', ').freeze self.ignored_columns = %w[legacy_domain_id] diff --git a/app/models/domain.rb b/app/models/domain.rb index e75f5165c3..2c2b363faa 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -13,6 +13,22 @@ class Domain < ApplicationRecord include Domain::Disputable include Domain::BulkUpdatable + PERIODS = [ + ['3 months', '3m'], + ['6 months', '6m'], + ['9 months', '9m'], + ['1 year', '1y'], + ['2 years', '2y'], + ['3 years', '3y'], + ['4 years', '4y'], + ['5 years', '5y'], + ['6 years', '6y'], + ['7 years', '7y'], + ['8 years', '8y'], + ['9 years', '9y'], + ['10 years', '10y'], + ].freeze + attr_accessor :roles, :legal_document_id, :is_admin, diff --git a/app/presenters/registrar/domain_list_csv_presenter.rb b/app/presenters/registrar/domain_list_csv_presenter.rb deleted file mode 100644 index a216d9561c..0000000000 --- a/app/presenters/registrar/domain_list_csv_presenter.rb +++ /dev/null @@ -1,45 +0,0 @@ -class Registrar::DomainListCsvPresenter - def initialize(domains:, view:) - @domains = domains - @view = view - end - - def to_s - table = CSV::Table.new([header]) - - domains.each do |domain| - table << domain_to_row(domain: domain) - end - - table.to_s - end - - private - - def header - columns = %w[ - domain_name - transfer_code - registrant_name - registrant_code - expire_time - ] - - columns.map! { |column| view.t("registrar.domains.index.csv.#{column}") } - - CSV::Row.new(columns, [], true) - end - - def domain_to_row(domain:) - row = [] - row[0] = domain.name - row[1] = domain.transfer_code - row[2] = domain.registrant.name - row[3] = domain.registrant.code - row[4] = domain.expire_date - - CSV::Row.new([], row) - end - - attr_reader :domains, :view -end diff --git a/app/views/admin/invoices/index.haml b/app/views/admin/invoices/index.haml index 8b8fe12c38..e179a6b6ef 100644 --- a/app/views/admin/invoices/index.haml +++ b/app/views/admin/invoices/index.haml @@ -1,7 +1,7 @@ - content_for :actions do = link_to(t(:add), new_admin_invoice_path, class: 'btn btn-primary') = render 'shared/title', name: t(:invoices) -= render 'search_form' += render 'admin/invoices/partials/search_form' .row .col-md-12 diff --git a/app/views/admin/invoices/partials/_buyer.haml b/app/views/admin/invoices/partials/_buyer.haml new file mode 100644 index 0000000000..96e767d9b1 --- /dev/null +++ b/app/views/admin/invoices/partials/_buyer.haml @@ -0,0 +1,23 @@ +%h4= t(:buyer) +%hr +%dl.dl-horizontal + %dt= t(:name) + %dd= @invoice.buyer_name + + %dt= t(:reg_no) + %dd= @invoice.buyer_reg_no + + %dt= t(:address) + %dd= @invoice.buyer_address + + %dt= t(:country) + %dd= @invoice.buyer_country + + %dt= t(:phone) + %dd= @invoice.buyer_phone + + %dt= t(:url) + %dd= @invoice.buyer_url + + %dt= t(:email) + %dd= @invoice.buyer_email \ No newline at end of file diff --git a/app/views/registrar/invoices/partials/_details.haml b/app/views/admin/invoices/partials/_details.haml similarity index 96% rename from app/views/registrar/invoices/partials/_details.haml rename to app/views/admin/invoices/partials/_details.haml index 150869dfa6..723e94bd4b 100644 --- a/app/views/registrar/invoices/partials/_details.haml +++ b/app/views/admin/invoices/partials/_details.haml @@ -36,4 +36,4 @@ %dd=@invoice.description %dt= Invoice.human_attribute_name :reference_no - %dd= @invoice.reference_no + %dd= @invoice.reference_no \ No newline at end of file diff --git a/app/views/admin/invoices/partials/_items.haml b/app/views/admin/invoices/partials/_items.haml new file mode 100644 index 0000000000..9d56ef549b --- /dev/null +++ b/app/views/admin/invoices/partials/_items.haml @@ -0,0 +1,32 @@ +%h4= t(:items) +%hr +.table-responsive + %table.table.table-hover.table-condensed + %thead + %tr + %th{class: 'col-xs-4'}= t(:description) + %th{class: 'col-xs-2'}= t(:unit) + %th{class: 'col-xs-2'}= InvoiceItem.human_attribute_name :quantity + %th{class: 'col-xs-2'}= t(:price) + %th{class: 'col-xs-2'}= t(:total) + %tbody + - @invoice.each do |invoice_item| + %tr + %td= invoice_item.description + %td= invoice_item.unit + %td= invoice_item.quantity + %td= currency(invoice_item.price) + %td= currency(invoice_item.item_sum_without_vat) + %tfoot + %tr + %th{colspan: 3} + %th= Invoice.human_attribute_name :subtotal + %td= number_to_currency @invoice.subtotal + %tr + %th.no-border{colspan: 3} + %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}" + %td= number_to_currency @invoice.vat_amount + %tr + %th.no-border{colspan: 3} + %th= t(:total) + %td= number_to_currency @invoice.total \ No newline at end of file diff --git a/app/views/registrar/invoices/partials/_monthly_invoice_items.haml b/app/views/admin/invoices/partials/_monthly_invoice_items.haml similarity index 100% rename from app/views/registrar/invoices/partials/_monthly_invoice_items.haml rename to app/views/admin/invoices/partials/_monthly_invoice_items.haml diff --git a/app/views/admin/invoices/partials/_payment_orders.haml b/app/views/admin/invoices/partials/_payment_orders.haml new file mode 100644 index 0000000000..d7d4f0ee92 --- /dev/null +++ b/app/views/admin/invoices/partials/_payment_orders.haml @@ -0,0 +1,19 @@ +%h4= "Payment Orders" +%hr +.table-responsive + %table.table.table-hover.table-condensed + %thead + %tr + %th{class: 'col-xs-1'}= "#" + %th{class: 'col-xs-1'}= "Channel" + %th{class: 'col-xs-2'}= "Status" + %th{class: 'col-xs-3'}= "Initiated" + %th{class: 'col-xs-4'}= "Notes" + %tbody + - @invoice.payment_orders.each do |payment_order| + %tr + %td= payment_order.id + %td= payment_order.channel + %td= payment_order.status + %td= payment_order.created_at + %td= payment_order.notes \ No newline at end of file diff --git a/app/views/admin/invoices/_search_form.html.erb b/app/views/admin/invoices/partials/_search_form.html.erb similarity index 91% rename from app/views/admin/invoices/_search_form.html.erb rename to app/views/admin/invoices/partials/_search_form.html.erb index 91ccf44210..8dbbea00a6 100644 --- a/app/views/admin/invoices/_search_form.html.erb +++ b/app/views/admin/invoices/partials/_search_form.html.erb @@ -69,10 +69,10 @@   - <%= link_to t('.download_btn'), admin_invoices_path(format: :csv, params: params.permit!), - "data-toggle" => "tooltip", "data-placement" => "bottom", "title" => t('.download_btn'), + <%= link_to t('admin.invoices.search_form.download_btn'), admin_invoices_path(format: :csv, params: params.permit!), + "data-toggle" => "tooltip", "data-placement" => "bottom", "title" => t('admin.invoices.search_form.download_btn'), class: 'btn btn-default' %> - <%= link_to t('.reset_btn'), admin_invoices_path, class: 'btn btn-default' %> + <%= link_to t('admin.invoices.search_form.reset_btn'), admin_invoices_path, class: 'btn btn-default' %> <% end %> diff --git a/app/views/admin/invoices/partials/_seller.haml b/app/views/admin/invoices/partials/_seller.haml new file mode 100644 index 0000000000..7326a6e461 --- /dev/null +++ b/app/views/admin/invoices/partials/_seller.haml @@ -0,0 +1,38 @@ +%h4= t(:seller) +%hr +%dl.dl-horizontal + %dt= t(:name) + %dd= @invoice.seller_name + + %dt= Registrar.human_attribute_name :reg_no + %dd= @invoice.seller_reg_no + + %dt= t(:iban) + %dd= @invoice.seller_iban + + %dt= t(:bank) + %dd= @invoice.seller_bank + + %dt= t(:swift) + %dd= @invoice.seller_swift + + %dt= Registrar.human_attribute_name :vat_no + %dd= @invoice.seller_vat_no + + %dt= t(:address) + %dd= @invoice.seller_address + + %dt= t(:country) + %dd= @invoice.seller_country + + %dt= t(:phone) + %dd= @invoice.seller_phone + + %dt= t(:url) + %dd= @invoice.seller_url + + %dt= t(:email) + %dd= @invoice.seller_email + + %dt= t(:issuer) + %dd= @invoice.seller_contact_name \ No newline at end of file diff --git a/app/views/admin/invoices/show.haml b/app/views/admin/invoices/show.haml index 80da77bc81..d92ab82079 100644 --- a/app/views/admin/invoices/show.haml +++ b/app/views/admin/invoices/show.haml @@ -20,200 +20,14 @@ = render 'shared/full_errors', object: @invoice .row - .col-md-6 - %h4= t(:details) - %hr - %dl.dl-horizontal - %dt= t(:issue_date) - %dd= l @invoice.issue_date - - - if @invoice.cancelled? - %dt= Invoice.human_attribute_name :cancelled_at - %dd= l @invoice.cancelled_at - - %dt= t(:due_date) - - if @invoice.cancelled? - %dd.text-grey= t(:cancelled) - - else - %dd= l @invoice.due_date - - %dt= Invoice.human_attribute_name :receipt_date - - if @invoice.paid? - %dd= l @invoice.receipt_date - - elsif @invoice.cancelled? - %dd.text-grey= t(:cancelled) - - else - %dd{class: 'text-danger'}= t(:unpaid) - - %dt= t(:payment_term) - %dd Prepayment - - %dt= t(:invoice_number) - %dd= @invoice.number - - - if @invoice.description.present? - %dt= t(:description) - %dd=@invoice.description - - %dt= Invoice.human_attribute_name :reference_no - %dd= @invoice.reference_no + .col-md-6= render 'admin/invoices/partials/details' .row - .col-md-6 - %h4= t(:seller) - %hr - %dl.dl-horizontal - %dt= t(:name) - %dd= @invoice.seller_name - - %dt= Registrar.human_attribute_name :reg_no - %dd= @invoice.seller_reg_no - - %dt= t(:iban) - %dd= @invoice.seller_iban - - %dt= t(:bank) - %dd= @invoice.seller_bank - - %dt= t(:swift) - %dd= @invoice.seller_swift - - %dt= Registrar.human_attribute_name :vat_no - %dd= @invoice.seller_vat_no - - %dt= t(:address) - %dd= @invoice.seller_address - - %dt= t(:country) - %dd= @invoice.seller_country - - %dt= t(:phone) - %dd= @invoice.seller_phone - - %dt= t(:url) - %dd= @invoice.seller_url - - %dt= t(:email) - %dd= @invoice.seller_email - - %dt= t(:issuer) - %dd= @invoice.seller_contact_name - .col-md-6 - %h4= t(:buyer) - %hr - %dl.dl-horizontal - %dt= t(:name) - %dd= @invoice.buyer_name - - %dt= t(:reg_no) - %dd= @invoice.buyer_reg_no - - %dt= t(:address) - %dd= @invoice.buyer_address - - %dt= t(:country) - %dd= @invoice.buyer_country - - %dt= t(:phone) - %dd= @invoice.buyer_phone - - %dt= t(:url) - %dd= @invoice.buyer_url - - %dt= t(:email) - %dd= @invoice.buyer_email + .col-md-6= render 'admin/invoices/partials/seller' + .col-md-6= render 'admin/invoices/partials/buyer' .row - - if @invoice.monthly_invoice - .col-md-12 - %h4= t(:items) - %hr - .table-responsive - %table.table.table-hover.table-condensed - %thead - %tr - %th{class: 'col-xs-1'}= t(:code) - %th{class: 'col-xs-1'}= InvoiceItem.human_attribute_name :quantity - %th{class: 'col-xs-1'}= t(:unit) - %th{class: 'col-xs-5'}= t(:description) - %th{class: 'col-xs-2'}= t(:price) - %th{class: 'col-xs-2'}= t(:total) - %tbody - - @invoice.each do |invoice_item| - %tr - %td= invoice_item.product_id - %td= invoice_item.quantity - %td= invoice_item.unit - %td= invoice_item.description - - if invoice_item.price && invoice_item.quantity - %td= currency(invoice_item.price) - %td= "#{currency((invoice_item.price * invoice_item.quantity).round(3))} #{@invoice.currency}" - - else - %td= '' - %td= '' - %tfoot - %tr - %th{colspan: 4} - %th= Invoice.human_attribute_name :subtotal - %td= number_to_currency(0) - %tr - %th.no-border{colspan: 4} - %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}" - %td= number_to_currency(0) - %tr - %th.no-border{colspan: 4} - %th= t(:total) - %td= number_to_currency(0) + - if @invoice.monthly_invoice + .col-md-12= render 'admin/invoices/partials/monthly_invoice_items' - else - .col-md-12 - %h4= t(:items) - %hr - .table-responsive - %table.table.table-hover.table-condensed - %thead - %tr - %th{class: 'col-xs-4'}= t(:description) - %th{class: 'col-xs-2'}= t(:unit) - %th{class: 'col-xs-2'}= InvoiceItem.human_attribute_name :quantity - %th{class: 'col-xs-2'}= t(:price) - %th{class: 'col-xs-2'}= t(:total) - %tbody - - @invoice.each do |invoice_item| - %tr - %td= invoice_item.description - %td= invoice_item.unit - %td= invoice_item.quantity - %td= currency(invoice_item.price) - %td= currency(invoice_item.item_sum_without_vat) - %tfoot - %tr - %th{colspan: 3} - %th= Invoice.human_attribute_name :subtotal - %td= number_to_currency @invoice.subtotal - %tr - %th.no-border{colspan: 3} - %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}" - %td= number_to_currency @invoice.vat_amount - %tr - %th.no-border{colspan: 3} - %th= t(:total) - %td= number_to_currency @invoice.total + .col-md-12= render 'admin/invoices/partials/items' .row - .col-md-12 - %h4= "Payment Orders" - %hr - .table-responsive - %table.table.table-hover.table-condensed - %thead - %tr - %th{class: 'col-xs-1'}= "#" - %th{class: 'col-xs-1'}= "Channel" - %th{class: 'col-xs-2'}= "Status" - %th{class: 'col-xs-3'}= "Initiated" - %th{class: 'col-xs-4'}= "Notes" - %tbody - - @invoice.payment_orders.each do |payment_order| - %tr - %td= payment_order.id - %td= payment_order.channel - %td= payment_order.status - %td= payment_order.created_at - %td= payment_order.notes + .col-md-12= render 'admin/invoices/partials/payment_orders' \ No newline at end of file diff --git a/app/views/layouts/registrar/base.html.erb b/app/views/layouts/registrar/base.html.erb deleted file mode 100644 index 3c90db35c5..0000000000 --- a/app/views/layouts/registrar/base.html.erb +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - <% if content_for? :head_title %> - <%= yield :head_title %> - <% else %> - - <%= t(:registrar_head_title) %> - - <% end %> - <%= csrf_meta_tags %> - <%= stylesheet_link_tag 'registrar-manifest', media: 'all' %> - <%= favicon_link_tag 'favicon.ico' %> - - - -
- <%= render 'flash_messages' %> - <% if depp_controller? %> - <%= render 'registrar/shared/epp_results' %> - <% end %> - <%= yield %> -
-
-
-
-
- <%= image_tag 'eis-logo-et.png' %> -
-
- Version - <%= current_commit_link %> -
-
-
-
- <%= javascript_include_tag 'registrar-manifest', async: true %> - - diff --git a/app/views/registrar/invoices/show.haml b/app/views/registrar/invoices/show.haml deleted file mode 100644 index dd19a0beac..0000000000 --- a/app/views/registrar/invoices/show.haml +++ /dev/null @@ -1,23 +0,0 @@ -- content_for :actions do - = link_to(t('.download_btn'), download_registrar_invoice_path(@invoice), class: 'btn btn-default') - = link_to(t('.deliver_btn'), new_registrar_invoice_delivery_path(@invoice), class: 'btn btn-default') - - if @invoice.cancellable? - = link_to(t(:cancel), cancel_registrar_invoice_path(@invoice), method: :patch, class: 'btn btn-warning') - = link_to(t(:back), registrar_invoices_path, class: 'btn btn-default') -= render 'shared/title', name: @invoice.to_s -= render 'shared/full_errors', object: @invoice - -.row - .col-md-6= render 'registrar/invoices/partials/details' -.row - .col-md-6= render 'registrar/invoices/partials/seller' - .col-md-6= render 'registrar/invoices/partials/buyer' -.row - - if @invoice.monthly_invoice - .col-md-12= render 'registrar/invoices/partials/monthly_invoice_items' - - else - .col-md-12= render 'registrar/invoices/partials/items' - -- if @invoice.payable? - .row.semifooter - .col-md-6-offset-6.text-right= render 'registrar/invoices/partials/banklinks', locals: { payment_channels: PaymentOrder::CUSTOMER_PAYMENT_METHODS } diff --git a/config/application.yml.sample b/config/application.yml.sample index 5a92443c46..559ce2e9ba 100644 --- a/config/application.yml.sample +++ b/config/application.yml.sample @@ -61,16 +61,6 @@ contact_org_enabled: 'false' # System default for legal document types is: pdf,asice,sce,asics,scs,adoc,edoc,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx # legal_document_types: "pdf,asice,sce,asics,scs,adoc,edoc,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx" -# -# REGISTRAR configuration (DEPP) -# -show_ds_data_fields: 'false' -default_nameservers_count: '2' -default_admin_contacts_count: '1' -epp_port: '700' -cert_path: '/home/registry/registry/shared/ca/certs/webclient.cert.pem' -key_path: '/home/registry/registry/shared/ca/private/webclient.key.pem' -epp_hostname: 'registry.gitlab.eu' repp_url: 'http://epp:3000/repp/v1/' # Estonian Company Register diff --git a/config/locales/en.yml b/config/locales/en.yml index ae5177470c..342e7dfea5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -380,29 +380,6 @@ en: client_side_status_editing_error: 'Parameter value policy error. Client-side object status management not supported' parameter_value_syntax_error: 'Parameter value syntax error:' - # DEPP - activemodel: - errors: - models: - 'depp/contact': - attributes: - phone: - invalid: "Phone number must be in +XXX.YYYYYYY format" - too_long: "Phone number is too long" - 'depp/user': - attributes: - base: - failed_to_open_connection_to_epp_server: 'Failed to open connection to EPP server!' - authorization_error: 'Authorization error' - invalid_cert: 'Invalid certificate' - not_active: 'User is not active' - webserver_missing_user_name_directive: 'Webserver configuration error: Apache or nginx is missing user name directive.' - webserver_user_name_directive_should_be_required: 'Webserver configuration error: Apache or nginx should require name directive.' - tag: - blank: "Username can't be blank" - password: - blank: "Password can't be blank" - username: 'Username' register: 'Register' domain_info: 'Domain info' diff --git a/test/integration/repp/v1/domains/dnssec_test.rb b/test/integration/repp/v1/domains/dnssec_test.rb index 6835e2600f..349639ad45 100644 --- a/test/integration/repp/v1/domains/dnssec_test.rb +++ b/test/integration/repp/v1/domains/dnssec_test.rb @@ -24,13 +24,11 @@ def test_shows_dnssec_keys_associated_with_domain { flags: '256', alg: '14', protocol: '3', - public_key: 'dGVzdA==' - } - ] + public_key: 'dGVzdA==' }, + ], } post "/repp/v1/domains/#{@domain.name}/dnssec", params: payload, headers: @auth_headers - json = JSON.parse(response.body, symbolize_names: true) get "/repp/v1/domains/#{@domain.name}/dnssec", headers: @auth_headers json = JSON.parse(response.body, symbolize_names: true) @@ -45,9 +43,8 @@ def test_creates_dnssec_key_successfully { flags: '256', alg: '14', protocol: '3', - public_key: 'dGVzdA==' - } - ] + public_key: 'dGVzdA==' }, + ], } post "/repp/v1/domains/#{@domain.name}/dnssec", params: payload, headers: @auth_headers @@ -67,7 +64,7 @@ def test_creates_dnssec_key_successfully end def test_creates_dnssec_key_with_every_algo - algos = Depp::Dnskey::ALGORITHMS.map {|pair| pair[1].to_s} + algos = Dnskey::ALGORITHMS algos_to_check = %w[15 16] assert (algos & algos_to_check) == algos_to_check @@ -79,9 +76,8 @@ def test_creates_dnssec_key_with_every_algo { flags: '256', alg: alg, protocol: '3', - public_key: 'dGVzdA==' - } - ] + public_key: 'dGVzdA==' }, + ], } post "/repp/v1/domains/#{@domain.name}/dnssec", params: payload, headers: @auth_headers @@ -105,13 +101,11 @@ def test_removes_existing_dnssec_key_successfully { flags: '256', alg: '14', protocol: '3', - public_key: 'dGVzdA==' - } - ] + public_key: 'dGVzdA==' }, + ], } post "/repp/v1/domains/#{@domain.name}/dnssec", params: payload, headers: @auth_headers - json = JSON.parse(response.body, symbolize_names: true) assert @domain.dnskeys.any? diff --git a/test/models/depp_contact_test.rb b/test/models/depp_contact_test.rb deleted file mode 100644 index 12f7c3b4fa..0000000000 --- a/test/models/depp_contact_test.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'test_helper' -require 'helpers/phone_format_helper_test' - -class DeppContactTest < ActiveSupport::TestCase - include PhoneFormatHelperTest - - setup do - @depp_contact = Depp::Contact.new - end - - def test_validates_phone_format - assert_phone_format(@depp_contact) - end -end \ No newline at end of file diff --git a/test/system/registrar_area/billing/balance_top_up_test.rb b/test/system/registrar_area/billing/balance_top_up_test.rb deleted file mode 100644 index 3dfeb5a268..0000000000 --- a/test/system/registrar_area/billing/balance_top_up_test.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'application_system_test_case' - -class BalanceTopUpTest < ApplicationSystemTestCase - setup do - sign_in users(:api_bestnames) - @original_registry_vat_rate = Setting.registry_vat_prc - - eis_response = OpenStruct.new(body: "{\"payment_link\":\"http://link.test\"}") - Spy.on_instance_method(EisBilling::AddDeposits, :send_invoice).and_return(eis_response) - Spy.on_instance_method(EisBilling::BaseController, :authorized).and_return(true) - end - - teardown do - Setting.registry_vat_prc = @original_registry_vat_rate - end - - def test_creates_new_invoice - invoice_n = Invoice.order(number: :desc).last.number - stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {}) - - stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response") - .to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {}) - - stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice") - .to_return(status: 200, body: "", headers: {}) - - Setting.registry_vat_prc = 0.1 - - visit registrar_invoices_url - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '25.5' - - assert_difference 'Invoice.count' do - click_link_or_button 'Add' - end - - invoice = Invoice.last - - assert_equal BigDecimal(10), invoice.vat_rate - assert_equal BigDecimal('28.05'), invoice.total - assert_text 'Please pay the following invoice' - end -end diff --git a/test/system/registrar_area/invoices/new_test.rb b/test/system/registrar_area/invoices/new_test.rb deleted file mode 100644 index 16e30aeb71..0000000000 --- a/test/system/registrar_area/invoices/new_test.rb +++ /dev/null @@ -1,96 +0,0 @@ -require 'application_system_test_case' - -class NewInvoiceTest < ApplicationSystemTestCase - def setup - super - - @user = users(:api_bestnames) - sign_in @user - - eis_response = OpenStruct.new(body: "{\"payment_link\":\"http://link.test\"}") - Spy.on_instance_method(EisBilling::AddDeposits, :send_invoice).and_return(eis_response) - end - - def test_show_balance - visit registrar_invoices_path - assert_text "Your current account balance is 100,00 EUR" - end - - def test_create_new_invoice_with_positive_amount - invoice_n = Invoice.order(number: :desc).last.number - stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {}) - - stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {}) - - stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice"). - to_return(status: 200, body: "", headers: {}) - - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '200.00' - fill_in 'Description', with: 'My first invoice' - - assert_difference 'Invoice.count', 1 do - click_link_or_button 'Add' - end - - assert_text 'Please pay the following invoice' - assert_text "Invoice no. #{invoice_n + 3}" - assert_text 'Subtotal 200,00 €' - assert_text 'Pay invoice' - end - - def test_create_new_invoice_with_comma_in_number - invoice_n = Invoice.order(number: :desc).last.number - stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {}) - - stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response"). - to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {}) - - stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice"). - to_return(status: 200, body: "", headers: {}) - - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '200,00' - fill_in 'Description', with: 'My first invoice' - - assert_difference 'Invoice.count', 1 do - click_link_or_button 'Add' - end - - assert_text 'Please pay the following invoice' - assert_text "Invoice no. #{invoice_n + 3}" - assert_text 'Subtotal 200,00 €' - assert_text 'Pay invoice' - end - - def test_create_new_invoice_fails_when_amount_is_0 - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '0.00' - fill_in 'Description', with: 'My first invoice' - - assert_no_difference 'Invoice.count' do - click_link_or_button 'Add' - end - - assert_text 'Amount is too small. Minimum deposit is 0.01 EUR' - end - - def test_create_new_invoice_fails_when_amount_is_negative - visit registrar_invoices_path - click_link_or_button 'Add deposit' - fill_in 'Amount', with: '-120.00' - fill_in 'Description', with: 'My first invoice' - - assert_no_difference 'Invoice.count' do - click_link_or_button 'Add' - end - - assert_text 'Amount is too small. Minimum deposit is 0.01 EUR' - end -end From dbf8d43f5ba8a15821a1eb381f909e45e75c0348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergei=20Ts=C3=B5ganov?= Date: Thu, 13 Oct 2022 14:14:35 +0300 Subject: [PATCH 7/7] Fixed codeclimate issue --- Gemfile | 12 +++++------- Gemfile.lock | 3 +-- app/models/ability.rb | 4 ---- config/locales/en.yml | 1 - 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 4ba187b94e..d12e0f0964 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'figaro', '~> 1.2' # model related gem 'paper_trail', '~> 12.1' -gem 'pg', '1.4.3' +gem 'pg', '1.4.3' # 1.8 is for Rails < 5.0 gem 'ransack', '~> 2.6.0' gem 'truemail', '~> 2.4' # validates email by regexp, mail server existence and address existence @@ -30,13 +30,12 @@ gem 'nokogiri', '~> 1.13.0' # style gem 'bootstrap-sass', '~> 3.4' gem 'cancancan' -gem 'coderay', '1.1.3' # xml console visualize gem 'coffee-rails', '>= 5.0' gem 'devise', '~> 4.8' gem 'jquery-rails' gem 'kaminari' gem 'sass-rails' -gem 'select2-rails', '4.0.13' # for autocomplete +gem 'select2-rails', '4.0.13' # for autocomplete gem 'selectize-rails', '0.12.6' # include selectize.js for select # registry specfic @@ -48,7 +47,7 @@ gem 'simpleidn', '0.2.1' # For punycode gem 'whenever', '1.0.0', require: false # country listing -gem 'countries', :require => 'countries/global' +gem 'countries', require: 'countries/global' # id + mid login # gem 'digidoc_client', '0.3.0' @@ -77,7 +76,6 @@ gem 'lhv', github: 'internetee/lhv', branch: 'master' gem 'rexml' gem 'wkhtmltopdf-binary', '~> 0.12.5.1' - gem 'directo', github: 'internetee/directo', branch: 'master' group :development, :test do @@ -95,12 +93,12 @@ group :test do end gem 'aws-sdk-sesv2', '~> 1.19' +gem 'newrelic-infinite_tracing' +gem 'newrelic_rpm' # profiles gem 'pghero' gem 'pg_query', '>= 0.9.0' -gem 'newrelic_rpm' -gem 'newrelic-infinite_tracing' # token gem 'jwt' diff --git a/Gemfile.lock b/Gemfile.lock index f1908d37cd..2ff1448410 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -521,7 +521,6 @@ DEPENDENCIES bootstrap-sass (~> 3.4) cancancan capybara - coderay (= 1.1.3) coffee-rails (>= 5.0) company_register! countries @@ -580,4 +579,4 @@ DEPENDENCIES wkhtmltopdf-binary (~> 0.12.5.1) BUNDLED WITH - 2.3.21 + 2.3.23 diff --git a/app/models/ability.rb b/app/models/ability.rb index 491c2a1ac1..04d8205447 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -31,10 +31,6 @@ def super # Registrar/api_user dynamic role end def epp # Registrar/api_user dynamic role - if @user.registrar.api_ip_white?(@ip) - can :manage, :xml_console - end - can :manage, Account # Poll diff --git a/config/locales/en.yml b/config/locales/en.yml index 342e7dfea5..d42efd0a53 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -383,7 +383,6 @@ en: username: 'Username' register: 'Register' domain_info: 'Domain info' - xml_console: 'XML Console' info: 'Info' send_epp_request: 'Send EPP Request' updated_at: 'Updated at'