From 0098f3b3d90cb54ba7105871c2a88e2fa0e9143a Mon Sep 17 00:00:00 2001 From: "vysakh.menon" Date: Fri, 3 May 2024 15:48:29 -0700 Subject: [PATCH 1/3] 19260 continuationIn schema --- .../example_data/schema_data.py | 28 ++++-- src/registry_schemas/schemas/business.json | 1 + .../schemas/continuation_in.json | 87 +++++++++++++++---- src/registry_schemas/schemas/correction.json | 1 + src/registry_schemas/schemas/filing.json | 5 +- src/registry_schemas/version.py | 2 +- tests/unit/schemas/test_business.py | 2 +- tests/unit/test_continuation_in.py | 47 ++++++++++ 8 files changed, 149 insertions(+), 24 deletions(-) diff --git a/src/registry_schemas/example_data/schema_data.py b/src/registry_schemas/example_data/schema_data.py index 00b1db7..321372f 100644 --- a/src/registry_schemas/example_data/schema_data.py +++ b/src/registry_schemas/example_data/schema_data.py @@ -2343,19 +2343,37 @@ CONTINUATION_IN = { 'business': { - 'identifier': 'BC1234567', # Identifier of the registered extra provincial business + 'identifier': 'A1234567', # Identifier of the registered extra provincial business 'taxId': '123456789' # Existing BN Number if any }, 'foreignJurisdiction': { - 'name': 'Canada', + 'country': 'CA', + 'region': 'AB', 'legalName': 'HAULER SERVICES', - 'identifier': 'BC1234567', - 'incorporationDate': '2019-01-01' + 'identifier': 'AB1234567', + 'incorporationDate': '2019-01-01', + 'taxId': '123456789', + 'affidavitFileKey': '011e332d-1b8e-4218-8710-ad8ac1fbc592.pdf' + }, + 'authorization': { + 'files': [ + { + 'fileKey': '011e332d-1b8e-4218-8710-ad8ac1fbc593.pdf', + 'fileName': 'file 1.pdf' + }, + { + 'fileKey': '011e332d-1b8e-4218-8710-ad8ac1fbc594.pdf', + 'fileName': 'file 2.pdf' + } + ], + 'authorityName': 'name of authority', + 'date': '2020-01-01', + 'expiryDate': '2020-06-01' }, 'nameRequest': { 'nrNumber': 'NR 8798956', 'legalName': 'HAULER MEDIA INC.', - 'legalType': 'BEN' + 'legalType': 'CBEN' }, 'offices': { 'registeredOffice': { diff --git a/src/registry_schemas/schemas/business.json b/src/registry_schemas/schemas/business.json index bc4204b..8d33960 100644 --- a/src/registry_schemas/schemas/business.json +++ b/src/registry_schemas/schemas/business.json @@ -28,6 +28,7 @@ "B", "BC", "BEN", + "CBEN", "C", "CC", "CCC", diff --git a/src/registry_schemas/schemas/continuation_in.json b/src/registry_schemas/schemas/continuation_in.json index 3c78177..37662ca 100644 --- a/src/registry_schemas/schemas/continuation_in.json +++ b/src/registry_schemas/schemas/continuation_in.json @@ -12,6 +12,7 @@ "type": "object", "required": [ "foreignJurisdiction", + "authorization", "nameRequest", "offices", "parties" @@ -24,28 +25,86 @@ "foreignJurisdiction": { "type": "object", "required": [ - "name", + "country", "identifier", "legalName", - "incorporationDate" + "incorporationDate", + "affidavitFileKey" ], "properties": { - "name": { + "country": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/foreign_jurisdiction#/properties/country", + "title": "The jurisdiction country name." + }, + "region": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/foreign_jurisdiction#/properties/region", + "title": "The jurisdiction region name." + }, + "identifier": { "type": "string", - "title": "The jurisdiction name." + "title": "Identifier of the business in the foreign jurisdiction." }, "legalName": { "type": "string", "title": "Legal name of the business in the foreign jurisdiction." }, - "identifier": { + "incorporationDate": { "type": "string", - "title": "Identifier of the business in the foreign jurisdiction." + "format": "date", + "title": "Incorporation date of the business in the foreign jurisdiction." + }, + "taxId": { + "type": "string", + "title": "The BN9 of this business", + "pattern": "^[0-9]{9}$" }, - "incorporationDate":{ + "affidavitFileKey": { + "type": "string", + "title": "The Identifier for affidavit file in file server" + } + } + }, + "authorization": { + "type": "object", + "required": [ + "files", + "authorityName", + "date" + ], + "properties": { + "files": { + "type": "array", + "minItems": 1, + "items": { + "required": [ + "fileKey", + "fileName" + ], + "properties": { + "fileKey": { + "type": "string", + "title": "The Identifier for authorization file in file server" + }, + "fileName": { + "type": "string", + "title": "The name of the file in file server" + } + } + } + }, + "authorityName": { + "type": "string", + "title": "The authority name" + }, + "date": { "type": "string", "format": "date", - "title": "Incorporation date of the business in the foreign jurisdiction." + "title": "Authorization date" + }, + "expiryDate": { + "type": "string", + "format": "date", + "title": "Authorization expiry date" } } }, @@ -55,6 +114,9 @@ "nameRequest": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/name_request" }, + "nameTranslations": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/name_translations" + }, "offices": { "registeredOffice": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/office" @@ -75,13 +137,8 @@ "shareStructure": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/share_structure" }, - "consentFileKey": { - "type": "string", - "title": "The Identifier for consent file in file server" - }, - "consentFileName": { - "type": "string", - "title": "The consent file name while uploading" + "courtOrder": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/court_order#/properties/courtOrder" } } } diff --git a/src/registry_schemas/schemas/correction.json b/src/registry_schemas/schemas/correction.json index eed5d1e..94ac80d 100644 --- a/src/registry_schemas/schemas/correction.json +++ b/src/registry_schemas/schemas/correction.json @@ -31,6 +31,7 @@ "annualReport", "changeOfDirectors", "changeOfAddress", + "continuationIn", "conversion", "dissolution", "specialResolution", diff --git a/src/registry_schemas/schemas/filing.json b/src/registry_schemas/schemas/filing.json index ba8bb19..2a28bad 100644 --- a/src/registry_schemas/schemas/filing.json +++ b/src/registry_schemas/schemas/filing.json @@ -224,9 +224,10 @@ "name": { "not": { "enum": [ - "registration", + "amalgamationApplication", + "continuationIn", "incorporationApplication", - "amalgamationApplication" + "registration" ] } } diff --git a/src/registry_schemas/version.py b/src/registry_schemas/version.py index 5ebec08..57f1aaf 100644 --- a/src/registry_schemas/version.py +++ b/src/registry_schemas/version.py @@ -23,4 +23,4 @@ """ -__version__ = '2.18.25' # pylint: disable=invalid-name +__version__ = '2.18.26' # pylint: disable=invalid-name diff --git a/tests/unit/schemas/test_business.py b/tests/unit/schemas/test_business.py index 8c47994..f39d74e 100644 --- a/tests/unit/schemas/test_business.py +++ b/tests/unit/schemas/test_business.py @@ -31,7 +31,7 @@ def test_sanity(): def test_get_legal_type(): """Assert that the schema can be retrieved and that the enum has the right number of types.""" - current_types = 46 + current_types = 47 schema = get_schema('business.json') legal_types = schema['definitions']['legalType']['enum'] assert legal_types diff --git a/tests/unit/test_continuation_in.py b/tests/unit/test_continuation_in.py index 2121d5b..1e6cf92 100644 --- a/tests/unit/test_continuation_in.py +++ b/tests/unit/test_continuation_in.py @@ -49,6 +49,53 @@ def test_validate_no_jurisdiction_info(): assert not is_valid +def test_continuation_in_invalid_jurisdiction(): + """Assert that the JSONSchema is validating jurisdiction.""" + legal_filing = {'continuationIn': copy.deepcopy(CONTINUATION_IN)} + del legal_filing['continuationIn']['foreignJurisdiction']['country'] + + is_valid, errors = validate(legal_filing, 'continuation_in') + + if errors: + for err in errors: + print(err.message) + print(errors) + + assert not is_valid + + +def test_continuation_in_invalid_authorization(): + """Assert that the JSONSchema is validating authorization.""" + legal_filing = {'continuationIn': copy.deepcopy(CONTINUATION_IN)} + legal_filing['continuationIn']['authorization']['files'] = None + legal_filing['continuationIn']['authorization']['authorityName'] = None + legal_filing['continuationIn']['authorization']['date'] = None + + is_valid, errors = validate(legal_filing, 'continuation_in') + + if errors: + for err in errors: + print(err.message) + print(errors) + + assert not is_valid + + +def test_continuation_in_invalid_authorization_files(): + """Assert that the JSONSchema is validating authorization files.""" + legal_filing = {'continuationIn': copy.deepcopy(CONTINUATION_IN)} + legal_filing['continuationIn']['authorization']['files'] = [] + + is_valid, errors = validate(legal_filing, 'continuation_in') + + if errors: + for err in errors: + print(err.message) + print(errors) + + assert not is_valid + + def test_validate_no_offices(): """Assert not valid if the required offices are not present.""" continuation_in_json = copy.deepcopy(CONTINUATION_IN) From ffbf09d776c95d9c0cc84d7ba9c48f95c4212904 Mon Sep 17 00:00:00 2001 From: "vysakh.menon" Date: Fri, 3 May 2024 16:42:29 -0700 Subject: [PATCH 2/3] no message --- src/registry_schemas/schemas/continuation_in.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/registry_schemas/schemas/continuation_in.json b/src/registry_schemas/schemas/continuation_in.json index 37662ca..b0e5ee7 100644 --- a/src/registry_schemas/schemas/continuation_in.json +++ b/src/registry_schemas/schemas/continuation_in.json @@ -28,17 +28,16 @@ "country", "identifier", "legalName", - "incorporationDate", - "affidavitFileKey" + "incorporationDate" ], "properties": { "country": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/foreign_jurisdiction#/properties/country", - "title": "The jurisdiction country name." + "title": "The jurisdiction country code." }, "region": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/foreign_jurisdiction#/properties/region", - "title": "The jurisdiction region name." + "title": "The jurisdiction region code." }, "identifier": { "type": "string", From cd7bca42198da7eded30240e7e0a02ea5a60380e Mon Sep 17 00:00:00 2001 From: "vysakh.menon" Date: Mon, 6 May 2024 15:25:52 -0700 Subject: [PATCH 3/3] no message --- src/registry_schemas/example_data/schema_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registry_schemas/example_data/schema_data.py b/src/registry_schemas/example_data/schema_data.py index 321372f..069dc03 100644 --- a/src/registry_schemas/example_data/schema_data.py +++ b/src/registry_schemas/example_data/schema_data.py @@ -2344,7 +2344,7 @@ CONTINUATION_IN = { 'business': { 'identifier': 'A1234567', # Identifier of the registered extra provincial business - 'taxId': '123456789' # Existing BN Number if any + 'legalName': 'HAULER SERVICES IN BC' }, 'foreignJurisdiction': { 'country': 'CA',