mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Ident attribute missing error message show cc or type #2677
This commit is contained in:
parent
eabbc2045c
commit
4b1bf92a27
3 changed files with 49 additions and 2 deletions
|
@ -94,12 +94,26 @@ class Epp::ContactsController < EppController
|
||||||
'postalInfo > addr > pc', 'postalInfo > addr > cc', 'voice', 'email'
|
'postalInfo > addr > pc', 'postalInfo > addr > cc', 'voice', 'email'
|
||||||
)
|
)
|
||||||
ident = params[:parsed_frame].css('ident')
|
ident = params[:parsed_frame].css('ident')
|
||||||
|
|
||||||
|
if ident.present? && ident.attr('type').blank?
|
||||||
|
epp_errors << {
|
||||||
|
code: '2003',
|
||||||
|
msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'type')
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
if ident.present? && ident.text != 'birthday' && ident.attr('cc').blank?
|
if ident.present? && ident.text != 'birthday' && ident.attr('cc').blank?
|
||||||
epp_errors << {
|
epp_errors << {
|
||||||
code: '2003',
|
code: '2003',
|
||||||
msg: I18n.t('errors.messages.required_attribute_missing', key: 'ident country code missing')
|
msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'cc')
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
# if ident.present? && ident.attr('cc').blank?
|
||||||
|
# epp_errors << {
|
||||||
|
# code: '2003',
|
||||||
|
# msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'cc')
|
||||||
|
# }
|
||||||
|
# end
|
||||||
contact_org_disabled
|
contact_org_disabled
|
||||||
fax_disabled
|
fax_disabled
|
||||||
status_editing_disabled
|
status_editing_disabled
|
||||||
|
|
|
@ -256,7 +256,7 @@ en:
|
||||||
invalid_type: 'PostalInfo type is invalid'
|
invalid_type: 'PostalInfo type is invalid'
|
||||||
unimplemented_command: 'Unimplemented command'
|
unimplemented_command: 'Unimplemented command'
|
||||||
domain_exists_but_belongs_to_other_registrar: 'Domain exists but belongs to other registrar'
|
domain_exists_but_belongs_to_other_registrar: 'Domain exists but belongs to other registrar'
|
||||||
required_attribute_missing: Required attributes missing
|
required_ident_attribute_missing: "Required ident attribute missing: %{key}"
|
||||||
|
|
||||||
code: 'Code'
|
code: 'Code'
|
||||||
value: 'Value'
|
value: 'Value'
|
||||||
|
|
|
@ -170,6 +170,14 @@ describe 'EPP Contact', epp: true do
|
||||||
Contact.last.code.should == 'FIRST0:ABC:ABC:12345'
|
Contact.last.code.should == 'FIRST0:ABC:ABC:12345'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should add registrar prefix for code when missing' do
|
||||||
|
response = create_request({ id: { value: 'abc:ABC:12345' } })
|
||||||
|
response[:msg].should == 'Command completed successfully'
|
||||||
|
response[:result_code].should == '1000'
|
||||||
|
|
||||||
|
Contact.last.code.should == 'FIRST0:ABC:ABC:12345'
|
||||||
|
end
|
||||||
|
|
||||||
it 'should not allow spaces in custom code' do
|
it 'should not allow spaces in custom code' do
|
||||||
response = create_request({ id: { value: 'abc 123' } })
|
response = create_request({ id: { value: 'abc 123' } })
|
||||||
response[:msg].should == 'is invalid [code]'
|
response[:msg].should == 'is invalid [code]'
|
||||||
|
@ -189,6 +197,31 @@ describe 'EPP Contact', epp: true do
|
||||||
response[:result_code].should == '2005'
|
response[:result_code].should == '2005'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should return country missing' do
|
||||||
|
extension = {
|
||||||
|
ident: {
|
||||||
|
value: '1990-22-12',
|
||||||
|
attrs: { type: 'birthday' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response = create_request({}, extension, validate_input: false)
|
||||||
|
response[:msg].should ==
|
||||||
|
'Required ident attribute missing: cc'
|
||||||
|
response[:result_code].should == '2003'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should return country missing' do
|
||||||
|
extension = {
|
||||||
|
ident: {
|
||||||
|
value: '1990-22-12'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response = create_request({}, extension, validate_input: false)
|
||||||
|
response[:msg].should ==
|
||||||
|
'Required ident attribute missing: type'
|
||||||
|
response[:result_code].should == '2003'
|
||||||
|
end
|
||||||
|
|
||||||
it 'should add registrar prefix for code when legacy prefix present' do
|
it 'should add registrar prefix for code when legacy prefix present' do
|
||||||
response = create_request({ id: { value: 'CID:FIRST0:abc:ABC:NEW:12345' } })
|
response = create_request({ id: { value: 'CID:FIRST0:abc:ABC:NEW:12345' } })
|
||||||
response[:msg].should == 'Command completed successfully'
|
response[:msg].should == 'Command completed successfully'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue