Email notification when pending update rejected #2786

This commit is contained in:
Priit Tark 2015-07-28 15:59:14 +03:00
parent 726231c4e6
commit 00d42ef3c4
6 changed files with 59 additions and 0 deletions

View file

@ -8,6 +8,7 @@ class DomainUpdateConfirmJob < Que::Job
domain.apply_pending_update! domain.apply_pending_update!
domain.clean_pendings! domain.clean_pendings!
when RegistrantVerification::REJECTED when RegistrantVerification::REJECTED
DomainMailer.pending_update_rejected_new_registrant_notification(domain).deliver_now
domain.clean_pendings! domain.clean_pendings!
end end
destroy # it's best to destroy the job in the same transaction destroy # it's best to destroy the job in the same transaction

View file

@ -57,6 +57,19 @@ class DomainMailer < ApplicationMailer
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
def pending_update_rejected_new_registrant_notification(domain)
@domain = domain
# no delivery off control, driggered by que, no epp request
@new_registrant_email = @domain.pending_json[:new_registrant_email]
@new_registrant_name = @domain.pending_json[:new_registrant_name]
return if whitelist_blocked?(@new_registrant_email)
mail(to: @new_registrant_email,
subject: "#{I18n.t(:pending_update_rejected_new_registrant_notification_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_deleted(domain) def pending_deleted(domain)
@domain = domain @domain = domain
return if delivery_off?(@domain) return if delivery_off?(@domain)

View file

@ -359,6 +359,9 @@ class Domain < ActiveRecord::Base
token = registrant_verification_token token = registrant_verification_token
asked_at = registrant_verification_asked_at asked_at = registrant_verification_asked_at
changes_cache = changes changes_cache = changes
new_registrant_id = registrant.id
new_registrant_email = registrant.email
new_registrant_name = registrant.name
DomainMailer.pending_update_old_registrant_request(self).deliver_now DomainMailer.pending_update_old_registrant_request(self).deliver_now
DomainMailer.pending_update_new_registrant_notification(self).deliver_now DomainMailer.pending_update_new_registrant_notification(self).deliver_now
@ -370,6 +373,9 @@ class Domain < ActiveRecord::Base
self.registrant_verification_asked_at = asked_at self.registrant_verification_asked_at = asked_at
self.statuses = [DomainStatus::PENDING_UPDATE] self.statuses = [DomainStatus::PENDING_UPDATE]
pending_json[:domain] = changes_cache pending_json[:domain] = changes_cache
pending_json[:new_registrant_id] = new_registrant_id
pending_json[:new_registrant_email] = new_registrant_email
pending_json[:new_registrant_name] = new_registrant_name
end end
# rubocop: disable Metrics/CyclomaticComplexity # rubocop: disable Metrics/CyclomaticComplexity

View file

@ -0,0 +1,19 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> registreerija <%= @new_registrant_name %> on domeeni registreerija vahetamise taotluse tagasi lükanud.
<br><br>
Küsimuste korral palun võtke ühendust registripidajaga <%= @domain.registrar_name %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
<br><br>
Lugupidamisega,<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Registrant change was declined for the domain <%= @domain.name %>.
<br><br>
Please contact to your registrar <%= @domain.registrar_name %> if you have any questions.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,19 @@
Tere,
Domeeni <%= @domain.name %> registreerija <%= @new_registrant_name %> on domeeni registreerija vahetamise taotluse tagasi lükanud.
Küsimuste korral palun võtke ühendust registripidajaga <%= @domain.registrar_name %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Registrant change was declined for the domain <%= @domain.name %>.
Please contact to your registrar <%= @domain.registrar_name %> if you have any questions.
Best Regards,
Estonian Internet Foundation

View file

@ -779,6 +779,7 @@ en:
object_status_prohibits_operation: 'Object status prohibits operation' object_status_prohibits_operation: 'Object status prohibits operation'
pending_update_old_registrant_request_subject: "Kinnitustaotlus domeeni %{name} registreerija vahetuseks / Application for approval for registrant chache of %{name}" pending_update_old_registrant_request_subject: "Kinnitustaotlus domeeni %{name} registreerija vahetuseks / Application for approval for registrant chache of %{name}"
pending_update_new_registrant_notification_subject: "Domeeni %{name} registreerija vahetus protseduur on algatatud / %{name} registrant change" pending_update_new_registrant_notification_subject: "Domeeni %{name} registreerija vahetus protseduur on algatatud / %{name} registrant change"
pending_update_rejected_new_registrant_notification_subject: "Domeeni %{name} registreerija vahetuse taotlus tagasi lükatud / %{name} registrant change declined"
domain_pending_deleted_subject: "Kinnitustaotlus domeeni %{name} kustutamiseks .ee registrist / Application for approval for deletion of %{name}" domain_pending_deleted_subject: "Kinnitustaotlus domeeni %{name} kustutamiseks .ee registrist / Application for approval for deletion of %{name}"
whois: WHOIS whois: WHOIS
login_failed_check_id_card: 'Log in failed, check ID card' login_failed_check_id_card: 'Log in failed, check ID card'