mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Merge branch 'story/117124725-registrant-change' into staging
This commit is contained in:
commit
3e80f05694
9 changed files with 117 additions and 103 deletions
|
@ -7,8 +7,13 @@ class DomainUpdateConfirmJob < Que::Job
|
||||||
case action
|
case action
|
||||||
when RegistrantVerification::CONFIRMED
|
when RegistrantVerification::CONFIRMED
|
||||||
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
|
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
|
||||||
|
raise_errors!(domain)
|
||||||
|
|
||||||
domain.apply_pending_update!
|
domain.apply_pending_update!
|
||||||
|
raise_errors!(domain)
|
||||||
|
|
||||||
domain.clean_pendings!
|
domain.clean_pendings!
|
||||||
|
raise_errors!(domain)
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
domain.send_mail :pending_update_rejected_notification_for_new_registrant
|
domain.send_mail :pending_update_rejected_notification_for_new_registrant
|
||||||
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
||||||
|
@ -18,4 +23,8 @@ class DomainUpdateConfirmJob < Que::Job
|
||||||
destroy # it's best to destroy the job in the same transaction
|
destroy # it's best to destroy the job in the same transaction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def raise_errors!(domain)
|
||||||
|
throw "domain #{domain.name} failed with errors #{domain.errors.full_messages}" if domain.errors.any?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,12 +9,34 @@ class DomainMailer < ApplicationMailer
|
||||||
compose_from(params)
|
compose_from(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrant_updated_notification_for_new_registrant(params)
|
|
||||||
compose_from(params)
|
def registrant_updated_notification_for_new_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver)
|
||||||
|
@domain = Domain.find_by(id: domain_id)
|
||||||
|
return unless @domain
|
||||||
|
return if delivery_off?(@domain, should_deliver)
|
||||||
|
|
||||||
|
@old_registrant = Registrant.find(old_registrant_id)
|
||||||
|
@new_registrant = Registrant.find(new_registrant_id)
|
||||||
|
|
||||||
|
return if whitelist_blocked?(@new_registrant.email)
|
||||||
|
mail(to: format(@new_registrant.email),
|
||||||
|
subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject,
|
||||||
|
name: @domain.name)} [#{@domain.name}]")
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrant_updated_notification_for_old_registrant(params)
|
|
||||||
compose_from(params)
|
def registrant_updated_notification_for_old_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver)
|
||||||
|
domain = Domain.find_by(id: domain_id)
|
||||||
|
return unless domain
|
||||||
|
return if delivery_off?(@domain, should_deliver)
|
||||||
|
|
||||||
|
@old_registrant = Registrant.find(old_registrant_id)
|
||||||
|
@new_registrant = Registrant.find(new_registrant_id)
|
||||||
|
|
||||||
|
return if whitelist_blocked?(@old_registrant.email)
|
||||||
|
mail(to: format(@old_registrant.email),
|
||||||
|
subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject,
|
||||||
|
name: @domain.name)} [#{@domain.name}]")
|
||||||
end
|
end
|
||||||
|
|
||||||
def pending_update_rejected_notification_for_new_registrant(params)
|
def pending_update_rejected_notification_for_new_registrant(params)
|
||||||
|
|
|
@ -20,28 +20,7 @@ class DomainMailModel
|
||||||
domain_info
|
domain_info
|
||||||
compose
|
compose
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrant_updated_notification_for_new_registrant
|
|
||||||
registrant
|
|
||||||
subject(:registrant_updated_notification_for_new_registrant_subject)
|
|
||||||
domain_info
|
|
||||||
compose
|
|
||||||
end
|
|
||||||
|
|
||||||
def registrant_updated_notification_for_old_registrant
|
|
||||||
registrant_pending
|
|
||||||
registrant_old
|
|
||||||
subject(:registrant_updated_notification_for_old_registrant_subject)
|
|
||||||
new_registrant = Registrant.find @domain.pending_json['new_registrant_id']
|
|
||||||
@params[:registrant_name] = new_registrant.name
|
|
||||||
@params[:registrant_ident] = new_registrant.ident
|
|
||||||
@params[:registrant_priv] = new_registrant.priv?
|
|
||||||
@params[:registrant_email] = new_registrant.email
|
|
||||||
@params[:registrant_street] = new_registrant.street
|
|
||||||
@params[:registrant_city] = new_registrant.city
|
|
||||||
@params[:registrant_country] = new_registrant.country.name
|
|
||||||
compose
|
|
||||||
end
|
|
||||||
|
|
||||||
def pending_update_rejected_notification_for_new_registrant
|
def pending_update_rejected_notification_for_new_registrant
|
||||||
registrant_pending
|
registrant_pending
|
||||||
|
|
|
@ -535,6 +535,7 @@ class Epp::Domain < Domain
|
||||||
preclean_pendings
|
preclean_pendings
|
||||||
user = ApiUser.find(pending_json['current_user_id'])
|
user = ApiUser.find(pending_json['current_user_id'])
|
||||||
frame = Nokogiri::XML(pending_json['frame'])
|
frame = Nokogiri::XML(pending_json['frame'])
|
||||||
|
old_registrant_id = registrant_id
|
||||||
|
|
||||||
self.deliver_emails = true # turn on email delivery
|
self.deliver_emails = true # turn on email delivery
|
||||||
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||||
|
@ -542,14 +543,15 @@ class Epp::Domain < Domain
|
||||||
self.up_date = Time.zone.now
|
self.up_date = Time.zone.now
|
||||||
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
||||||
|
|
||||||
send_mail :registrant_updated_notification_for_old_registrant
|
|
||||||
return unless update(frame, user, false)
|
return unless update(frame, user, false)
|
||||||
clean_pendings!
|
clean_pendings!
|
||||||
|
|
||||||
send_mail :registrant_updated_notification_for_new_registrant
|
|
||||||
WhoisRecord.find_by(domain_id: id).save # need to reload model
|
|
||||||
|
|
||||||
save! # for notification if everything fails
|
save! # for notification if everything fails
|
||||||
|
|
||||||
|
WhoisRecord.find_by(domain_id: id).save # need to reload model
|
||||||
|
DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, should_deliver)
|
||||||
|
DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, should_deliver)
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
Tere,
|
Tere,
|
||||||
<br><br>
|
<br><br>
|
||||||
Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
||||||
<br><br>
|
<br><br>
|
||||||
Uue registreerija andmed:<br>
|
Uue registreerija andmed:<br>
|
||||||
Nimi: <%= @params[:registrant_name] %><br>
|
Nimi: <%= @new_registrant.name %><br>
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Isikukood: <%= @params[:registrant_ident] %><br>
|
Isikukood: <%= @new_registrant.ident %><br>
|
||||||
<% else %>
|
<% else %>
|
||||||
Äriregistrikood: <%= @params[:registrant_ident] %><br>
|
Äriregistrikood: <%= @new_registrant.ident %><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
Epost: <%= @params[:registrant_email] %><br>
|
Epost: <%= @new_registrant.email %><br>
|
||||||
Tänav: <%= @params[:registrant_street] %><br>
|
Tänav: <%= @new_registrant.street %><br>
|
||||||
Linn: <%= @params[:registrant_city] %><br>
|
Linn: <%= @new_registrant.city %><br>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @new_registrant.country.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Lugupidamisega<br>
|
Lugupidamisega<br>
|
||||||
Eesti Interneti SA
|
Eesti Interneti SA
|
||||||
|
@ -21,19 +21,19 @@ Eesti Interneti SA
|
||||||
<br><br>
|
<br><br>
|
||||||
Hi,
|
Hi,
|
||||||
<br><br>
|
<br><br>
|
||||||
Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated.
|
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
|
||||||
<br><br>
|
<br><br>
|
||||||
New registrant:<br>
|
New registrant:<br>
|
||||||
Name: <%= @params[:registrant_name] %><br>
|
Name: <%= @new_registrant.name %><br>
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Personal code: <%= @params[:registrant_ident] %><br>
|
Personal code: <%= @new_registrant.ident %><br>
|
||||||
<% else %>
|
<% else %>
|
||||||
Business Registry code: <%= @params[:registrant_ident] %><br>
|
Business Registry code: <%= @new_registrant.ident %><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
E-mail: <%= @params[:registrant_email] %><br>
|
E-mail: <%= @new_registrant.email %><br>
|
||||||
Street: <%= @params[:registrant_street] %><br>
|
Street: <%= @new_registrant.street %><br>
|
||||||
City: <%= @params[:registrant_city] %><br>
|
City: <%= @new_registrant.city %><br>
|
||||||
Country: <%= @params[:registrant_country] %>
|
Country: <%= @new_registrant.country.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Best Regards,<br>
|
Best Regards,<br>
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
Tere,
|
Tere,
|
||||||
|
|
||||||
Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
||||||
|
|
||||||
Uue registreerija andmed:
|
Uue registreerija andmed:
|
||||||
Nimi: <%= @params[:registrant_name] %>
|
Nimi: <%= @new_registrant.name %>
|
||||||
<% if @params[:registrant_priv] %>
|
|
||||||
Isikukood: <%= @params[:registrant_ident] %>
|
<% if @new_registrant.priv? %>
|
||||||
|
Isikukood: <%= @new_registrant.ident %>
|
||||||
<% else %>
|
<% else %>
|
||||||
Äriregistrikood: <%= @params[:registrant_ident] %>
|
Äriregistrikood: <%= @new_registrant.ident %>
|
||||||
<% end %>
|
<% end %>
|
||||||
Epost: <%= @params[:registrant_email] %>
|
Epost: <%= @new_registrant.email %>
|
||||||
Tänav: <%= @params[:registrant_street] %>
|
Tänav: <%= @new_registrant.street %>
|
||||||
Linn: <%= @params[:registrant_city] %>
|
Linn: <%= @new_registrant.city %>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @new_registrant.country.name %>
|
||||||
|
|
||||||
Lugupidamisega
|
Lugupidamisega
|
||||||
Eesti Interneti SA
|
Eesti Interneti SA
|
||||||
|
@ -21,19 +22,20 @@ Eesti Interneti SA
|
||||||
|
|
||||||
Hi,
|
Hi,
|
||||||
|
|
||||||
Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated.
|
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
|
||||||
|
|
||||||
New registrant:
|
New registrant:
|
||||||
Name: <%= @params[:registrant_name] %>
|
Name: <%= @new_registrant.name %>
|
||||||
<% if @params[:registrant_priv] %>
|
|
||||||
Personal code: <%= @params[:registrant_ident] %>
|
<% if @new_registrant.priv? %>
|
||||||
|
Personal code: <%= @new_registrant.ident %>
|
||||||
<% else %>
|
<% else %>
|
||||||
Business Registry code: <%= @params[:registrant_ident] %>
|
Business Registry code: <%= @new_registrant.ident %>
|
||||||
<% end %>
|
<% end %>
|
||||||
E-mail: <%= @params[:registrant_email] %>
|
E-mail: <%= @new_registrant.email %>
|
||||||
Street: <%= @params[:registrant_street] %>
|
Street: <%= @new_registrant.street %>
|
||||||
City: <%= @params[:registrant_city] %>
|
City: <%= @new_registrant.city %>
|
||||||
Country: <%= @params[:registrant_country] %>
|
Country: <%= @new_registrant.country.name %>
|
||||||
|
|
||||||
Best Regards,
|
Best Regards,
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
Tere,
|
Tere,
|
||||||
<br><br>
|
<br><br>
|
||||||
Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
||||||
<br><br>
|
<br><br>
|
||||||
Uue registreerija andmed:<br>
|
Uue registreerija andmed:<br>
|
||||||
Nimi: <%= @params[:new_registrant_name] %><br>
|
Nimi: <%= @new_registrant.name %><br>
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Isikukood: <%= @params[:registrant_ident] %><br>
|
Isikukood: <%= @new_registrant.ident %><br>
|
||||||
<% else %>
|
<% else %>
|
||||||
Äriregistrikood: <%= @params[:registrant_ident] %><br>
|
Äriregistrikood: <%= @new_registrant.ident %><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
Epost: <%= @params[:registrant_email] %><br>
|
Epost: <%= @new_registrant.email %><br>
|
||||||
Tänav: <%= @params[:registrant_street] %><br>
|
Tänav: <%= @new_registrant.street %><br>
|
||||||
Linn: <%= @params[:registrant_city] %><br>
|
Linn: <%= @new_registrant.city %><br>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @new_registrant.country.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Lugupidamisega<br>
|
Lugupidamisega<br>
|
||||||
Eesti Interneti SA
|
Eesti Interneti SA
|
||||||
|
@ -21,19 +21,19 @@ Eesti Interneti SA
|
||||||
<br><br>
|
<br><br>
|
||||||
Hi,
|
Hi,
|
||||||
<br><br>
|
<br><br>
|
||||||
Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated.
|
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
|
||||||
<br><br>
|
<br><br>
|
||||||
New registrant:<br>
|
New registrant:<br>
|
||||||
Name: <%= @params[:new_registrant_name] %><br>
|
Name: <%= @new_registrant.name %><br>
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Personal code: <%= @params[:registrant_ident] %><br>
|
Personal code: <%= @new_registrant.ident %><br>
|
||||||
<% else %>
|
<% else %>
|
||||||
Business Registry code: <%= @params[:registrant_ident] %><br>
|
Business Registry code: <%= @new_registrant.ident %><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
E-mail: <%= @params[:registrant_email] %><br>
|
E-mail: <%= @new_registrant.email %><br>
|
||||||
Street: <%= @params[:registrant_street] %><br>
|
Street: <%= @new_registrant.street %><br>
|
||||||
City: <%= @params[:registrant_city] %><br>
|
City: <%= @new_registrant.city %><br>
|
||||||
Country: <%= @params[:registrant_country] %>
|
Country: <%= @new_registrant.country.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Best Regards,<br>
|
Best Regards,<br>
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
Tere,
|
Tere,
|
||||||
|
|
||||||
Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
|
||||||
|
|
||||||
Uue registreerija andmed:
|
Uue registreerija andmed:
|
||||||
Nimi: <%= @params[:new_registrant_name] %>
|
Nimi: <%= @new_registrant.name %>
|
||||||
|
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Isikukood: <%= @params[:registrant_ident] %>
|
Isikukood: <%= @new_registrant.ident %>
|
||||||
<% else %>
|
<% else %>
|
||||||
Äriregistrikood: <%= @params[:registrant_ident] %>
|
Äriregistrikood: <%= @new_registrant.ident %>
|
||||||
<% end %>
|
<% end %>
|
||||||
Epost: <%= @params[:registrant_email] %>
|
Epost: <%= @new_registrant.email %>
|
||||||
Tänav: <%= @params[:registrant_street] %>
|
Tänav: <%= @new_registrant.street %>
|
||||||
Linn: <%= @params[:registrant_city] %>
|
Linn: <%= @new_registrant.city %>
|
||||||
Riik: <%= @params[:registrant_country] %>
|
Riik: <%= @new_registrant.country.name %>
|
||||||
|
|
||||||
Lugupidamisega
|
Lugupidamisega
|
||||||
Eesti Interneti SA
|
Eesti Interneti SA
|
||||||
|
@ -22,20 +22,20 @@ Eesti Interneti SA
|
||||||
|
|
||||||
Hi,
|
Hi,
|
||||||
|
|
||||||
Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated.
|
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
|
||||||
|
|
||||||
New registrant:
|
New registrant:
|
||||||
Name: <%= @params[:new_registrant_name] %>
|
Name: <%= @new_registrant.name %>
|
||||||
|
|
||||||
<% if @params[:registrant_priv] %>
|
<% if @new_registrant.priv? %>
|
||||||
Personal code: <%= @params[:registrant_ident] %>
|
Personal code: <%= @new_registrant.ident %>
|
||||||
<% else %>
|
<% else %>
|
||||||
Business Registry code: <%= @params[:registrant_ident] %>
|
Business Registry code: <%= @new_registrant.ident %>
|
||||||
<% end %>
|
<% end %>
|
||||||
E-mail: <%= @params[:registrant_email] %>
|
E-mail: <%= @new_registrant.email %>
|
||||||
Street: <%= @params[:registrant_street] %>
|
Street: <%= @new_registrant.street %>
|
||||||
City: <%= @params[:registrant_city] %>
|
City: <%= @new_registrant.city %>
|
||||||
Country: <%= @params[:registrant_country] %>
|
Country: <%= @new_registrant.country.name %>
|
||||||
|
|
||||||
Best Regards,
|
Best Regards,
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
||||||
|
|
|
@ -153,7 +153,7 @@ describe DomainMailer do
|
||||||
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
||||||
@domain = Fabricate(:domain, registrant: @registrant)
|
@domain = Fabricate(:domain, registrant: @registrant)
|
||||||
@domain.deliver_emails = true
|
@domain.deliver_emails = true
|
||||||
@mail = DomainMailer.registrant_updated_notification_for_new_registrant(@domain.id, deliver_emails)
|
@mail = DomainMailer.registrant_updated_notification_for_new_registrant(@domain.id, @registrant.id, @registrant.id, deliver_emails)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should render email subject' do
|
it 'should render email subject' do
|
||||||
|
@ -178,7 +178,7 @@ describe DomainMailer do
|
||||||
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
||||||
@domain = Fabricate(:domain, registrant: @registrant)
|
@domain = Fabricate(:domain, registrant: @registrant)
|
||||||
@domain.deliver_emails = true
|
@domain.deliver_emails = true
|
||||||
@mail = DomainMailer.registrant_updated_notification_for_old_registrant(@domain.id, deliver_emails)
|
@mail = DomainMailer.registrant_updated_notification_for_old_registrant(@domain.id, @registrant.id, @registrant.id, deliver_emails)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should render email subject' do
|
it 'should render email subject' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue