Skip to content

Commit

Permalink
Merge pull request #598 from Crown-Commercial-Service/add-address-bac…
Browse files Browse the repository at this point in the history
…k-in-temporarily

Update registered_organisations_schemes_controller.rb
  • Loading branch information
tberey authored Jul 4, 2023
2 parents a83b3a5 + 1af9455 commit d781f94
Showing 1 changed file with 7 additions and 1 deletion.
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: result[0], status: :ok
render json: build_response(result), status: :ok
else
render json: '', status: :not_found
end
Expand All @@ -26,6 +26,12 @@ 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

0 comments on commit d781f94

Please sign in to comment.