diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index 9a9e77c84..ef5f81986 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -59,7 +59,7 @@ class Epp::ContactsController < EppController end def find_contact - code = params[:parsed_frame].css('id').text.strip.upcase.sub(/^CID:/, '') + code = params[:parsed_frame].css('id').text.strip.upcase @contact = Epp::Contact.find_by_epp_code(code) diff --git a/app/models/contact.rb b/app/models/contact.rb index 9ad8a1223..9dc79e1df 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -118,7 +118,6 @@ class Contact < ActiveRecord::Base # custom code from client # add prefix when needed if code.present? - code.sub!(/^CID:/, '') prefix, *custom_code = code.split(':') code = custom_code.join(':') if prefix == registrar.code end diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 9edbdc70f..64927dc74 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -8,7 +8,8 @@ class Epp::Contact < Contact class << self # support legacy search def find_by_epp_code(code) - find_by(code: code.sub(/^CID:/, '')) + # find_by(code: code.sub(/^CID:/, '')) # legacy support turned off + find_by(code: code) end # rubocop: disable Metrics/PerceivedComplexity diff --git a/spec/epp/contact_spec.rb b/spec/epp/contact_spec.rb index fa6696795..88a73712f 100644 --- a/spec/epp/contact_spec.rb +++ b/spec/epp/contact_spec.rb @@ -164,12 +164,12 @@ describe 'EPP Contact', epp: true do response[:result_code].should == '2005' end - it 'should not 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[:msg].should == 'Command completed successfully' response[:result_code].should == '1000' - Contact.last.code.should == 'FIRST0:ABC:ABC:NEW:12345' + Contact.last.code.should == 'FIRST0:CID:FIRST0:ABC:ABC:NEW:12345' end it 'should not remove suffix CID' do @@ -177,7 +177,7 @@ describe 'EPP Contact', epp: true do response[:msg].should == 'Command completed successfully' response[:result_code].should == '1000' - Contact.last.code.should == 'FIRST0:ABC:CID:ABC:NEW:12345' + Contact.last.code.should == 'FIRST0:CID:FIRST0:ABC:CID:ABC:NEW:12345' end it 'should not add registrar prefix for code when prefix present' do @@ -802,10 +802,10 @@ describe 'EPP Contact', epp: true do ids = response[:parsed].css('resData chkData id') ids[0].text.should == 'FIXED:CHECK-LEGACY' - ids[1].text.should == 'FIXED:CHECK-LEGACY' + ids[1].text.should == 'CID:FIXED:CHECK-LEGACY' ids[0].attributes['avail'].text.should == '0' - ids[1].attributes['avail'].text.should == '0' + ids[1].attributes['avail'].text.should == '1' end end @@ -847,10 +847,10 @@ describe 'EPP Contact', epp: true do contact.css('name').first.text.should == 'Johnny Awesome' end - it 'should honour legacy CID format' do - Fabricate(:contact, code: 'INFO-5555', name: 'Johnny Awesome') + it 'should add legacy CID format as append' do + Fabricate(:contact, code: 'CID:FIXED:INFO-5555', name: 'Johnny Awesome') - response = info_request({ id: { value: 'CID:FIXED:INFO-5555' } }) + response = info_request({ id: { value: 'FIXED:CID:FIXED:INFO-5555' } }) response[:msg].should == 'Command completed successfully' response[:result_code].should == '1000' diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 57fae70f7..9aace945f 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -1378,34 +1378,6 @@ describe 'EPP Domain', epp: true do d.auth_info.should == existing_pw end - it 'updates a domain with legacy CID format' do - existing_pw = domain.auth_info - - xml_params = { - name: { value: domain.name }, - chg: [ - registrant: { value: 'CID:FIXED:CITIZEN_1234' } - ] - } - - response = epp_plain_request(domain_update_xml(xml_params, {}, { - _anonymus: [ - legalDocument: { - value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==', - attrs: { type: 'pdf' } - } - ] - }), :xml) - - response[:results][0][:msg].should == 'Command completed successfully' - response[:results][0][:result_code].should == '1000' - - d = Domain.last - - d.registrant_code.should == 'FIXED:CITIZEN_1234' - d.auth_info.should == existing_pw - end - it 'updates domain and adds objects' do xml = domain_update_xml({ name: { value: domain.name },