mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Merge pull request #2081 from internetee/1796-contact-birthday-field-validation
Fix for contact birth date validation
This commit is contained in:
commit
fc338dea16
4 changed files with 98 additions and 8 deletions
|
@ -13,20 +13,22 @@ class Contact::Ident
|
|||
validates :type, presence: true, inclusion: { in: proc { types } }
|
||||
validates :country_code, presence: true, iso31661_alpha2: true
|
||||
validates_with MismatchValidator
|
||||
validates_with BirthDateValidator, if: :birthday?
|
||||
|
||||
def self.epp_code_map
|
||||
{
|
||||
'2003' => [
|
||||
[:code, :blank],
|
||||
[:type, :blank],
|
||||
[:country_code, :blank]
|
||||
%i[code blank],
|
||||
%i[type blank],
|
||||
%i[country_code blank],
|
||||
],
|
||||
'2005' => [
|
||||
[:base, :mismatch],
|
||||
[:code, :invalid_national_id],
|
||||
[:code, :invalid_reg_no],
|
||||
[:code, :invalid_iso8601_date],
|
||||
[:country_code, :invalid_iso31661_alpha2]
|
||||
%i[base mismatch],
|
||||
%i[code invalid_national_id],
|
||||
%i[code invalid_reg_no],
|
||||
%i[code invalid_iso8601_date],
|
||||
%i[code invalid_birth_date],
|
||||
%i[country_code invalid_iso31661_alpha2],
|
||||
]
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue