-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
24987 24989 - Update to enable NoW for temporary businesses #3155
base: main
Are you sure you want to change the base?
Changes from all commits
bbb74ef
f6a3be9
a5e438e
e0499ee
c0156c0
2c0bb2d
8adb74d
745e936
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -479,7 +479,8 @@ def put_basic_checks(identifier, filing, client_request, business) -> Tuple[dict | |
if not filing_type: | ||
return ({'message': 'filing/header/name is a required property'}, HTTPStatus.BAD_REQUEST) | ||
|
||
if filing_type not in CoreFiling.NEW_BUSINESS_FILING_TYPES and business is None: | ||
if filing_type not in CoreFiling.NEW_BUSINESS_FILING_TYPES + [CoreFiling.FilingTypes.NOTICEOFWITHDRAWAL] \ | ||
and business is None: | ||
return ({'message': 'A valid business is required.'}, HTTPStatus.BAD_REQUEST) | ||
|
||
if client_request.method == 'PUT' and not filing: | ||
|
@@ -497,9 +498,14 @@ def check_authorization(identifier, filing_json: dict, | |
|
||
# While filing IA business object will be None. Setting default values in that case. | ||
state = business.state if business else Business.State.ACTIVE | ||
if business: | ||
legal_type = business.legal_type | ||
# for temporary business notice of withdraw, get legalType from filing json | ||
elif filing_type == CoreFiling.FilingTypes.NOTICEOFWITHDRAWAL.value: | ||
legal_type = filing_json['filing'].get('business', None).get('legalType') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this work if the NoW is for a regular business? (eg, withdrawing a FE alteration) |
||
# for incorporationApplication and registration, get legalType from nameRequest | ||
legal_type = business.legal_type if business else \ | ||
filing_json['filing'][filing_type]['nameRequest'].get('legalType') | ||
else: | ||
legal_type = filing_json['filing'][filing_type]['nameRequest'].get('legalType') | ||
|
||
if not authorized(identifier, jwt, action=['edit']) or \ | ||
not is_allowed(business, state, filing_type, legal_type, jwt, filing_sub_type, filing): | ||
|
@@ -668,6 +674,9 @@ def get_filing_types(business: Business, filing_json: dict): # pylint: disable= | |
|
||
if filing_type in CoreFiling.NEW_BUSINESS_FILING_TYPES: | ||
legal_type = filing_json['filing'][filing_type]['nameRequest']['legalType'] | ||
elif business.identifier.startswith('T') and \ | ||
filing_type == CoreFiling.FilingTypes.NOTICEOFWITHDRAWAL: | ||
legal_type = filing_json['filing'].get('business', None).get('legalType') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for temporary business notice of withdraw, get legalType from filing json |
||
else: | ||
legal_type = business.legal_type | ||
|
||
|
@@ -826,6 +835,12 @@ def create_invoice(business: Business, # pylint: disable=too-many-locals,too-ma | |
mailing_address = business.mailing_address.one_or_none() | ||
corp_type = business.legal_type if business.legal_type else \ | ||
filing.json['filing']['business'].get('legalType') | ||
# deal with withdrawing a new business filing | ||
elif business.identifier.startswith('T') and \ | ||
filing.filing_type == Filing.FILINGS['noticeOfWithdrawal']['name']: | ||
mailing_address, corp_type, legal_name = \ | ||
ListFilingResource._get_address_from_withdrawn_new_business_filing(business, filing) | ||
business.legal_name = legal_name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for temporary business notice of withdraw, get mailng_address, corp_type, legal_name from the withdrawn new business filing (e.g. IA, Continuation In, Amalgamation) |
||
else: | ||
mailing_address = business.mailing_address.one_or_none() | ||
corp_type = business.legal_type if business.legal_type else \ | ||
|
@@ -1044,3 +1059,27 @@ def submit_filing_for_review(filing: Filing): | |
{'email': {'filingId': filing.id, 'type': filing.filing_type, 'option': review.status}}, | ||
current_app.config.get('NATS_EMAILER_SUBJECT') | ||
) | ||
|
||
@staticmethod | ||
def _get_address_from_withdrawn_new_business_filing(business: Business, filing: Filing): | ||
if filing.filing_type != CoreFiling.FilingTypes.NOTICEOFWITHDRAWAL.value: | ||
return None, None, None | ||
withdrawn_filing_id = filing.filing_json['filing']['noticeOfWithdrawal']['filingId'] | ||
withdrawn_filing = Filing.find_by_id(withdrawn_filing_id) | ||
if withdrawn_filing.filing_type in CoreFiling.NEW_BUSINESS_FILING_TYPES: | ||
office_type = OfficeType.REGISTERED | ||
if withdrawn_filing.filing_type == Filing.FILINGS['registration']['name']: | ||
office_type = OfficeType.BUSINESS | ||
|
||
mailing_address = Address.create_address( | ||
withdrawn_filing.json['filing'][withdrawn_filing.filing_type]['offices'][office_type]['mailingAddress']) | ||
corp_type = withdrawn_filing.json['filing'][withdrawn_filing.filing_type]['nameRequest'].get( | ||
'legalType', Business.LegalTypes.BCOMP.value) | ||
|
||
try: | ||
legal_name = withdrawn_filing.json['filing'][withdrawn_filing.filing_type]['nameRequest']['legalName'] | ||
except KeyError: | ||
legal_name = business.identifier | ||
|
||
return mailing_address, corp_type, legal_name | ||
return None, None, None |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,7 +321,8 @@ def get_allowable_filings_dict(): | |
'legalTypes': ['BC', 'BEN', 'CC', 'ULC', 'C', 'CBEN', 'CUL', 'CCC'], | ||
'blockerChecks': { | ||
'business': [BusinessBlocker.FILING_WITHDRAWAL] | ||
} | ||
}, | ||
'businessRequirement': BusinessRequirement.NO_RESTRICTION | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allow NoW filing no matter there is an existing business or not for staff |
||
} | ||
}, | ||
Business.State.HISTORICAL: { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there already tests for NoW with a regular business filing (eg, COA, Alteration, others?)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow filing NoW without an existing business