diff --git a/mhr-api/src/mhr_api/utils/registration_validator.py b/mhr-api/src/mhr_api/utils/registration_validator.py index 38ec21aa5..88ed4aaba 100644 --- a/mhr-api/src/mhr_api/utils/registration_validator.py +++ b/mhr-api/src/mhr_api/utils/registration_validator.py @@ -471,9 +471,13 @@ def validate_transfer_non_staff(registration: MhrRegistration, json_data, reg_ty json_data.get("deleteOwnerGroups") and len(json_data.get("deleteOwnerGroups")) != 1 and group == QUALIFIED_USER_GROUP - and len(json_data.get("deleteOwnerGroups")) != validator_owner_utils.get_existing_group_count(registration) ): - error_msg += TRAN_QUALIFIED_DELETE + if validator_owner_utils.get_delete_group_count( + registration, json_data + ) != 1 and validator_owner_utils.get_existing_group_count(registration) != len( + json_data.get("deleteOwnerGroups") + ): + error_msg += TRAN_QUALIFIED_DELETE error_msg += validate_transfer_dealer(registration, json_data, reg_type, group) if json_data.get("transferDocumentType"): error_msg += TRANS_DOC_TYPE_NOT_ALLOWED diff --git a/mhr-api/src/mhr_api/utils/validator_owner_utils.py b/mhr-api/src/mhr_api/utils/validator_owner_utils.py index 1571cdb89..78052f42a 100644 --- a/mhr-api/src/mhr_api/utils/validator_owner_utils.py +++ b/mhr-api/src/mhr_api/utils/validator_owner_utils.py @@ -662,6 +662,23 @@ def get_death_group_count(registration: MhrRegistration, json_data: dict) -> int return add_count - edit_count +def get_delete_group_count(registration: MhrRegistration, json_data: dict) -> int: + """Transfer non-staff registration get deleted group count ignoring owner edits.""" + del_count: int = len(json_data.get("deleteOwnerGroups")) + if del_count == 1: + return 1 + # Ignore groups with valid owner edits. + edit_count: int = 0 + for group in json_data.get("addOwnerGroups"): + if is_edit_group(registration, group): + edit_count += 1 + if edit_count == 0: + return del_count + if del_count - edit_count == 0: + return 1 + return del_count - edit_count + + def get_death_add_group(json_data: dict) -> dict: """Transfer death registration get single added group ignoring owner edits.""" if len(json_data.get("addOwnerGroups")) == 1: diff --git a/ppr-api/devops/vaults.gcp.env b/ppr-api/devops/vaults.gcp.env index 0da605ed4..001e9f80a 100644 --- a/ppr-api/devops/vaults.gcp.env +++ b/ppr-api/devops/vaults.gcp.env @@ -37,6 +37,8 @@ GCP_PS_VERIFICATION_REPORT_TOPIC="op://ppr/$APP_ENV/ppr-api/GCP_PS_VERIFICATION_ GCP_PS_REGISTRATION_REPORT_TOPIC="op://ppr/$APP_ENV/ppr-api/GCP_PS_REGISTRATION_REPORT_TOPIC" GATEWAY_URL="op://ppr/$APP_ENV/ppr-api/GATEWAY_URL" SUBSCRIPTION_API_KEY="op://ppr/$APP_ENV/ppr-api/SUBSCRIPTION_API_KEY" +ACCOUNT_REGISTRATIONS_MAX_RESULTS="op://ppr/$APP_ENV/ppr-api/ACCOUNT_REGISTRATIONS_MAX_RESULTS" +REPORT_SEARCH_LIGHT="op://ppr/$APP_ENV/ppr-api/REPORT_SEARCH_LIGHT" MAX_SIZE_SEARCH_RT="op://ppr/$APP_ENV/ppr-api/MAX_SIZE_SEARCH_RT" GATEWAY_API_KEY="op://ppr/$APP_ENV/ppr-api/GATEWAY_API_KEY" ACCOUNT_REGISTRATIONS_MAX_RESULTS="op://ppr/$APP_ENV/ppr-api/ACCOUNT_REGISTRATIONS_MAX_RESULTS"