diff --git a/src/registry_schemas/schemas/mhr/adminRegistration.json b/src/registry_schemas/schemas/mhr/adminRegistration.json index 44b921f..33d3be1 100644 --- a/src/registry_schemas/schemas/mhr/adminRegistration.json +++ b/src/registry_schemas/schemas/mhr/adminRegistration.json @@ -29,7 +29,7 @@ "registrationType": { "type": "string", "maxLength": 20, - "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "MHREG_CONVERSION", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL", "REG_STAFF_ADMIN"] + "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "MHREG_CONVERSION", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL", "REG_STAFF_ADMIN", "AMENDMENT"] }, "clientReferenceId": { "type": [ "string", "null" ], @@ -52,7 +52,7 @@ "documentType": { "type": "string", "maxLength": 20 , - "enum": ["ADDI", "ATTA", "COMP", "CONF", "COUR", "DNCH", "EXRE", "FZE", "INTE", "INTW", "MAID", "MAIL", "MARR", "MEAM", "NAMV", "NCAN", "NRED", "PDEC", "PUBA", "REBU", "REGC", "STAT", "THAW", "WHAL"] + "enum": ["ADDI", "ATTA", "COMP", "CONF", "COUR", "DNCH", "EXRE", "FZE", "INTE", "INTW", "MAID", "MAIL", "MARR", "MEAM", "NAMV", "NCAN", "NRED", "PDEC", "PUBA", "REBU", "REGC", "STAT", "THAW", "WHAL", "AMEND_PERMIT", "CANCEL_PERMIT"] }, "updateDocumentId": { "type": [ "string", "null" ], diff --git a/src/registry_schemas/schemas/mhr/noteRegistration.json b/src/registry_schemas/schemas/mhr/noteRegistration.json index 73901cb..2c64d29 100644 --- a/src/registry_schemas/schemas/mhr/noteRegistration.json +++ b/src/registry_schemas/schemas/mhr/noteRegistration.json @@ -13,7 +13,7 @@ "registrationType": { "type": "string", "maxLength": 20, - "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "MHREG_CONVERSION", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL", "REG_STAFF_ADMIN"] + "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "MHREG_CONVERSION", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL", "REG_STAFF_ADMIN", "AMENDMENT"] }, "clientReferenceId": { "type": [ "string", "null" ], diff --git a/src/registry_schemas/schemas/mhr/registration.json b/src/registry_schemas/schemas/mhr/registration.json index d3f97f8..a086eea 100644 --- a/src/registry_schemas/schemas/mhr/registration.json +++ b/src/registry_schemas/schemas/mhr/registration.json @@ -34,7 +34,7 @@ "registrationType": { "type": "string", "maxLength": 20, - "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "MHREG_CONVERSION", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL", "REG_STAFF_ADMIN"] + "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "MHREG_CONVERSION", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL", "REG_STAFF_ADMIN", "AMENDMENT"] }, "status": { "type": [ "string", "null" ], @@ -103,6 +103,27 @@ "maxLength": 20, "description": "If the status is FROZEN, frozenDocumentType is conditionally included in the response as the document type of the registration that put the home in a frozen or locked state." }, + "permitStatus": { + "type": "string", + "maxLength": 20, + "enum": ["ACTIVE", "EXPIRED", "CANCELLED"], + "description": "The status of the most recent transport permit registration." + }, + "permitRegistrationNumber": { + "type": "string", + "maxLength": 8, + "description": "The document registration number of the most recent transport permit registration." + }, + "permitDateTime": { + "type": "string", + "format": "date-time", + "description": "The timestamp of the most recent transport permit registration." + }, + "permitExpiryDateTime": { + "type": "string", + "format": "date-time", + "description": "The expiry timestamp of the most recent transport permit registration." + }, "payment": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/common/paymentReference" } diff --git a/src/registry_schemas/schemas/mhr/registrationSummary.json b/src/registry_schemas/schemas/mhr/registrationSummary.json index ed9ca8d..4805d93 100644 --- a/src/registry_schemas/schemas/mhr/registrationSummary.json +++ b/src/registry_schemas/schemas/mhr/registrationSummary.json @@ -74,7 +74,7 @@ "registrationType": { "type": "string", "maxLength": 20, - "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "MHREG_CONVERSION", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL", "REG_STAFF_ADMIN"] + "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "MHREG_CONVERSION", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL", "REG_STAFF_ADMIN", "AMENDMENT"] }, "hasCaution": { "type": "boolean", diff --git a/src/registry_schemas/schemas/mhr/transportPermit.json b/src/registry_schemas/schemas/mhr/transportPermit.json index 218813e..3f3794d 100644 --- a/src/registry_schemas/schemas/mhr/transportPermit.json +++ b/src/registry_schemas/schemas/mhr/transportPermit.json @@ -34,7 +34,7 @@ "registrationType": { "type": "string", "maxLength": 20, - "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND"] + "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "MHREG_CONVERSION", "AMENDMENT"] }, "clientReferenceId": { "type": [ "string", "null" ], @@ -67,6 +67,10 @@ "type": "boolean", "description": "Set to true if either the new location type is MH_PARK and the move is not within the same park, or the new location type is STRATA, RESERVE, or OTHER." }, + "amendment": { + "type": "boolean", + "description": "True if the registration amends an existing transport permit location." + }, "payment": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/common/paymentReference" } diff --git a/src/registry_schemas/version.py b/src/registry_schemas/version.py index 5e25081..1cb5543 100644 --- a/src/registry_schemas/version.py +++ b/src/registry_schemas/version.py @@ -22,4 +22,4 @@ Development release segment: .devN """ -__version__ = '1.8.7' # pylint: disable=invalid-name +__version__ = '1.8.8' # pylint: disable=invalid-name diff --git a/tests/unit/mhr/test_admin_registration.py b/tests/unit/mhr/test_admin_registration.py index 57ceb93..e07ecd7 100644 --- a/tests/unit/mhr/test_admin_registration.py +++ b/tests/unit/mhr/test_admin_registration.py @@ -28,6 +28,8 @@ ('Valid request NCAN', True, 'NCAN', True, True, None, None), ('Valid request REGC', True, 'REGC', True, True, None, None), ('Valid request STAT', True, 'STAT', True, True, None, None), + ('Valid request CANCEL_PERMIT', True, 'CANCEL_PERMIT', True, True, None, None), + ('Valid response CANCEL_PERMIT', True, 'CANCEL_PERMIT', True, True, None, None), ('Valid response', True, 'THAW', True, False, '1234', 'JOHN SMITH'), ('Invalid client ref', False, 'NRED', True, True, LONG_CLIENT_REF, None), ('Invalid attention', False, 'EXRE', True, True, None, LONG_CLIENT_REF), @@ -63,8 +65,12 @@ def test_note_registration(desc, valid, doc_type, has_sub, is_request, client_re del data['registrationType'] if desc == 'Invalid update doc id': data['updateDocumentId'] = '123456789' - elif desc in ('Valid request REGC', 'Valid request STAT'): + elif desc in ('Valid request REGC', 'Valid request STAT', + 'Valid request CANCEL_PERMIT', 'Valid response CANCEL_PERMIT'): data['location'] = copy.deepcopy(LOCATION) + if desc in ('Valid request CANCEL_PERMIT', 'Valid response CANCEL_PERMIT'): + data['documentType'] = 'CANCEL_PERMIT' + data['registrationType'] = 'REG_STAFF_ADMIN' is_valid, errors = validate(data, 'adminRegistration', 'mhr') if errors: diff --git a/tests/unit/mhr/test_registration.py b/tests/unit/mhr/test_registration.py index cf42030..87e1173 100644 --- a/tests/unit/mhr/test_registration.py +++ b/tests/unit/mhr/test_registration.py @@ -64,6 +64,7 @@ LONG_CLIENT_REF = '012345678901234567890123456789012345678901234567890' LONG_ATTENTION_REF = LONG_CLIENT_REF +TEST_TS = '2024-01-31T08:00:00+00:00' # testdata pattern is ({desc},{valid},{mhr},{status},{rev},{decv},{haso},{hasl},{hasd},{hasn},{hasdt},{hasp}) TEST_DATA_REG = [ @@ -136,6 +137,14 @@ ('Invalid data type int', False, 20), ('Invalid data type str', False, 'junk') ] +# testdata pattern is ({desc}, {valid}, {status}, {reg_num}) +TEST_DATA_PERMIT = [ + ('Valid', True, 'ACTIVE', '88888888'), + ('Valid expired', True, 'ACTIVE', '88888888'), + ('Valid cancelled', True, 'ACTIVE', '88888888'), + ('Invalid status', False, 'JUNK', '88888888'), + ('Invalid reg number', False, 'ACTIVE', '888888889') +] @pytest.mark.parametrize('desc,valid,mhr,status,ref,decv,haso,hasl,hasd,hasn,hasdt,hasp', TEST_DATA_REG) @@ -246,3 +255,19 @@ def test_registration_own_land(desc, valid, value): assert is_valid else: assert not is_valid + + +@pytest.mark.parametrize('desc,valid,status,reg_num', TEST_DATA_PERMIT) +def test_registration_permit(desc, valid, status, reg_num): + """Assert that the schema is performing as expected.""" + data = copy.deepcopy(REGISTRATION) + data['permitStatus'] = status + data['permitRegistrationNumber'] = reg_num + data['permitDateTime'] = TEST_TS + data['permitExpiryDateTime'] = TEST_TS + is_valid, errors = validate(data, 'registration', 'mhr') + + if valid: + assert is_valid + else: + assert not is_valid diff --git a/tests/unit/mhr/test_transport_permit.py b/tests/unit/mhr/test_transport_permit.py index b3b63d8..096582d 100644 --- a/tests/unit/mhr/test_transport_permit.py +++ b/tests/unit/mhr/test_transport_permit.py @@ -24,6 +24,8 @@ # testdata pattern is ({desc},{valid},{sub_party},{new},{is_request},{client_ref}) TEST_DATA = [ ('Valid request', True, True, True, True, None), + ('Valid amendment request', True, True, True, True, None), + ('Valid amendment response', True, True, True, True, None), ('Valid response', True, True, True, False, '1234'), ('Invalid client ref', False, True, True, True, LONG_CLIENT_REF), ('Invalid missing sub party', False, False, True, True, '1234'), @@ -35,6 +37,11 @@ def test_permit(desc, valid, sub_party, new, is_request, client_ref): """Assert that the schema is performing as expected.""" data = copy.deepcopy(PERMIT) + if desc == 'Valid amendment request': + data['amendment'] = True + elif desc == 'Valid amendment response': + data['amendment'] = True + data['registrationType'] = 'AMENDMENT' if not sub_party: del data['submittingParty'] if client_ref: