mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 23:16:23 +02:00
Merge branch 'master' into 2275-fix-csv-view-for-historical-data
This commit is contained in:
commit
a7b9fb7bb6
13 changed files with 131 additions and 42 deletions
|
@ -34,6 +34,17 @@ module Api
|
|||
end
|
||||
end
|
||||
|
||||
def do_need_update_contact
|
||||
result = current_registrant_user.do_need_update_contact?
|
||||
render json: { update_contacts: result[:result], counter: result[:counter] }
|
||||
end
|
||||
|
||||
def update_company_contacts
|
||||
companies = current_registrant_user.update_company_contacts
|
||||
|
||||
render json: { message: 'get it', companies: companies }
|
||||
end
|
||||
|
||||
def update
|
||||
logger.debug 'Received update request'
|
||||
logger.debug params
|
||||
|
|
|
@ -11,6 +11,8 @@ module Domains
|
|||
domains = domain_contacts.map(&:domain).flatten +
|
||||
Domain.where(registrant_id: registrant_ids)
|
||||
|
||||
return if expired_or_hold_domains_exists?(domains)
|
||||
|
||||
domains.each do |domain|
|
||||
next if domain.expired?
|
||||
|
||||
|
@ -20,6 +22,12 @@ module Domains
|
|||
|
||||
private
|
||||
|
||||
def expired_or_hold_domains_exists?(domains)
|
||||
domains.any? do |domain|
|
||||
domain.statuses.include?(DomainStatus::SERVER_HOLD) && email.include?(domain.name)
|
||||
end
|
||||
end
|
||||
|
||||
def before_execute_force_delete(domain)
|
||||
if domain.force_delete_scheduled? && !domain.status_notes[DomainStatus::FORCE_DELETE].nil?
|
||||
added_additional_email_into_notes(domain)
|
||||
|
|
|
@ -20,16 +20,27 @@ class RegistrantUser < User
|
|||
def companies(company_register = CompanyRegister::Client.new)
|
||||
return [] if ident.include?('-')
|
||||
|
||||
companies = company_register.representation_rights(citizen_personal_code: ident,
|
||||
citizen_country_code: country.alpha3)
|
||||
|
||||
companies = update_contacts_before_receive(companies)
|
||||
companies
|
||||
company_register.representation_rights(citizen_personal_code: ident,
|
||||
citizen_country_code: country.alpha3)
|
||||
rescue CompanyRegister::NotAvailableError
|
||||
return []
|
||||
[]
|
||||
end
|
||||
|
||||
def update_contacts_before_receive(companies)
|
||||
def do_need_update_contact?
|
||||
return { result: false, counter: 0 } if companies.blank?
|
||||
|
||||
counter = 0
|
||||
companies.each do |company|
|
||||
counter += Contact.where(ident: company.registration_number, ident_country_code: 'EE')&.
|
||||
reject { |contact| contact.name == company.company_name }.size
|
||||
end
|
||||
|
||||
return { result: true, counter: counter } if counter.positive?
|
||||
|
||||
{ result: false, counter: 0 }
|
||||
end
|
||||
|
||||
def update_company_contacts
|
||||
return [] if companies.blank?
|
||||
|
||||
companies.each do |company|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue