Add disputing logic for EPP

This commit is contained in:
Karl Erik Õunapuu 2020-04-24 16:04:58 +03:00
parent 7a7b2f9881
commit 0f2a290d64
17 changed files with 626 additions and 325 deletions

View file

@ -28,9 +28,8 @@ module Admin
# POST /admin/disputes
def create
@dispute = Dispute.new(dispute_params)
if @dispute.save
redirect_to @dispute, notice: 'Dispute was successfully created.'
redirect_to admin_disputes_url, notice: 'Dispute was successfully created.'
else
render :new
end
@ -39,16 +38,16 @@ module Admin
# PATCH/PUT /admin/disputes/1
def update
if @dispute.update(dispute_params)
redirect_to @dispute, notice: 'Dispute was successfully updated.'
redirect_to admin_disputes_url, notice: 'Dispute was successfully updated.'
else
render :edit
end
end
# DELETE /admin/disputes/1
def destroy
def delete
@dispute.destroy
redirect_to disputes_url, notice: 'Dispute was successfully destroyed.'
redirect_to admin_disputes_url, notice: 'Dispute was successfully destroyed.'
end
private
@ -60,7 +59,7 @@ module Admin
# Only allow a trusted parameter "white list" through.
def dispute_params
params.require(:dispute).permit(:domain_name, :password, :expires_at, :comment, :created_at)
params.require(:dispute).permit(:domain_name, :password, :starts_at, :comment)
end
end
end

View file

@ -104,6 +104,10 @@ module Epp
authorize! :update, @domain, @password
if @domain.update(params[:parsed_frame], current_user)
if @domain.disputed?
dispute = Dispute.active.find_by(domain_name: @domain.name)
dispute.close
end
if @domain.epp_pending_update.present?
render_epp_response '/epp/domains/success_pending'
else

View file

@ -31,6 +31,12 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
end
elsif params[:confirmed]
if @registrant_verification.domain_registrant_change_confirm!("email link, #{initiator}")
if @domain.disputed?
Rails.logger.info 'Closing domain dispute via RegistrantConfirmation'
dispute = Dispute.active.find_by(domain_name: @domain.name)
dispute.close
end
flash[:notice] = t(:registrant_domain_verification_confirmed)
redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true)
else