Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
pwei1018 authored Dec 10, 2024
2 parents bfabaec + 3011a1c commit ac5148d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mhr-api/src/mhr_api/utils/registration_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions mhr-api/src/mhr_api/utils/validator_owner_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions ppr-api/devops/vaults.gcp.env
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ac5148d

Please sign in to comment.