diff --git a/app/controllers/repp/v1/contacts_controller.rb b/app/controllers/repp/v1/contacts_controller.rb index 70bf91297..1d2dbd441 100644 --- a/app/controllers/repp/v1/contacts_controller.rb +++ b/app/controllers/repp/v1/contacts_controller.rb @@ -1,7 +1,7 @@ module Repp module V1 class ContactsController < BaseController - before_action :find_contact, only: [:update] + before_action :find_contact, only: %i[show update] ## GET /repp/v1/contacts def index @@ -20,6 +20,24 @@ module Repp render(json: resp, status: :ok) end + ## GET /repp/v1/contacts/1 + def show + render(json: @contact.as_json, status: :ok) + end + + ## GET /repp/v1/contacts/check/1 + def check + contact = Epp::Contact.find_by(code: params[:id]) + + render json: { + code: 1000, message: I18n.t('epp.contacts.completed'), + data: { contact: { + id: params[:id], + available: contact.nil? + } } + }, status: :ok + end + ## POST /repp/v1/contacts def create @legal_doc = params[:legal_documents] diff --git a/config/routes.rb b/config/routes.rb index 5c518a533..634b40e31 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,7 +39,12 @@ Rails.application.routes.draw do namespace :repp do namespace :v1 do - resources :contacts + resources :contacts do + collection do + get 'check/:id', to: 'contacts#check' + end + end + resources :accounts do collection do get 'balance'