-
Notifications
You must be signed in to change notification settings - Fork 75
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
Changes from all commits
c041e4f
e38fb79
8504791
613f7f6
3f755fa
1a80d82
ab09a68
c78fb49
d1bbfc7
994aa9f
cdc1784
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') | ||
severinbeauvais marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# 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): | ||
|
@@ -680,6 +686,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 | ||
|
||
|
@@ -839,6 +848,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 \ | ||
|
@@ -1057,3 +1072,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 |
---|---|---|
|
@@ -324,7 +324,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 comment
The reason will be displayed to describe this comment to others. Learn more.
allow filing NoW without an existing business