diff --git a/app/interactions/actions/contact_create.rb b/app/interactions/actions/contact_create.rb index b6b2691aa..5c81a71bf 100644 --- a/app/interactions/actions/contact_create.rb +++ b/app/interactions/actions/contact_create.rb @@ -2,11 +2,6 @@ module Actions class ContactCreate attr_reader :contact, :legal_document, :ident, :result - REGISTERED = 'R'.freeze - LIQUIDATED = 'L'.freeze - BANKRUPT = 'N'.freeze - DELETED = 'K'.freeze - def initialize(contact, legal_document, ident) @contact = contact @legal_document = legal_document @@ -86,8 +81,14 @@ module Actions def maybe_company_is_relevant return true unless contact.org? + if contact.ident.blank? + contact.add_epp_error('2003', nil, 'ident', "#{I18n.t('errors.messages.required_ident_attribute_missing')}\n #{contact.inspect}") + @error = true + return + end + company_status = contact.return_company_status - return if [REGISTERED, LIQUIDATED].include? company_status + return if [Contact::REGISTERED, Contact::LIQUIDATED].include? company_status contact.add_epp_error('2003', nil, 'ident', I18n.t('errors.messages.company_not_registered')) @error = true