mirror of
https://github.com/internetee/registry.git
synced 2025-05-29 17:10:08 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
36e36cf616
2 changed files with 20 additions and 11 deletions
|
@ -12,6 +12,7 @@ module Epp::ContactsHelper
|
||||||
def update_contact
|
def update_contact
|
||||||
code = params_hash['epp']['command']['update']['update'][:id]
|
code = params_hash['epp']['command']['update']['update'][:id]
|
||||||
@contact = Contact.where(code: code).first
|
@contact = Contact.where(code: code).first
|
||||||
|
stamp @contact
|
||||||
if @contact.update_attributes(contact_and_address_attributes.delete_if { |k, v| v.nil? })
|
if @contact.update_attributes(contact_and_address_attributes.delete_if { |k, v| v.nil? })
|
||||||
render 'epp/contacts/update'
|
render 'epp/contacts/update'
|
||||||
else
|
else
|
||||||
|
@ -22,17 +23,15 @@ module Epp::ContactsHelper
|
||||||
def delete_contact
|
def delete_contact
|
||||||
ph = params_hash['epp']['command']['delete']['delete']
|
ph = params_hash['epp']['command']['delete']['delete']
|
||||||
|
|
||||||
begin
|
@contact = Contact.where(code: ph[:id]).first
|
||||||
@contact = Contact.where(code: ph[:id]).first
|
@contact.destroy
|
||||||
@contact.destroy
|
render '/epp/contacts/delete'
|
||||||
render '/epp/contacts/delete'
|
rescue NoMethodError => e
|
||||||
rescue NoMethodError => e
|
epp_errors << { code: '2303', msg: t('errors.messages.epp_obj_does_not_exist') }
|
||||||
epp_errors << { code: '2303', msg: t('errors.messages.epp_obj_does_not_exist') }
|
render '/epp/error'
|
||||||
render '/epp/error'
|
rescue
|
||||||
rescue
|
epp_errors << {code: '2400', msg: t('errors.messages.epp_command_failed')}
|
||||||
epp_errors << {code: '2400', msg: t('errors.messages.epp_command_failed')}
|
render '/epp/error'
|
||||||
render '/epp/error'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_contact
|
def check_contact
|
||||||
|
|
|
@ -29,6 +29,16 @@ describe 'EPP Contact', epp: true do
|
||||||
expect(Contact.count).to eq(1)
|
expect(Contact.count).to eq(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'stamps updated_by succesfully' do
|
||||||
|
Fabricate(:contact, code: 'sh8013')
|
||||||
|
|
||||||
|
expect(Contact.first.updated_by_id).to be nil
|
||||||
|
|
||||||
|
response = epp_request('contacts/update.xml')
|
||||||
|
|
||||||
|
expect(Contact.first.updated_by_id).to be 1
|
||||||
|
end
|
||||||
|
|
||||||
#TODO tests for missing/invalid/etc ident
|
#TODO tests for missing/invalid/etc ident
|
||||||
|
|
||||||
it 'deletes contact' do
|
it 'deletes contact' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue