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/src/legal_api/reports/report.py b/legal-api/src/legal_api/reports/report.py index 58f5c631cb..00125e38b2 100644 --- a/legal-api/src/legal_api/reports/report.py +++ b/legal-api/src/legal_api/reports/report.py @@ -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,16 @@ 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.""" + 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( self._filing.id, datetime.utcnow(), PartyRole.RoleTypes.COMPLETING_PARTY.value) 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}'