Skip to content

Commit

Permalink
21485 Legal API - Update business summary (bcgov#2765)
Browse files Browse the repository at this point in the history
* Update involuntary dissolution reports template

* Update involuntary dissolution filing summary display name

* Update unit test for involuntary dissolution business summary

* Fix typo
  • Loading branch information
AimeeGao authored Jun 19, 2024
1 parent baa3e8f commit b4c0c35
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<div class="pt-2">
<span>Incorporation Number: {{ filing.identifier }}</span>
</div>
{% elif filing.filingType == 'dissolution' and filing.filngSubType == 'involuntary' %}
<span>Effective Date:</span>
<span>{{ filing.effectiveDateTime }}</span>
{% else %}
<span>Filing Date:</span>
<span>{{filing.filingDateTime}}</span>
Expand Down
6 changes: 6 additions & 0 deletions legal-api/src/legal_api/reports/business_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,12 @@ def _get_legal_type_description(legal_type: str) -> str:
'SP': 'Dissolution Application',
'GP': 'Dissolution Application'
},
'involuntary': {
'BC': 'Involuntary Dissolution',
'BEN': 'Involuntary Dissolution',
'ULC': 'Involuntary Dissolution',
'CC': 'Involuntary Dissolution',
},
'administrative': {
'CP': 'Administrative Dissolution',
'BC': 'Administrative Dissolution',
Expand Down
70 changes: 70 additions & 0 deletions legal-api/tests/unit/resources/v2/test_business_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from tests.unit.models import factory_business, factory_completed_filing, factory_incorporation_filing
from tests.unit.services.utils import create_header
from registry_schemas.example_data import ALTERATION, FILING_HEADER, INCORPORATION_FILING_TEMPLATE
from unittest.mock import patch, PropertyMock


@integration_reports
Expand Down Expand Up @@ -160,3 +161,72 @@ def test_get_coop_business_documents(session, client, jwt):
assert docs_json['documentsInfo']['certifiedMemorandum']['key']
assert docs_json['documentsInfo']['certifiedRules']['name']
assert docs_json['documentsInfo']['certifiedMemorandum']['name']


def test_get_business_summary_involuntary_dissolution(requests_mock, session, client, jwt):
"""Assert that business summary returns correct information for Involuntary Dissolution."""
# setup
identifier = 'CP7654321'
business = factory_business(identifier, entity_type='BEN', state='HISTORICAL')

# create a dissolution filing with involuntary dissolution
INVOLUNTARY_DISSOLUTION = {
'filing': {
'header': {
'name': 'dissolution',
'date': '2023-01-19T19:08:53.733202+00:00',
'certifiedBy': 'full name',
'filingId': 1,
'effectiveDate': '2023-01-19T19:08:53.733202+00:00'
},
'business': {
'identifier': 'CP7654321',
'legalName': 'CP7654321 B.C. LTD.',
'legalType': 'BEN'
},
'dissolution': {
'dissolutionDate': '2023-01-19',
'dissolutionType': 'involuntary',
}
}
}

# create and save the filing
factory_completed_filing(business, INVOLUNTARY_DISSOLUTION, filing_type='dissolution',
filing_sub_type='involuntary')
# mock the meta_data property
with patch('legal_api.models.Filing.meta_data', new_callable=PropertyMock) as mock_meta_data:
mock_meta_data.return_value = {
'dissolution': {
'dissolutionType': 'involuntary',
'dissolutionDate': '2023-01-19'
},
"legalFilings": [
"dissolution"
],
}

# mock the external report service
requests_mock.post(current_app.config.get('REPORT_SVC_URL'), json={'foo': 'bar'})
headers = create_header(jwt, [STAFF_ROLE], identifier, **{'accept': 'application/json'})

# test
rv = client.get(f'/api/v2/businesses/{identifier}/documents/summary', headers=headers)

# check
assert rv.status_code == HTTPStatus.OK
response_json = rv.json

# check response content
assert 'business' in response_json
assert response_json['business']['identifier'] == identifier
assert response_json['business']['state'] == 'HISTORICAL'
assert response_json['reportType'] == 'summary'

# ensure the dissolution filing is included in stateFilings
assert 'stateFilings' in response_json
assert len(response_json['stateFilings']) > 0
state_filing = response_json['stateFilings'][0]
assert state_filing['filingType'] == 'dissolution'
assert state_filing['filingName'] == 'Involuntary Dissolution'

0 comments on commit b4c0c35

Please sign in to comment.