feat: Add invalid ident notification for company register status checks

- Add notification system for invalid company identifications
- Update force delete notifications to handle invalid company cases
- Add translations for invalid ident messages (ET/EN)
- Add test coverage for invalid ident scenarios
- Remove debug logging from force delete process
- Clean up unused CSV templates

This change improves handling of invalid company identifications in the
Estonian business registry by providing proper notifications to registrars
and ensuring appropriate status updates.
This commit is contained in:
oleghasjanov 2024-12-17 14:08:57 +02:00
parent 475b1e7fbd
commit b229613b8a
8 changed files with 50 additions and 31 deletions

View file

@ -6,10 +6,14 @@ module Domains
end
def notify_without_email
template = I18n.t('force_delete_set_on_domain',
domain_name: domain.name,
outzone_date: domain.outzone_date,
purge_date: domain.purge_date)
template = if reason == 'invalid_company'
I18n.t('invalid_ident', ident: domain.registrant.ident)
else
I18n.t('force_delete_set_on_domain',
domain_name: domain.name,
outzone_date: domain.outzone_date,
purge_date: domain.purge_date)
end
return if domain.registrar&.notifications&.last&.text&.include? template
@ -17,11 +21,15 @@ module Domains
end
def notify_with_email
template = I18n.t('force_delete_auto_email',
domain_name: domain.name,
outzone_date: domain.outzone_date,
purge_date: domain.purge_date,
email: email)
template = if reason == 'invalid_company'
I18n.t('invalid_ident', ident: domain.registrant.ident)
else
I18n.t('force_delete_auto_email',
domain_name: domain.name,
outzone_date: domain.outzone_date,
purge_date: domain.purge_date,
email: email)
end
return if domain.registrar&.notifications&.last&.text&.include? template

View file

@ -12,7 +12,6 @@ module Domains
# Allow deletion
statuses.delete(DomainStatus::CLIENT_DELETE_PROHIBITED)
puts "Try to save domain: #{domain.name} with statuses: #{statuses}"
domain.save(validate: false)
end
end