Skip to content

Commit

Permalink
Merge pull request #2499 from JazzarKarim/19451-sync-with-main
Browse files Browse the repository at this point in the history
Cherry Picked all new commits from main to the feature branch
  • Loading branch information
JazzarKarim authored Mar 22, 2024
2 parents 1d171cb + 880d1ec commit 9622851
Show file tree
Hide file tree
Showing 93 changed files with 2,829 additions and 403 deletions.
2 changes: 1 addition & 1 deletion colin-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ blinker==1.4
certifi==2020.12.5
click==8.1.3
cx-Oracle==8.1.0
datedelta==1.3
debugpy
ecdsa==0.14.1
flask-jwt-oidc==0.3.0
Expand All @@ -31,5 +32,4 @@ SQLAlchemy==1.4.44
sentry-sdk==1.20.0
six==1.15.0
urllib3==1.26.11
git+https://github.com/bcgov/lear.git#egg=legal_api&subdirectory=legal-api
git+https://github.com/bcgov/business-schemas.git#egg=registry_schemas
2 changes: 1 addition & 1 deletion colin-api/src/colin_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import sentry_sdk # noqa: I001; pylint: disable=ungrouped-imports; conflicts with Flake8

from flask import Flask
from legal_api.services import flags
from colin_api.services import flags
from sentry_sdk.integrations.flask import FlaskIntegration # noqa: I001

from colin_api import config, errorhandlers
Expand Down
1 change: 1 addition & 0 deletions colin-api/src/colin_api/models/business.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class CorpStateTypes(Enum):
"""Render an Enum of the CorpState Type Codes."""

VOLUNTARY_DISSOLUTION = 'HDV'
ADMINISTRATIVE_DISSOLUTION = 'HDA'

# temp converter because legal doesn't have codes only class (legal_type)
CORP_TYPE_CONVERSION = {
Expand Down
11 changes: 10 additions & 1 deletion colin-api/src/colin_api/models/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class LearSource(Enum):
# `voluntaryDissolution filing type in place as unsure if it is being used in other places
'dissolution': {
'sub_type_property': 'dissolutionType',
'sub_type_list': ['voluntary'],
'sub_type_list': ['voluntary', 'administrative'],
'type_code_list': ['OTVDS', 'ADVD2'],
'voluntary': {
Business.TypeCodes.COOP.value: 'OTVDS',
Expand Down Expand Up @@ -920,6 +920,15 @@ def get_historic_filings(cls, business: Business) -> List:
# pass through exception to caller
raise err

@classmethod
def add_administrative_dissolution_event(cls, con, corp_num) -> int:
"""Add administrative dissolution event."""
cursor = con.cursor()
event_id = cls._get_event_id(cursor=cursor, corp_num=corp_num, event_type='SYSDA')
Business.update_corp_state(cursor, event_id, corp_num,
Business.CorpStateTypes.ADMINISTRATIVE_DISSOLUTION.value)
return event_id

# pylint: disable=too-many-locals,too-many-statements,too-many-branches,too-many-nested-blocks;
@classmethod
def add_filing(cls, con, filing: Filing) -> int:
Expand Down
14 changes: 14 additions & 0 deletions colin-api/src/colin_api/resources/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ def post(legal_type, identifier, **kwargs):
# get db connection and start a session, in case we need to roll back
con = DB.connection
con.begin()

# No filing will be created for administrative dissolution. Create an event and update corp state.
if ('dissolution' in filing_list and
Filing.get_filing_sub_type('dissolution', filing_list['dissolution']) == 'administrative'):
if legal_type == Business.LearBusinessTypes.COOP.value:
raise Exception('Not implemented!')
event_id = Filing.add_administrative_dissolution_event(con, identifier)
con.commit()
return jsonify({
'filing': {
'header': { 'colinIds' : [event_id]}
}
}), HTTPStatus.CREATED

filings_added = FilingInfo._add_filings(con, json_data, filing_list, identifier, corp_types)

# return the completed filing data
Expand Down
19 changes: 19 additions & 0 deletions colin-api/src/colin_api/services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright © 2024 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This module wraps the calls to external services used by the API."""

from .flags import Flags


flags = Flags() # pylint: disable=invalid-name; shared variables are lower case by Flask convention.
80 changes: 80 additions & 0 deletions colin-api/src/colin_api/services/flags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright © 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Manage the Feature Flags initialization, setup and service."""
from ldclient import get as ldclient_get, set_config as ldclient_set_config # noqa: I001
from ldclient.config import Config # noqa: I005
from ldclient.impl.integrations.files.file_data_source import _FileDataSource
from ldclient.interfaces import UpdateProcessor


class FileDataSource(UpdateProcessor):
"""FileDataStore has been removed, so this provides similar functionality."""

@classmethod
def factory(cls, **kwargs):
"""Provide a way to use local files as a source of feature flag state.
.. deprecated:: 6.8.0
This module and this implementation class are deprecated and may be changed or removed in the future.
Please use :func:`ldclient.integrations.Files.new_data_source()`.
The keyword arguments are the same as the arguments to :func:`ldclient.integrations.Files.new_data_source()`.
"""
return lambda config, store, ready: _FileDataSource(store, ready,
paths=kwargs.get('paths'),
auto_update=kwargs.get('auto_update', False),
poll_interval=kwargs.get('poll_interval', 1),
force_polling=kwargs.get('force_polling', False))


class Flags():
"""Wrapper around the feature flag system.
calls FAIL to FALSE
If the feature flag service is unavailable
AND
there is no local config file
Calls -> False
"""

def __init__(self, app=None):
"""Initialize this object."""
self.sdk_key = None
self.app = None

if app:
self.init_app(app)

def init_app(self, app):
"""Initialize the Feature Flag environment."""
self.app = app
self.sdk_key = app.config.get('LD_SDK_KEY')

if self.sdk_key or app.env != 'production':

if app.env == 'production':
config = Config(sdk_key=self.sdk_key)
else:
factory = FileDataSource.factory(paths=['flags.json'],
auto_update=True)
config = Config(sdk_key=self.sdk_key,
update_processor_class=factory,
send_events=False)

ldclient_set_config(config)
client = ldclient_get()

app.extensions['featureflags'] = client
2 changes: 1 addition & 1 deletion colin-api/src/colin_api/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
Development release segment: .devN
"""

__version__ = '2.96.0' # pylint: disable=invalid-name
__version__ = '2.108.0' # pylint: disable=invalid-name
2 changes: 1 addition & 1 deletion data-tool/flows/common/lear_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def populate_filing(business: Business, event_filing_data: dict, filing_data: di
filing._filing_type = target_lear_filing_type
filing.filing_date = effective_date
filing._completion_date = effective_date
filing.business_id = business.id if business else None
filing.legal_entity_id = business.id if business else None
filing.source = Filing.Source.COLIN.value
filing.paper_only = get_is_paper_only(filing_data)

Expand Down
2 changes: 1 addition & 1 deletion data-tool/flows/corps/lear_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def populate_filing(business: Business, event_filing_data: dict, filing_data: di
filing._filing_type = target_lear_filing_type
filing.filing_date = effective_date
filing._completion_date = effective_date
filing.business_id = business.id if business else None
filing.legal_entity_id = business.id if business else None
filing.source = Filing.Source.COLIN.value
filing.paper_only = get_is_paper_only(filing_data)

Expand Down
71 changes: 61 additions & 10 deletions legal-api/report-templates/amalgamationApplication.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
[[macros.html]]

<!DOCTYPE html>
<html lang="en">
<head>
<title>Amalgamation Application</title>
<meta charset="UTF-8">
<meta name="author" content="BC Registries and Online Services">
[[common/style.html]]
</head>
<body>
</body>
</html>
<head>
<title>Amalgamation Application</title>
<meta charset="UTF-8">
<meta name="author" content="BC Registries and Online Services">
[[common/style.html]]
</head>
<body>
<div class="header">
<table class="header-table" role="presentation">
<tr class="no-page-break">
<td>
[[logo.html]]
</td>
<td>
<div class="report-type">AMALGAMATION APPLICATION</div>
<div class="report-type-desc">{{ entityDescription }} - {{ entityAct }}</div>
</td>
</tr>
</table>
<div class="business-name-header">
<label class="lbl-business-name">
{% if business.legalName %}
{{ business.legalName }}
{% elif nameRequest.legalName %}
{{ nameRequest.legalName }}
{% else %}
{{numberedDescription}}
{% endif %}
</label>
</div>
</div>
[[common/businessDetails.html]]
<div class="no-page-break">
<div class="section-header mt-5 pt-4">AMALGAMATION APPLICATION</div>
</div>

{% if nameRequest.nrNumber or (not nameRequest.nrNumber and not nameRequest.legalName) %}
<!-- this block is hidden if the name is adopted from amalgamating business -->
[[incorporation-application/nameRequest.html]]
<div class="separator mt-4"></div>
{% endif %}

[[amalgamation/effectiveDate.html]]
[[amalgamation/approvalType.html]]
[[amalgamation/amalgamatingCorp.html]]
[[amalgamation/amalgamationStmt.html]]
[[incorporation-application/completingParty.html]]

<div class="section-header mt-7 pt-4">NOTICE OF ARTICLES</div>
<div class="container pt-4">
[[amalgamation/amalgamationName.html]]
{% if business.legalType in ['BEN', 'CC', 'ULC'] %}
<div class="separator mt-4"></div>
{% endif %}
[[common/statement.html]]
[[common/addresses.html]]
[[common/directors.html]]
[[common/shareStructure.html]]
</div>
</body>
</html>
1 change: 1 addition & 0 deletions legal-api/report-templates/businessSummary.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
[[business-summary/stateTransition.html]]
[[business-summary/recordKeeper.html]]
[[business-summary/amalgamations.html]]
[[business-summary/amalgamating.html]]
[[common/addresses.html]]
{% if business.legalType in ['GP', 'SP'] %}
[[business-summary/parties.html]]
Expand Down
37 changes: 36 additions & 1 deletion legal-api/report-templates/certificateOfAmalgamation.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,41 @@
[[common/certificateStyle.html]]
</head>
<body>
<div class="outer-container">
<div class="outer-container-header">
<div class="business-number">Incorporation Number: {{ business.identifier }}</div>
[[common/correctedOnCertificate.html]]
</div>

<div class="certificate-statements">
[[common/certificateLogo.html]]

<div class="cert-title-container">
<div class="sub-header-1">Certificate of</div>
<div class="certificate-header">AMALGAMATION</div>
<div class="sub-header-2">{{ entityAct }}</div>
</div>

<div class="certify-clause-container">
<div>I hereby certify that the following businesses were amalgamated under the name</div>
<div class="company-name-header">{{ business.legalName }}</div>
<div>on {{ effective_date_time }}</div>
<div class="mt-2">
{% for entity in amalgamatingBusinesses %}
{% if entity != amalgamatingBusinesses[0] %}
<span>, and </span>
{% endif %}
<span class="upper-text">{{ entity.legalName }} ({{ entity.identifier }})</span>
{% endfor %}
</div>
<div class="cert-separator"></div>
<div class="cert-issued-by">
<div>Issued under my hand at Victoria, British Columbia</div>
<div>on {{ business.formatted_founding_date }}</div>
</div>
</div>
</div>
</div>
</body>
[[common/certificateFooter.html]]
</html>
</html>
2 changes: 1 addition & 1 deletion legal-api/report-templates/noticeOfArticles.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</td>
<td>
<div class="report-type">NOTICE OF ARTICLES</div>
<div class="report-type-desc">{{entityDescription}} - Business Corporations Act</div>
<div class="report-type-desc">{{entityDescription}} - {{ entityAct }}</div>
</td>
</tr>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="no-page-break">
<div class="section-title mt-4">BC Community Contribution Company Statement</div>
<div class="section-data mt-4">
This company is a community contribution company, and, as such, has purposes beneficial to society.
This company is a community contribution company and, as such, has purposes beneficial to society.
This company is restricted, in accordance with Part 2.2 of the BCA, in its ability to pay dividends and to
distribute its assets on dissolution or otherwise.
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

<div class="no-page-break">
<div class="separator mt-4"></div>
<div class="section-title mt-4">Amalgamating Businesses Information</div>
</div>
<table class="section-data amalgamation-table mt-4" role="presentation">
<tr class="no-page-break">
<td class="col-50">
<div class="section-sub-title">Amalgamating Business</div>
</td>
<td class="col-50">
<div class="section-sub-title">Incorporation Number</div>
</td>
</tr>
{% for entity in amalgamatingBusinesses %}
<tr class="no-page-break">
<td class="col-50">
<div class="upper-text pt-2">
{{ entity.legalName }}
</div>
</td>
<td class="col-50">
<div class="upper-text pt-2">
{{ entity.identifier }}
</div>
</td>
</tr>
{% endfor %}
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Name of Amalgamated Company:
{% if business.legalName %}
{{ business.legalName }}
{% elif nameRequest.legalName %}
{{ nameRequest.legalName }}
{% else %}
{{numberedDescription}}
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="no-page-break">
<div class="separator mt-4"></div>
<div class="section-title mt-4">
<span>Amalgamation Statement</span>
</div>
<div class="section-data nt-3 pt-3">
This amalgamation has been effected without court approval. A copy of all of the required affidavits under section 277(1) have been obtained and the affidavit
obtained from each amalgamating company has been deposited in that company's records office.
</div>

</div>
Loading

0 comments on commit 9622851

Please sign in to comment.