Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
the Cooperative Association that exceeds $200.00.
{% endif %}
{% else %}
The affidavit required by section 316(1)(a) of the Business Corporations Act has been completed
and deposited in the company's records book.
The affidavit required by section 316(1)(a) of the <span class="italic">Business Corporations Act</span>
has been obtained and deposited in the company's records book.
{% endif %}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
CoreFiling.FilingTypes.SPECIALRESOLUTION,
}

# - Dissolution is handled separately (voluntary only)
FILINGS_REQUIRING_AUTHORIZATION = {
CoreFiling.FilingTypes.AGMEXTENSION,
CoreFiling.FilingTypes.AGMLOCATIONCHANGE,
Expand Down Expand Up @@ -1293,8 +1294,17 @@ def validate_certify_name(filing_json) -> bool:
return True
return True

def validate_certified_by(filing_json: dict, filing_type: str, legal_type: str) -> list:
def is_voluntary_dissolution(filing_json: dict, filing_type: str) -> bool:
"""Return True if the filing is a voluntary dissolution."""
from legal_api.services.filings.validations.dissolution import DissolutionTypes
return (
filing_type == CoreFiling.FilingTypes.DISSOLUTION
and filing_json["filing"].get("dissolution", {}).get("dissolutionType")
== DissolutionTypes.VOLUNTARY.value
)


def validate_certified_by(filing_json: dict, filing_type: str, legal_type: str) -> list:
"""Validate certifiedBy field."""
msg = []
certified_by = filing_json["filing"]["header"].get("certifiedBy")
Expand All @@ -1307,13 +1317,8 @@ def validate_certified_by(filing_json: dict, filing_type: str, legal_type: str)
filing_type == CoreFiling.FilingTypes.CORRECTION
and filing_json["filing"].get("correction", {}).get("type") == "CLIENT"
)

is_voluntary_dissolution = (
filing_type == CoreFiling.FilingTypes.DISSOLUTION
and filing_json["filing"].get("dissolution", {}).get("dissolutionType") == DissolutionTypes.VOLUNTARY.value
)

certification_required = (is_cert_filing or is_client_correction or is_voluntary_dissolution)
certification_required = (is_cert_filing or is_client_correction or
is_voluntary_dissolution(filing_json, filing_type))

if certification_required:
if not certified_by:
Expand All @@ -1336,7 +1341,7 @@ def validate_authorization_received(filing_json: dict, filing_type: str, legal_t
if legal_type not in Business.CORPS:
return msg # authorizationReceived is only required for corporations

if filing_type not in FILINGS_REQUIRING_AUTHORIZATION:
if filing_type not in FILINGS_REQUIRING_AUTHORIZATION and not is_voluntary_dissolution(filing_json, filing_type):
return msg # authorizationReceived is only required for specific filings

authorization_received = filing_json["filing"]["header"].get("authorizationReceived")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,20 +726,25 @@ def test_validate_certified_by_coops(
(False, True),
(None, True),
])
@pytest.mark.parametrize('filing_type, requires_authorization', [
(CoreFiling.FilingTypes.ALTERATION, True),
(CoreFiling.FilingTypes.ANNUALREPORT, True),
(CoreFiling.FilingTypes.REGISTRARSORDER, False), # staff filing
(CoreFiling.FilingTypes.INCORPORATIONAPPLICATION, False), # not in FILINGS_REQUIRING_AUTHORIZATION
@pytest.mark.parametrize('filing_type, requires_authorization, dissolution_type', [
(CoreFiling.FilingTypes.ALTERATION, True, None),
(CoreFiling.FilingTypes.ANNUALREPORT, True, None),
(CoreFiling.FilingTypes.DISSOLUTION, True, "voluntary"),
(CoreFiling.FilingTypes.DISSOLUTION, False, "administrative"),
(CoreFiling.FilingTypes.REGISTRARSORDER, False, None), # staff filing
(CoreFiling.FilingTypes.INCORPORATIONAPPLICATION, False, None), # not in FILINGS_REQUIRING_AUTHORIZATION
])
def test_validate_authorization_received(session, legal_type, authorization_received, expected_error, filing_type, requires_authorization):
"""Test that authorizationReceived is enforced for Corps filings in FILINGS_REQUIRING_AUTHORIZATION only."""
def test_validate_authorization_received(session, legal_type, authorization_received, expected_error, filing_type, requires_authorization, dissolution_type):
"""Test that authorizationReceived is enforced for required Corps filings."""
filing = copy.deepcopy(FILING_HEADER)
if authorization_received is not None:
filing['filing']['header']['authorizationReceived'] = authorization_received
else:
filing['filing']['header'].pop('authorizationReceived', None)

if dissolution_type:
filing['filing']['dissolution'] = {'dissolutionType': dissolution_type}

errors = validate_authorization_received(filing, filing_type, legal_type)

if legal_type in Business.CORPS and requires_authorization and expected_error:
Expand Down