Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

22411 btr lear filing integration #3208

Merged
merged 8 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion legal-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ PyPDF2==1.26.0
reportlab==3.6.12
html-sanitizer==2.4.1
lxml==5.2.2
git+https://github.com/bcgov/[email protected].33#egg=registry_schemas
git+https://github.com/bcgov/[email protected].34#egg=registry_schemas
git+https://github.com/bcgov/lear.git#egg=sql-versioning&subdirectory=python/common/sql-versioning
6 changes: 6 additions & 0 deletions legal-api/src/legal_api/core/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class FilingTypes(str, Enum):
RESTORATIONAPPLICATION = 'restorationApplication'
SPECIALRESOLUTION = 'specialResolution'
TRANSITION = 'transition'
TRANSPARENCY_REGISTER = 'transparencyRegister'

class FilingTypesCompact(str, Enum):
"""Render enum for filing types with sub-types."""
Expand All @@ -110,6 +111,9 @@ class FilingTypesCompact(str, Enum):
AMALGAMATION_APPLICATION_REGULAR = 'amalgamationApplication.regular'
AMALGAMATION_APPLICATION_VERTICAL = 'amalgamationApplication.vertical'
AMALGAMATION_APPLICATION_HORIZONTAL = 'amalgamationApplication.horizontal'
TRANSPARENCY_REGISTER_ANNUAL = 'transparencyRegister.annual'
TRANSPARENCY_REGISTER_CHANGE = 'transparencyRegister.change'
TRANSPARENCY_REGISTER_INITIAL = 'transparencyRegister.initial'

NEW_BUSINESS_FILING_TYPES: Final = [
FilingTypes.AMALGAMATIONAPPLICATION,
Expand Down Expand Up @@ -531,6 +535,7 @@ def get_document_list(business, # pylint: disable=too-many-locals disable=too-m
Filing.FilingTypes.CONTINUATIONOUT.value,
Filing.FilingTypes.AGMEXTENSION.value,
Filing.FilingTypes.AGMLOCATIONCHANGE.value,
Filing.FilingTypes.TRANSPARENCY_REGISTER.value,
]
if (filing.status in (Filing.Status.PAID, Filing.Status.WITHDRAWN) or
(filing.status == Filing.Status.COMPLETED and
Expand Down Expand Up @@ -568,6 +573,7 @@ def get_document_list(business, # pylint: disable=too-many-locals disable=too-m
Filing.FilingTypes.CONTINUATIONOUT.value,
Filing.FilingTypes.AGMEXTENSION.value,
Filing.FilingTypes.AGMLOCATIONCHANGE.value,
Filing.FilingTypes.TRANSPARENCY_REGISTER.value,
]
if filing.filing_type not in no_legal_filings:
documents['documents']['legalFilings'] = \
Expand Down
50 changes: 49 additions & 1 deletion legal-api/src/legal_api/core/meta/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,55 @@ class FilingTitles(str, Enum):
'outputs': ['noticeOfArticles']
},
]
}
},
'transparencyRegister': {
'name': 'transparencyRegister',
'annual': {
'name': 'transparencyRegister',
'title': 'Transparency Register - Annual Filing',
'displayName': 'Transparency Register - Annual Filing',
'codes': {
'BC': 'REGSIGIN',
'BEN': 'REGSIGIN',
'ULC': 'REGSIGIN',
'CC': 'REGSIGIN',
'C': 'REGSIGIN',
'CBEN': 'REGSIGIN',
'CUL': 'REGSIGIN',
'CCC': 'REGSIGIN'
}
},
'change': {
'name': 'transparencyRegister',
'title': 'Transparency Register Filing',
'displayName': 'Transparency Register Filing',
'codes': {
'BC': 'REGSIGIN',
'BEN': 'REGSIGIN',
'ULC': 'REGSIGIN',
'CC': 'REGSIGIN',
'C': 'REGSIGIN',
'CBEN': 'REGSIGIN',
'CUL': 'REGSIGIN',
'CCC': 'REGSIGIN'
}
},
'initial': {
'name': 'transparencyRegister',
'title': 'Transparency Register Filing',
'displayName': 'Transparency Register Filing',
'codes': {
'BC': 'REGSIGIN',
'BEN': 'REGSIGIN',
'ULC': 'REGSIGIN',
'CC': 'REGSIGIN',
'C': 'REGSIGIN',
'CBEN': 'REGSIGIN',
'CUL': 'REGSIGIN',
'CCC': 'REGSIGIN'
}
}
},
}


Expand Down
59 changes: 57 additions & 2 deletions legal-api/src/legal_api/models/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ class Status(str, Enum):
class Source(Enum):
"""Render an Enum of the Filing Sources."""

BTR = 'BTR'
COLIN = 'COLIN'
LEAR = 'LEAR'

# TODO: get legal types from defined class once table is made (getting it from Business causes circ import)
# TODO: add filing types for btr
FILINGS = {
'affidavit': {
'name': 'affidavit',
Expand Down Expand Up @@ -446,6 +448,51 @@ class Source(Enum):
'CCC': 'TRANS'
}
},
'transparencyRegister': {
'name': 'transparencyRegister',
'annual': {
'name': 'transparencyRegister',
'title': 'Transparency Register - Annual Filing',
'codes': {
'BC': 'REGSIGIN',
'BEN': 'REGSIGIN',
'ULC': 'REGSIGIN',
'CC': 'REGSIGIN',
'C': 'REGSIGIN',
'CBEN': 'REGSIGIN',
'CUL': 'REGSIGIN',
'CCC': 'REGSIGIN'
}
},
'change': {
'name': 'transparencyRegister',
'title': 'Transparency Register Filing',
'codes': {
'BC': 'REGSIGIN',
'BEN': 'REGSIGIN',
'ULC': 'REGSIGIN',
'CC': 'REGSIGIN',
'C': 'REGSIGIN',
'CBEN': 'REGSIGIN',
'CUL': 'REGSIGIN',
'CCC': 'REGSIGIN'
}
},
'initial': {
'name': 'transparencyRegister',
'title': 'Transparency Register Filing',
'codes': {
'BC': 'REGSIGIN',
'BEN': 'REGSIGIN',
'ULC': 'REGSIGIN',
'CC': 'REGSIGIN',
'C': 'REGSIGIN',
'CBEN': 'REGSIGIN',
'CUL': 'REGSIGIN',
'CCC': 'REGSIGIN'
}
}
},

# changing the structure of fee code in courtOrder/registrarsNotation/registrarsOrder
# for all the business the fee code remain same as NOFEE (Staff)
Expand All @@ -462,7 +509,8 @@ class Source(Enum):
# breaking and more testing was req'd so did not make refactor when introducing this dictionary.
'dissolution': 'dissolutionType',
'restoration': 'type',
'amalgamationApplication': 'type'
'amalgamationApplication': 'type',
'transparencyRegister': 'type'
}

__tablename__ = 'filings'
Expand Down Expand Up @@ -1051,7 +1099,14 @@ def get_most_recent_legal_filing(business_id: str, filing_type: str = None):
def get_completed_filings_for_colin(limit=20, offset=0):
"""Return the filings based on limit and offset."""
from .business import Business # noqa: F401; pylint: disable=import-outside-toplevel
excluded_filings = ['lear_epoch', 'adminFreeze', 'courtOrder', 'registrarsNotation', 'registrarsOrder']
excluded_filings = [
'lear_epoch',
'adminFreeze',
'courtOrder',
'registrarsNotation',
'registrarsOrder',
'transparencyRegister'
]
excluded_businesses = [Business.LegalTypes.SOLE_PROP.value, Business.LegalTypes.PARTNERSHIP.value]
filings = db.session.query(Filing).join(Business). \
filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,9 @@ def create_invoice(business: Business, # pylint: disable=too-many-locals,too-ma
corp_type = business.legal_type if business.legal_type else \
filing.json['filing']['business'].get('legalType')

if filing.filing_type == Filing.FILINGS['transparencyRegister']['name']:
corp_type = 'BTR'

payload = {
'businessInfo': {
'businessIdentifier': f'{business.identifier}',
Expand Down
23 changes: 23 additions & 0 deletions legal-api/src/legal_api/services/authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,29 @@ def get_allowable_filings_dict():
},
'transition': {
'legalTypes': ['BC', 'BEN', 'CC', 'ULC', 'C', 'CBEN', 'CUL', 'CCC']
},
CoreFiling.FilingTypes.TRANSPARENCY_REGISTER.value: {
'annual': {
'legalTypes': ['BC', 'BEN', 'CC', 'ULC', 'C', 'CBEN', 'CUL', 'CCC'],
'blockerChecks': {
'business': [BusinessBlocker.BUSINESS_FROZEN],
'futureEffectiveFilings': [CoreFiling.FilingTypes.INCORPORATIONAPPLICATION.value]
}
},
'change': {
'legalTypes': ['BC', 'BEN', 'CC', 'ULC', 'C', 'CBEN', 'CUL', 'CCC'],
'blockerChecks': {
'business': [BusinessBlocker.BUSINESS_FROZEN],
'futureEffectiveFilings': [CoreFiling.FilingTypes.INCORPORATIONAPPLICATION.value]
}
},
'initial': {
'legalTypes': ['BC', 'BEN', 'CC', 'ULC', 'C', 'CBEN', 'CUL', 'CCC'],
'blockerChecks': {
'business': [BusinessBlocker.BUSINESS_FROZEN],
'futureEffectiveFilings': [CoreFiling.FilingTypes.INCORPORATIONAPPLICATION.value]
}
}
}
},
Business.State.HISTORICAL: {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright © 2025 Province of British Columbia
#
# Licensed under the BSD 3 Clause License, (the "License");
# you may not use this file except in compliance with the License.
# The template for the license can be found here
# https://opensource.org/license/bsd-3-clause/
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
"""Validation for the Transparency Register filing."""
from typing import Optional

from legal_api.errors import Error


def validate(_: dict) -> Optional[Error]:
"""Validate the Transparency Register filing."""
# NOTE: There isn't anything to validate outside what is already validated via the schema yet
return None
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
from .restoration import validate as restoration_validate
from .schemas import validate_against_schema
from .special_resolution import validate as special_resolution_validate
from .transparency_register import validate as transparency_register_validate


def validate(business: Business, # pylint: disable=too-many-branches,too-many-statements
Expand Down Expand Up @@ -190,6 +191,9 @@ def validate(business: Business, # pylint: disable=too-many-branches,too-many-s
elif k == Filing.FILINGS['putBackOff'].get('name'):
err = put_back_off_validate(business, filing_json)

elif k == Filing.FILINGS['transparencyRegister'].get('name'):
err = transparency_register_validate(filing_json) # pylint: disable=assignment-from-none

if err:
return err

Expand Down
Loading