Skip to content

Commit

Permalink
19260 continuationIn schema (#165)
Browse files Browse the repository at this point in the history
* 19260 continuationIn schema
  • Loading branch information
vysakh-menon-aot authored May 9, 2024
1 parent cd076fd commit 92d132e
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 24 deletions.
30 changes: 24 additions & 6 deletions src/registry_schemas/example_data/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2343,19 +2343,37 @@

CONTINUATION_IN = {
'business': {
'identifier': 'BC1234567', # Identifier of the registered extra provincial business
'taxId': '123456789' # Existing BN Number if any
'identifier': 'A1234567', # Identifier of the registered extra provincial business
'legalName': 'HAULER SERVICES IN BC'
},
'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': {
Expand Down
1 change: 1 addition & 0 deletions src/registry_schemas/schemas/business.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"B",
"BC",
"BEN",
"CBEN",
"C",
"CC",
"CCC",
Expand Down
84 changes: 70 additions & 14 deletions src/registry_schemas/schemas/continuation_in.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"type": "object",
"required": [
"foreignJurisdiction",
"authorization",
"nameRequest",
"offices",
"parties"
Expand All @@ -24,28 +25,85 @@
"foreignJurisdiction": {
"type": "object",
"required": [
"name",
"country",
"identifier",
"legalName",
"incorporationDate"
],
"properties": {
"name": {
"country": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/foreign_jurisdiction#/properties/country",
"title": "The jurisdiction country code."
},
"region": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/foreign_jurisdiction#/properties/region",
"title": "The jurisdiction region code."
},
"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"
}
}
},
Expand All @@ -55,6 +113,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"
Expand All @@ -75,13 +136,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"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/registry_schemas/schemas/correction.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"annualReport",
"changeOfDirectors",
"changeOfAddress",
"continuationIn",
"conversion",
"dissolution",
"specialResolution",
Expand Down
5 changes: 3 additions & 2 deletions src/registry_schemas/schemas/filing.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,10 @@
"name": {
"not": {
"enum": [
"registration",
"amalgamationApplication",
"continuationIn",
"incorporationApplication",
"amalgamationApplication"
"registration"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/registry_schemas/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"""


__version__ = '2.18.25' # pylint: disable=invalid-name
__version__ = '2.18.26' # pylint: disable=invalid-name
2 changes: 1 addition & 1 deletion tests/unit/schemas/test_business.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 47 additions & 0 deletions tests/unit/test_continuation_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 92d132e

Please sign in to comment.