mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 15:14:47 +02:00
REPP: Domain Delete endpoint, port EPP Delete to Actions
This commit is contained in:
parent
99a1f1f489
commit
cdf2866434
4 changed files with 106 additions and 22 deletions
|
@ -2,8 +2,8 @@ require 'serializers/registrant_api/domain'
|
|||
module Repp
|
||||
module V1
|
||||
class DomainsController < BaseController
|
||||
before_action :set_authorized_domain, only: %i[transfer_info]
|
||||
before_action :forward_registrar_id, only: %i[create]
|
||||
before_action :set_authorized_domain, only: %i[transfer_info destroy]
|
||||
before_action :forward_registrar_id, only: %i[create destroy]
|
||||
before_action :set_domain, only: %i[show update]
|
||||
|
||||
api :GET, '/repp/v1/domains'
|
||||
|
@ -112,6 +112,20 @@ module Repp
|
|||
render_success(data: { success: @successful, failed: @errors })
|
||||
end
|
||||
|
||||
api :DELETE, '/repp/v1/domains/:domain_name'
|
||||
desc 'Delete specific domain'
|
||||
param :delete, Hash, required: true, desc: 'Object holding verified key' do
|
||||
param :verified, [true, false], required: true, desc: 'Whether to ask registrant verification or not'
|
||||
end
|
||||
def destroy
|
||||
action = Actions::DomainDelete.new(@domain, params, current_user.registrar)
|
||||
handle_errors(@domain) and return unless action.call
|
||||
|
||||
render_success(data: { domain: { name: @domain.name }})
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def initiate_transfer(transfer)
|
||||
domain = Epp::Domain.find_or_initialize_by(name: transfer[:domain_name])
|
||||
action = Actions::DomainTransfer.new(domain, transfer[:transfer_code],
|
||||
|
@ -125,8 +139,6 @@ module Repp
|
|||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def transfer_params
|
||||
params.require(:data).require(:domain_transfers).each do |t|
|
||||
t.require(:domain_name)
|
||||
|
@ -156,7 +168,7 @@ module Repp
|
|||
@epp_errors ||= []
|
||||
h = {}
|
||||
h[transfer_info_params[:id].match?(/\A[0-9]+\z/) ? :id : :name] = transfer_info_params[:id]
|
||||
@domain = Domain.find_by!(h)
|
||||
@domain = Epp::Domain.find_by!(h)
|
||||
|
||||
validate_registrar_authorization
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue