mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
Added ident country code error #2590
This commit is contained in:
parent
f5feba0509
commit
4448284680
5 changed files with 24 additions and 5 deletions
|
@ -181,7 +181,7 @@ class Contact < ActiveRecord::Base
|
|||
if code
|
||||
self.ident_country_code = code.alpha2
|
||||
else
|
||||
errors.add(:ident_country_code, 'is not following ISO_3166-1 alpha 2 format')
|
||||
errors.add(:ident, :invalid_country_code)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -123,7 +123,8 @@ class Epp::Contact < Contact
|
|||
[:email, :invalid],
|
||||
[:ident, :invalid],
|
||||
[:ident, :invalid_EE_identity_format],
|
||||
[:ident, :invalid_birthday_format]
|
||||
[:ident, :invalid_birthday_format],
|
||||
[:ident, :invalid_country_code]
|
||||
],
|
||||
'2302' => [ # Object exists
|
||||
[:code, :epp_id_taken]
|
||||
|
|
|
@ -48,6 +48,7 @@ en:
|
|||
blank: "Required parameter missing - ident"
|
||||
invalid_EE_identity_format: "Ident not in valid Estonian identity format."
|
||||
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"
|
||||
domains:
|
||||
exist: 'Object association prohibits operation'
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ describe 'EPP Contact', epp: true do
|
|||
log.api_user_registrar.should == 'registrar1'
|
||||
end
|
||||
|
||||
it 'successfully saves ident type' do
|
||||
it 'successfully saves ident type with legal document' do
|
||||
extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
|
@ -116,7 +116,9 @@ describe 'EPP Contact', epp: true do
|
|||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.ident_type.should == 'birthday'
|
||||
@contact = Contact.last
|
||||
@contact.ident_type.should == 'birthday'
|
||||
@contact.legal_documents.size.should == 1
|
||||
end
|
||||
|
||||
it 'successfully adds registrar' do
|
||||
|
@ -164,6 +166,19 @@ describe 'EPP Contact', epp: true do
|
|||
response[:result_code].should == '2005'
|
||||
end
|
||||
|
||||
it 'should not saves ident type with wrong country code' do
|
||||
extension = {
|
||||
ident: {
|
||||
value: '1990-22-12',
|
||||
attrs: { type: 'birthday', cc: 'WRONG' }
|
||||
}
|
||||
}
|
||||
response = create_request({}, extension)
|
||||
response[:msg].should ==
|
||||
'Ident country code is not valid, should be in ISO_3166-1 alpha 2 format [ident]'
|
||||
response[:result_code].should == '2005'
|
||||
end
|
||||
|
||||
it 'should add registrar prefix for code when legacy prefix present' do
|
||||
response = create_request({ id: { value: 'CID:FIRST0:abc:ABC:NEW:12345' } })
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
|
|
|
@ -73,11 +73,13 @@ describe Contact do
|
|||
end
|
||||
|
||||
it 'should require valid country code' do
|
||||
@contact.ident = '123'
|
||||
@contact.ident_type = 'bic'
|
||||
@contact.ident_country_code = 'INVALID'
|
||||
@contact.valid?
|
||||
|
||||
@contact.errors[:ident_country_code].should == ['is not following ISO_3166-1 alpha 2 format']
|
||||
@contact.errors[:ident].should ==
|
||||
['Ident country code is not valid, should be in ISO_3166-1 alpha 2 format']
|
||||
end
|
||||
|
||||
it 'should convert to alpha2 country code' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue