From a9ea8584ba6cad9e40fae84e7eb5ab40e57a0375 Mon Sep 17 00:00:00 2001 From: Doug Lovett Date: Tue, 14 Mar 2023 17:17:48 -0700 Subject: [PATCH] PPR transition registration updates. (#45) * PPR transition registration updates. Signed-off-by: Doug Lovett * PPR update searchQuery ind debtor name lengths. Signed-off-by: Doug Lovett --------- Signed-off-by: Doug Lovett --- .../schemas/ppr/financingStatement.json | 15 ++++++++++++- .../schemas/ppr/searchQuery.json | 6 +++--- src/registry_schemas/version.py | 2 +- tests/unit/ppr/test_financing_statement.py | 21 ++++++++++++++++++- tests/unit/ppr/test_search_query.py | 6 +++--- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/registry_schemas/schemas/ppr/financingStatement.json b/src/registry_schemas/schemas/ppr/financingStatement.json index 5250b8a..a947dc5 100644 --- a/src/registry_schemas/schemas/ppr/financingStatement.json +++ b/src/registry_schemas/schemas/ppr/financingStatement.json @@ -9,7 +9,7 @@ "type": "string", "maxLength": 2, "enum": ["SA", "RL", "FR", "LT", "MH", "SG", "FL", "FA", "FS", "MR", "CC", "CT", "DP", "ET", "FO", "FT", "HR", "IP", "LO", "MI", "OT" - , "PG", "PS", "IT", "RA", "SS", "TL", "HN", "ML", "MN", "PN", "WL", "TF", "TA", "TG", "TM", "TO", "SV", "MD", "PT", "SC"], + , "PG", "PS", "IT", "RA", "SS", "TL", "HN", "ML", "MN", "PN", "WL", "TF", "TA", "TG", "TM", "MD", "PT", "SC", "TO", "SV"], "description": "Specifies the type of Financing Statement. Includes all legacy registration types." }, "clientReferenceId": { @@ -122,6 +122,19 @@ "courtOrderInformation": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/ppr/courtOrder" }, + "transitionDescription": { + "type": "string", + "description": "For transition registrations, the description of the previous registration. Conditionally included in a response." + }, + "transitionDate": { + "type": "string", + "format": "date-time", + "description": "For transition registrations, the date of the previous registration. Conditionally included in a response." + }, + "transitionNumber": { + "type": "string", + "description": "For transition registrations, the identifier of the previous registration. Conditionally included in a response." + }, "payment": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/common/paymentReference" } diff --git a/src/registry_schemas/schemas/ppr/searchQuery.json b/src/registry_schemas/schemas/ppr/searchQuery.json index b86e78e..1a4080a 100644 --- a/src/registry_schemas/schemas/ppr/searchQuery.json +++ b/src/registry_schemas/schemas/ppr/searchQuery.json @@ -9,17 +9,17 @@ "properties": { "first": { "type": "string", - "maxLength": 30, + "maxLength": 50, "description": "First name of debtor if search type is INDIVIDUAL_DEBTOR." }, "second": { "type": "string", - "maxLength": 30, + "maxLength": 50, "description": "Second/middle name or initial of debtor if search type is INDIVIDUAL_DEBTOR." }, "last": { "type": "string", - "maxLength": 30, + "maxLength": 50, "description": "Last name of debtor if search type is INDIVIDUAL_DEBTOR." }, "business": { diff --git a/src/registry_schemas/version.py b/src/registry_schemas/version.py index d60de70..eacc169 100644 --- a/src/registry_schemas/version.py +++ b/src/registry_schemas/version.py @@ -22,4 +22,4 @@ Development release segment: .devN """ -__version__ = '1.7.2' # pylint: disable=invalid-name +__version__ = '1.7.3' # pylint: disable=invalid-name diff --git a/tests/unit/ppr/test_financing_statement.py b/tests/unit/ppr/test_financing_statement.py index f832d98..7adbdad 100644 --- a/tests/unit/ppr/test_financing_statement.py +++ b/tests/unit/ppr/test_financing_statement.py @@ -61,8 +61,8 @@ ('MD', True), ('PT', True), ('SC', True), - ('TO', True), ('SV', True), + ('TO', True), ('XX', False), ] # testdata pattern is ({other type description}, {is valid}) @@ -438,3 +438,22 @@ def test_authorization_received(): for err in errors: print(err.message) assert not is_valid + + +def test_valid_financing_response_transition(): + """Assert that the schema is performing as expected for a transition registration response.""" + statement = copy.deepcopy(FINANCING_STATEMENT) + del statement['lifeInfinite'] + del statement['lienAmount'] + del statement['surrenderDate'] + statement['transitionDescription'] = 'COMPANY ACT DOCUMENT' + statement['transitionDate'] = '1986-12-29T00:00:01-08:53' + statement['transitionNumber'] = 'BC0021615' + is_valid, errors = validate(statement, 'financingStatement', 'ppr') + + if errors: + for err in errors: + print(err.message) + print(errors) + + assert is_valid diff --git a/tests/unit/ppr/test_search_query.py b/tests/unit/ppr/test_search_query.py index bafbbf0..ce1ed87 100644 --- a/tests/unit/ppr/test_search_query.py +++ b/tests/unit/ppr/test_search_query.py @@ -244,7 +244,7 @@ def test_invalid_search_query_firstname(): query = copy.deepcopy(SEARCH_QUERY) del query['criteria']['value'] del query['criteria']['debtorName']['business'] - query['criteria']['debtorName']['first'] = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + query['criteria']['debtorName']['first'] = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' is_valid, errors = validate(query, 'searchQuery', 'ppr') @@ -261,7 +261,7 @@ def test_invalid_search_query_secondname(): query = copy.deepcopy(SEARCH_QUERY) del query['criteria']['value'] del query['criteria']['debtorName']['business'] - query['criteria']['debtorName']['second'] = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + query['criteria']['debtorName']['second'] = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' is_valid, errors = validate(query, 'searchQuery', 'ppr') @@ -278,7 +278,7 @@ def test_invalid_search_query_lastname(): query = copy.deepcopy(SEARCH_QUERY) del query['criteria']['value'] del query['criteria']['debtorName']['business'] - query['criteria']['debtorName']['last'] = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + query['criteria']['debtorName']['last'] = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' is_valid, errors = validate(query, 'searchQuery', 'ppr')