Add experimental registrant change accept/deny API endpoint

This commit is contained in:
Karl Erik Õunapuu 2020-11-11 13:09:32 +02:00
parent 09389ea662
commit 377a95cc76
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 14 additions and 0 deletions

View file

@ -17,10 +17,23 @@ module Api
end end
def update def update
verification = RegistrantVerification.new(domain_id: @domain.id,
verification_token: confirmation_params[:token])
head(update_action(verification) ? :ok : :bad_request)
end end
private private
def update_action(verification)
initiator = "email link, #{t(:user_not_authenticated)}"
if params[:confirm].present?
verification.domain_registrant_change_confirm!(initiator)
else
verification.domain_registrant_change_reject!(initiator)
end
end
def serialized_registrant(registrant) def serialized_registrant(registrant)
{ {
name: registrant.try(:name), name: registrant.try(:name),

View file

@ -5,6 +5,7 @@ class RegistrantChange
end end
def confirm def confirm
Dispute.close_by_domain(@domain.name) if @domain.disputed?
notify_registrant notify_registrant
end end