Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update registered_organisations_schemes_controller.rb #599

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def search_organisation
result = Common::RegisteredOrganisationResponse.new(params[:ccs_org_id], hidden: access_to_hidden_identifiers).response_payload if params[:ccs_org_id]

if result.present?
render json: build_response(result), status: :ok
render json: result[0], status: :ok
else
render json: '', status: :not_found
end
Expand All @@ -26,12 +26,6 @@ def search_organisation_by_scheme
return result[:ccs_org_id] if result.present? && result[:ccs_org_id].present? && !result['hidden']
end

def build_response(result)
api_result = SearchApi.new(result[0][:identifier][:id], result[0][:identifier][:scheme], address_lookup: true).call
result[0][:address] = Common::AddressHelper.new(api_result).build_response
result[0]
end

def validate_params
return validate_scheme if params[:ccs_org_id].include? '-'

Expand Down