From 5fbeae9b76168d3cb69fdd0176b268b84dbdd683 Mon Sep 17 00:00:00 2001 From: meawong Date: Mon, 23 Mar 2026 18:16:44 -0700 Subject: [PATCH 1/3] 31834 - Update outputs that use the certified by statement --- legal-api/report-templates/annualReport.html | 4 +- .../report-templates/appointReceiver.html | 4 +- .../report-templates/bcAddressChange.html | 4 +- .../report-templates/bcAnnualReport.html | 4 +- .../report-templates/bcDirectorChange.html | 4 +- legal-api/report-templates/ceaseReceiver.html | 4 +- .../report-templates/changeOfAddress.html | 4 +- .../report-templates/changeOfDirectors.html | 4 +- legal-api/report-templates/changeOfName.html | 4 +- legal-api/report-templates/dissolution.html | 4 +- .../voluntaryDissolution.html | 4 +- legal-api/src/legal_api/reports/report.py | 39 +++++++++++++------ 12 files changed, 61 insertions(+), 22 deletions(-) diff --git a/legal-api/report-templates/annualReport.html b/legal-api/report-templates/annualReport.html index 812d944153..e86dea4a28 100644 --- a/legal-api/report-templates/annualReport.html +++ b/legal-api/report-templates/annualReport.html @@ -56,7 +56,9 @@ [[directors.html]] {% endif %} -[[certification.html]] +{% if not business.isCorp %} + [[certification.html]] +{% endif %} diff --git a/legal-api/report-templates/appointReceiver.html b/legal-api/report-templates/appointReceiver.html index 16ddf9a586..a7820887f5 100644 --- a/legal-api/report-templates/appointReceiver.html +++ b/legal-api/report-templates/appointReceiver.html @@ -34,6 +34,8 @@ [[receivers/receivers.html]] - [[certification.html]] + {% if not business.isCorp %} + [[certification.html]] + {% endif %} diff --git a/legal-api/report-templates/bcAddressChange.html b/legal-api/report-templates/bcAddressChange.html index 0f0bb46618..09f3793d4f 100644 --- a/legal-api/report-templates/bcAddressChange.html +++ b/legal-api/report-templates/bcAddressChange.html @@ -33,7 +33,9 @@
[[bc-address-change/addresses.html]] - [[certification.html]] + {% if not business.isCorp %} + [[certification.html]] + {% endif %}
diff --git a/legal-api/report-templates/bcAnnualReport.html b/legal-api/report-templates/bcAnnualReport.html index ee78c7ada6..1e03ae393e 100644 --- a/legal-api/report-templates/bcAnnualReport.html +++ b/legal-api/report-templates/bcAnnualReport.html @@ -33,7 +33,9 @@
[[bc-annual-report/legalObligations.html]] - [[certification.html]] + {% if not business.isCorp %} + [[certification.html]] + {% endif %}
diff --git a/legal-api/report-templates/bcDirectorChange.html b/legal-api/report-templates/bcDirectorChange.html index 3b22525180..c1cd0175e8 100644 --- a/legal-api/report-templates/bcDirectorChange.html +++ b/legal-api/report-templates/bcDirectorChange.html @@ -33,7 +33,9 @@
[[bc-director-change/directors.html]] - [[certification.html]] + {% if not business.isCorp %} + [[certification.html]] + {% endif %}
diff --git a/legal-api/report-templates/ceaseReceiver.html b/legal-api/report-templates/ceaseReceiver.html index 1db05e46aa..2d9483a0af 100644 --- a/legal-api/report-templates/ceaseReceiver.html +++ b/legal-api/report-templates/ceaseReceiver.html @@ -32,6 +32,8 @@
[[receivers/receivers.html]] - [[certification.html]] + {% if not business.isCorp %} + [[certification.html]] + {% endif %} diff --git a/legal-api/report-templates/changeOfAddress.html b/legal-api/report-templates/changeOfAddress.html index f59cc97590..dc57837c73 100644 --- a/legal-api/report-templates/changeOfAddress.html +++ b/legal-api/report-templates/changeOfAddress.html @@ -54,7 +54,9 @@ [[addresses.html]] -[[certification.html]] +{% if not business.isCorp %} + [[certification.html]] +{% endif %} diff --git a/legal-api/report-templates/changeOfDirectors.html b/legal-api/report-templates/changeOfDirectors.html index f21276a126..f2130c5f74 100644 --- a/legal-api/report-templates/changeOfDirectors.html +++ b/legal-api/report-templates/changeOfDirectors.html @@ -54,7 +54,9 @@ [[directors.html]] -[[certification.html]] +{% if not business.isCorp %} + [[certification.html]] +{% endif %} diff --git a/legal-api/report-templates/changeOfName.html b/legal-api/report-templates/changeOfName.html index 33113b33f5..bb59391b1a 100644 --- a/legal-api/report-templates/changeOfName.html +++ b/legal-api/report-templates/changeOfName.html @@ -54,7 +54,9 @@ [[legalNameChange.html]] - [[certification.html]] + {% if not business.isCorp %} + [[certification.html]] + {% endif %} diff --git a/legal-api/report-templates/dissolution.html b/legal-api/report-templates/dissolution.html index c4687ffef1..f5d2581ae2 100644 --- a/legal-api/report-templates/dissolution.html +++ b/legal-api/report-templates/dissolution.html @@ -42,7 +42,9 @@ [[common/effectiveDate.html]] [[dissolution/custodianOfRecords.html]] [[dissolution/dissolutionStatement.html]] - [[certification.html]] + {% if not business.isCorp %} + [[certification.html]] + {% endif %} {% endif %} diff --git a/legal-api/report-templates/voluntaryDissolution.html b/legal-api/report-templates/voluntaryDissolution.html index 64f80bb54f..aec28883a9 100644 --- a/legal-api/report-templates/voluntaryDissolution.html +++ b/legal-api/report-templates/voluntaryDissolution.html @@ -54,7 +54,9 @@ [[dissolution.html]] - [[certification.html]] + {% if not business.isCorp %} + [[certification.html]] + {% endif %} diff --git a/legal-api/src/legal_api/reports/report.py b/legal-api/src/legal_api/reports/report.py index 58f5c631cb..1d1c10ca50 100644 --- a/legal-api/src/legal_api/reports/report.py +++ b/legal-api/src/legal_api/reports/report.py @@ -87,17 +87,17 @@ def _get_report(self): if not report_meta: report_meta = ReportMeta.reports.get("default") report_type = report_meta.get("reportType") - if business_identifier: - document, status = self._document_service.get_filing_report_by_filing_id( - business_identifier, - self._filing.id, - report_type) - if status == HTTPStatus.OK: - return current_app.response_class( - response=document, - status=status, - mimetype="application/pdf" - ) + # if business_identifier: + # document, status = self._document_service.get_filing_report_by_filing_id( + # business_identifier, + # self._filing.id, + # report_type) + # if status == HTTPStatus.OK: + # return current_app.response_class( + # response=document, + # status=status, + # mimetype="application/pdf" + # ) # Added "alteration" to ReportMeta, can these 2 lines be removed? if self._report_key == "alteration": @@ -289,6 +289,7 @@ def _get_template_data(self): self._set_meta_info(filing) self._set_registrar_info(filing) self._set_completing_party(filing) + self._set_corp_flag(filing) filing["enable_new_ben_statements"] = flags.is_on("enable-new-ben-statements") filing["enable_sandbox"] = flags.is_on("enable-sandbox") @@ -359,6 +360,22 @@ def _handle_special_resolution_filing_data(self, filing): elif self._report_key == "specialResolutionApplication": self._format_special_resolution_application(filing, "alteration") + def _set_corp_flag(self, filing): + """Set a flag indicating whether the entity is a corporation.""" + corp_legal_types = { + Business.LegalTypes.BCOMP.value, + Business.LegalTypes.COMP.value, + Business.LegalTypes.BC_ULC_COMPANY.value, + Business.LegalTypes.BC_CCC.value, + Business.LegalTypes.CONTINUE_IN.value, + Business.LegalTypes.BCOMP_CONTINUE_IN.value, + Business.LegalTypes.CCC_CONTINUE_IN.value, + Business.LegalTypes.ULC_CONTINUE_IN.value, + } + legal_type = filing.get("business", {}).get("legalType") or \ + (self._business.legal_type if self._business else None) + filing["business"]["isCorp"] = legal_type in corp_legal_types + def _set_completing_party(self, filing): completing_party_role = PartyRole.get_party_roles_by_filing( self._filing.id, datetime.utcnow(), PartyRole.RoleTypes.COMPLETING_PARTY.value) From 841b5368823320705e46b4b3f67e6e7f4fe1913f Mon Sep 17 00:00:00 2001 From: meawong Date: Mon, 23 Mar 2026 18:23:51 -0700 Subject: [PATCH 2/3] 31834 - Uncomment code --- legal-api/src/legal_api/reports/report.py | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/legal-api/src/legal_api/reports/report.py b/legal-api/src/legal_api/reports/report.py index 1d1c10ca50..db7dff44aa 100644 --- a/legal-api/src/legal_api/reports/report.py +++ b/legal-api/src/legal_api/reports/report.py @@ -87,17 +87,17 @@ def _get_report(self): if not report_meta: report_meta = ReportMeta.reports.get("default") report_type = report_meta.get("reportType") - # if business_identifier: - # document, status = self._document_service.get_filing_report_by_filing_id( - # business_identifier, - # self._filing.id, - # report_type) - # if status == HTTPStatus.OK: - # return current_app.response_class( - # response=document, - # status=status, - # mimetype="application/pdf" - # ) + if business_identifier: + document, status = self._document_service.get_filing_report_by_filing_id( + business_identifier, + self._filing.id, + report_type) + if status == HTTPStatus.OK: + return current_app.response_class( + response=document, + status=status, + mimetype="application/pdf" + ) # Added "alteration" to ReportMeta, can these 2 lines be removed? if self._report_key == "alteration": @@ -363,18 +363,18 @@ def _handle_special_resolution_filing_data(self, filing): def _set_corp_flag(self, filing): """Set a flag indicating whether the entity is a corporation.""" corp_legal_types = { - Business.LegalTypes.BCOMP.value, - Business.LegalTypes.COMP.value, + Business.LegalTypes.BCOMP.value, + Business.LegalTypes.COMP.value, Business.LegalTypes.BC_ULC_COMPANY.value, - Business.LegalTypes.BC_CCC.value, - Business.LegalTypes.CONTINUE_IN.value, + Business.LegalTypes.BC_CCC.value, + Business.LegalTypes.CONTINUE_IN.value, Business.LegalTypes.BCOMP_CONTINUE_IN.value, Business.LegalTypes.CCC_CONTINUE_IN.value, Business.LegalTypes.ULC_CONTINUE_IN.value, } legal_type = filing.get("business", {}).get("legalType") or \ (self._business.legal_type if self._business else None) - filing["business"]["isCorp"] = legal_type in corp_legal_types + filing["business"]["isCorp"] = legal_type in corp_legal_types def _set_completing_party(self, filing): completing_party_role = PartyRole.get_party_roles_by_filing( From a406426870009da6067fa941114bb56b664b43be Mon Sep 17 00:00:00 2001 From: meawong Date: Tue, 24 Mar 2026 10:13:07 -0700 Subject: [PATCH 3/3] 31834 - Move isCorp check to certification.html and add unit tests --- legal-api/report-templates/annualReport.html | 4 +-- .../report-templates/appointReceiver.html | 4 +-- .../report-templates/bcAddressChange.html | 4 +-- .../report-templates/bcAnnualReport.html | 4 +-- .../report-templates/bcDirectorChange.html | 4 +-- legal-api/report-templates/ceaseReceiver.html | 4 +-- .../report-templates/changeOfAddress.html | 4 +-- .../report-templates/changeOfDirectors.html | 4 +-- legal-api/report-templates/changeOfName.html | 4 +-- legal-api/report-templates/dissolution.html | 4 +-- .../template-parts/certification.html | 2 ++ .../voluntaryDissolution.html | 4 +-- legal-api/src/legal_api/reports/report.py | 20 ++++------- legal-api/tests/unit/reports/test_report.py | 35 +++++++++++++++++++ 14 files changed, 55 insertions(+), 46 deletions(-) diff --git a/legal-api/report-templates/annualReport.html b/legal-api/report-templates/annualReport.html index e86dea4a28..812d944153 100644 --- a/legal-api/report-templates/annualReport.html +++ b/legal-api/report-templates/annualReport.html @@ -56,9 +56,7 @@ [[directors.html]] {% endif %} -{% if not business.isCorp %} - [[certification.html]] -{% endif %} +[[certification.html]] diff --git a/legal-api/report-templates/appointReceiver.html b/legal-api/report-templates/appointReceiver.html index a7820887f5..16ddf9a586 100644 --- a/legal-api/report-templates/appointReceiver.html +++ b/legal-api/report-templates/appointReceiver.html @@ -34,8 +34,6 @@ [[receivers/receivers.html]] - {% if not business.isCorp %} - [[certification.html]] - {% endif %} + [[certification.html]] diff --git a/legal-api/report-templates/bcAddressChange.html b/legal-api/report-templates/bcAddressChange.html index 09f3793d4f..0f0bb46618 100644 --- a/legal-api/report-templates/bcAddressChange.html +++ b/legal-api/report-templates/bcAddressChange.html @@ -33,9 +33,7 @@
[[bc-address-change/addresses.html]] - {% if not business.isCorp %} - [[certification.html]] - {% endif %} + [[certification.html]]
diff --git a/legal-api/report-templates/bcAnnualReport.html b/legal-api/report-templates/bcAnnualReport.html index 1e03ae393e..ee78c7ada6 100644 --- a/legal-api/report-templates/bcAnnualReport.html +++ b/legal-api/report-templates/bcAnnualReport.html @@ -33,9 +33,7 @@
[[bc-annual-report/legalObligations.html]] - {% if not business.isCorp %} - [[certification.html]] - {% endif %} + [[certification.html]]
diff --git a/legal-api/report-templates/bcDirectorChange.html b/legal-api/report-templates/bcDirectorChange.html index c1cd0175e8..3b22525180 100644 --- a/legal-api/report-templates/bcDirectorChange.html +++ b/legal-api/report-templates/bcDirectorChange.html @@ -33,9 +33,7 @@
[[bc-director-change/directors.html]] - {% if not business.isCorp %} - [[certification.html]] - {% endif %} + [[certification.html]]
diff --git a/legal-api/report-templates/ceaseReceiver.html b/legal-api/report-templates/ceaseReceiver.html index 2d9483a0af..1db05e46aa 100644 --- a/legal-api/report-templates/ceaseReceiver.html +++ b/legal-api/report-templates/ceaseReceiver.html @@ -32,8 +32,6 @@
[[receivers/receivers.html]] - {% if not business.isCorp %} - [[certification.html]] - {% endif %} + [[certification.html]] diff --git a/legal-api/report-templates/changeOfAddress.html b/legal-api/report-templates/changeOfAddress.html index dc57837c73..f59cc97590 100644 --- a/legal-api/report-templates/changeOfAddress.html +++ b/legal-api/report-templates/changeOfAddress.html @@ -54,9 +54,7 @@ [[addresses.html]] -{% if not business.isCorp %} - [[certification.html]] -{% endif %} +[[certification.html]] diff --git a/legal-api/report-templates/changeOfDirectors.html b/legal-api/report-templates/changeOfDirectors.html index f2130c5f74..f21276a126 100644 --- a/legal-api/report-templates/changeOfDirectors.html +++ b/legal-api/report-templates/changeOfDirectors.html @@ -54,9 +54,7 @@ [[directors.html]] -{% if not business.isCorp %} - [[certification.html]] -{% endif %} +[[certification.html]] diff --git a/legal-api/report-templates/changeOfName.html b/legal-api/report-templates/changeOfName.html index bb59391b1a..33113b33f5 100644 --- a/legal-api/report-templates/changeOfName.html +++ b/legal-api/report-templates/changeOfName.html @@ -54,9 +54,7 @@ [[legalNameChange.html]] - {% if not business.isCorp %} - [[certification.html]] - {% endif %} + [[certification.html]] diff --git a/legal-api/report-templates/dissolution.html b/legal-api/report-templates/dissolution.html index f5d2581ae2..c4687ffef1 100644 --- a/legal-api/report-templates/dissolution.html +++ b/legal-api/report-templates/dissolution.html @@ -42,9 +42,7 @@ [[common/effectiveDate.html]] [[dissolution/custodianOfRecords.html]] [[dissolution/dissolutionStatement.html]] - {% if not business.isCorp %} - [[certification.html]] - {% endif %} + [[certification.html]] {% endif %} diff --git a/legal-api/report-templates/template-parts/certification.html b/legal-api/report-templates/template-parts/certification.html index 4000310662..3b747b396c 100644 --- a/legal-api/report-templates/template-parts/certification.html +++ b/legal-api/report-templates/template-parts/certification.html @@ -1,3 +1,4 @@ +{% if not business.isCorp %}
Certification
@@ -12,3 +13,4 @@ {% endif %}
+{% endif %} diff --git a/legal-api/report-templates/voluntaryDissolution.html b/legal-api/report-templates/voluntaryDissolution.html index aec28883a9..64f80bb54f 100644 --- a/legal-api/report-templates/voluntaryDissolution.html +++ b/legal-api/report-templates/voluntaryDissolution.html @@ -54,9 +54,7 @@ [[dissolution.html]] - {% if not business.isCorp %} - [[certification.html]] - {% endif %} + [[certification.html]] diff --git a/legal-api/src/legal_api/reports/report.py b/legal-api/src/legal_api/reports/report.py index db7dff44aa..00125e38b2 100644 --- a/legal-api/src/legal_api/reports/report.py +++ b/legal-api/src/legal_api/reports/report.py @@ -362,19 +362,13 @@ def _handle_special_resolution_filing_data(self, filing): def _set_corp_flag(self, filing): """Set a flag indicating whether the entity is a corporation.""" - corp_legal_types = { - Business.LegalTypes.BCOMP.value, - Business.LegalTypes.COMP.value, - Business.LegalTypes.BC_ULC_COMPANY.value, - Business.LegalTypes.BC_CCC.value, - Business.LegalTypes.CONTINUE_IN.value, - Business.LegalTypes.BCOMP_CONTINUE_IN.value, - Business.LegalTypes.CCC_CONTINUE_IN.value, - Business.LegalTypes.ULC_CONTINUE_IN.value, - } - legal_type = filing.get("business", {}).get("legalType") or \ - (self._business.legal_type if self._business else None) - filing["business"]["isCorp"] = legal_type in corp_legal_types + if self._business: + legal_type = self._business.legal_type + else: + filing_json = self._filing.filing_json.get("filing", {}) + filing_type = self._filing.filing_type + legal_type = filing_json.get(filing_type, {}).get("nameRequest", {}).get("legalType") + filing["business"]["isCorp"] = legal_type in Business.CORPS def _set_completing_party(self, filing): completing_party_role = PartyRole.get_party_roles_by_filing( diff --git a/legal-api/tests/unit/reports/test_report.py b/legal-api/tests/unit/reports/test_report.py index 0ed0f8cd89..11d6e9b882 100644 --- a/legal-api/tests/unit/reports/test_report.py +++ b/legal-api/tests/unit/reports/test_report.py @@ -415,3 +415,38 @@ def test_document_service_not_create_document(session, mock_doc_service, mocker) assert False except BusinessException as err: assert err.status_code == HTTPStatus.NOT_FOUND + +@pytest.mark.parametrize( + 'test_name, identifier, entity_type, expected_is_corp', + [ + # Corporation types - should be True + ('BC corp', 'BC1234567', 'BC', True), + ('BEN corp', 'BC1234567', 'BEN', True), + ('CC corp', 'BC1234567', 'CC', True), + ('ULC corp', 'BC1234567', 'ULC', True), + ('C continuation', 'C1234567', 'C', True), + ('CBEN continuation', 'C1234567', 'CBEN', True), + ('CCC continuation', 'C1234567', 'CCC', True), + ('CUL continuation', 'C1234567', 'CUL', True), + # Non-corporation types - should be False + ('CP cooperative', 'CP1234567', 'CP', False), + ('SP sole prop', 'FM1234567', 'SP', False), + ('GP partnership', 'FM1234567', 'GP', False), + ] +) +def test_set_corp_flag(session, test_name, identifier, entity_type, expected_is_corp): + """Assert _set_corp_flag correctly identifies corporation vs non-corporation types.""" + report = create_report( + identifier=identifier, + entity_type=entity_type, + report_type='annualReport', + filing_type='annualReport', + template=ANNUAL_REPORT + ) + report._populate_business_info_to_filing(report._filing, report._business) + + filing = report._filing.filing_json['filing'] + report._set_corp_flag(filing) + + assert filing['business']['isCorp'] == expected_is_corp, \ + f'{test_name}: expected isCorp={expected_is_corp} for legalType={entity_type}'