Merge branch '111601356-ident_type_validation' into staging

This commit is contained in:
Stas 2016-05-25 17:37:08 +03:00
commit 759b6b7248
3 changed files with 7 additions and 2 deletions

View file

@ -33,7 +33,7 @@ class Contact < ActiveRecord::Base
uniqueness: { message: :epp_id_taken }, uniqueness: { message: :epp_id_taken },
format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid }, format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid },
length: { maximum: 100, message: :too_long_contact_code } length: { maximum: 100, message: :too_long_contact_code }
validates :ident_type, inclusion: {in: %w( org priv birthday), message: :invalid} validates :ident_type, inclusion: {in: %w( org priv birthday), message: :ident_type_invalid}
validate :val_ident_valid_format? validate :val_ident_valid_format?
validate :uniq_statuses? validate :uniq_statuses?
validate :validate_html validate :validate_html

View file

@ -126,13 +126,15 @@ class Epp::Contact < Contact
[:ident, :invalid_birthday_format], [:ident, :invalid_birthday_format],
[:ident, :invalid_country_code], [:ident, :invalid_country_code],
[:ident_type, :missing], [:ident_type, :missing],
[:ident_type, :invalid],
[:code, :invalid], [:code, :invalid],
[:code, :too_long_contact_code] [:code, :too_long_contact_code]
], ],
'2302' => [ # Object exists '2302' => [ # Object exists
[:code, :epp_id_taken] [:code, :epp_id_taken]
], ],
'2304' => [ # Object status prohibits operation
[:ident_type, :epp_ident_type_invalid, { value: { obj: 'code', val: code } }]
],
'2305' => [ # Association exists '2305' => [ # Association exists
[:domains, :exist] [:domains, :exist]
], ],

View file

@ -52,6 +52,9 @@ en:
invalid_EE_identity_format_update: "Ident not in valid Estonian identity format. Please create new contact" invalid_EE_identity_format_update: "Ident not in valid Estonian identity format. Please create new contact"
invalid_birthday_format: "Ident not in valid birthady format, should be YYYY-MM-DD" invalid_birthday_format: "Ident not in valid birthady format, should be YYYY-MM-DD"
invalid_country_code: "Ident country code is not valid, should be in ISO_3166-1 alpha 2 format" invalid_country_code: "Ident country code is not valid, should be in ISO_3166-1 alpha 2 format"
ident_type:
ident_type_invalid: 'Ident type is invalid'
epp_ident_type_invalid: 'Object status prohibits operation: ident_type of contact %{code} is invalid'
domains: domains:
exist: 'Object association prohibits operation' exist: 'Object association prohibits operation'
statuses: statuses: