Skip to content

Commit

Permalink
Merge pull request #2063 from flutistar/24056-api-qs-dealer-unrestric…
Browse files Browse the repository at this point in the history
…tions

API: Updated validation for home dealers
  • Loading branch information
flutistar authored Nov 13, 2024
2 parents 23ee709 + a0885eb commit 433af23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion mhr-api/src/mhr_api/utils/registration_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,13 @@ def validate_permit(
)
if registration and group_name and group_name == MANUFACTURER_GROUP:
error_msg += validate_manufacturer_permit(registration.mhr_number, json_data, current_location)
# When the group name is DEALERSHIP_GROUP, json_data["qsLocation"] is qualified supplier json.
qs = json_data.get("qsLocation", {})
if (
registration
and group_name
and group_name == DEALERSHIP_GROUP
and qs.get("confirmRequirements", False) == False
and current_location
and current_location.get("locationType", "") != MhrLocationTypes.MANUFACTURER
):
Expand Down Expand Up @@ -912,7 +915,8 @@ def validate_transfer_dealer(registration: MhrRegistration, json_data, reg_type:
if not json_data.get("supplier"):
error_msg += QS_DEALER_INVALID
return error_msg
if not validator_utils.is_valid_dealer_transfer_owner(registration, json_data.get("supplier")):
qs: dict = json_data.get("supplier")
if qs.get("confirmRequirements", False) == False and not validator_utils.is_valid_dealer_transfer_owner(registration, qs):
error_msg += DEALER_TRANSFER_OWNER_INVALID
if json_data.get("supplier"): # Added just for this validation.
del json_data["supplier"]
Expand Down
4 changes: 2 additions & 2 deletions mhr-api/tests/unit/utils/test_transfer_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@
TEST_DATA_DEALER = [
('Invalid no QS info', False, None, 'PS12345', '000915', False, validator.QS_DEALER_INVALID),
('Invalid doc type', False, 'TRANS_LAND_TITLE', 'PS12345', '000915', True, validator.TRANS_DEALER_DOC_TYPE_INVALID),
('Invalid existing owner SOLE', False, None, 'PS12345', '000915', True, validator.DEALER_TRANSFER_OWNER_INVALID),
('Invalid existing owner JOINT', False, None, 'PS12345', '000920', True, validator.DEALER_TRANSFER_OWNER_INVALID),
# ('Invalid existing owner SOLE', False, None, 'PS12345', '000915', True, validator.DEALER_TRANSFER_OWNER_INVALID),
# ('Invalid existing owner JOINT', False, None, 'PS12345', '000920', True, validator.DEALER_TRANSFER_OWNER_INVALID),
('Valid', True, None, 'PS12345', '000902', True, None)
]

Expand Down

0 comments on commit 433af23

Please sign in to comment.