mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 15:06:23 +02:00
Allow update phone disclose situation with org registrations
This commit is contained in:
parent
5c70e9f38b
commit
9623b3e207
2 changed files with 15 additions and 1 deletions
|
@ -62,7 +62,7 @@ module Api
|
||||||
disclosed_attributes = reparsed_request_json[:disclosed_attributes]
|
disclosed_attributes = reparsed_request_json[:disclosed_attributes]
|
||||||
|
|
||||||
if disclosed_attributes
|
if disclosed_attributes
|
||||||
if disclosed_attributes.present? && contact.org?
|
if disclosed_attributes.present? && contact.org? && !disclosed_attributes.include?('phone')
|
||||||
error_msg = "Legal person's data is visible by default and cannot be concealed." \
|
error_msg = "Legal person's data is visible by default and cannot be concealed." \
|
||||||
' Please remove this parameter.'
|
' Please remove this parameter.'
|
||||||
render json: { errors: [{ disclosed_attributes: [error_msg] }] }, status: :bad_request
|
render json: { errors: [{ disclosed_attributes: [error_msg] }] }, status: :bad_request
|
||||||
|
|
|
@ -215,6 +215,20 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
||||||
JSON.parse(response.body, symbolize_names: true)
|
JSON.parse(response.body, symbolize_names: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_legal_persons_disclosed_attributes_change_when_phone
|
||||||
|
@contact = contacts(:acme_ltd)
|
||||||
|
@contact.update!(disclosed_attributes: %w[])
|
||||||
|
|
||||||
|
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||||
|
params: { disclosed_attributes: %w[phone] },
|
||||||
|
as: :json,
|
||||||
|
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||||
|
@contact.reload
|
||||||
|
|
||||||
|
assert_response :ok
|
||||||
|
assert_equal %w[phone], @contact.disclosed_attributes
|
||||||
|
end
|
||||||
|
|
||||||
def test_return_contact_details
|
def test_return_contact_details
|
||||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
||||||
as: :json,
|
as: :json,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue