-
Notifications
You must be signed in to change notification settings - Fork 84
32960 business emailer - special resolution updates #4557
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
Open
kialj876
wants to merge
1
commit into
bcgov:main
Choose a base branch
from
kialj876:32960-email-updates-special-res
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,9 @@ | |
| """Email processing rules and actions corp filing notifications.""" | ||
| from __future__ import annotations | ||
|
|
||
| import copy | ||
| from contextlib import suppress | ||
|
|
||
| from flask import current_app | ||
| from jinja2 import Template | ||
|
|
||
|
|
@@ -42,36 +45,46 @@ def _get_additional_info(filing: Filing) -> dict: | |
| if filing.filing_type == "alteration": | ||
| meta_data_alteration = filing.meta_data.get("alteration", {}) if filing.meta_data else {} | ||
| additional_info["nameChange"] = "toLegalName" in meta_data_alteration | ||
| elif filing.filing_type == "specialResolution": | ||
| additional_info["nameChange"] = filing.filing_json["filing"].get("changeOfName") | ||
| additional_info["rulesChange"] = bool(filing.filing_json["filing"].get("alteration", {}).get("rulesFileKey")) | ||
|
|
||
| return additional_info | ||
|
|
||
|
|
||
| def _get_additional_recipients(filing: Filing, token: str) -> str: | ||
| def _get_additional_recipients(filing: Filing, token: str) -> str | None: | ||
| """Get additional recipients for a filing type.""" | ||
| submitter_recipient_filings = ["alteration", "changeOfRegistration", "dissolution", "specialResolution"] | ||
| if filing.filing_type in submitter_recipient_filings: | ||
| optional_email = filing.filing_json["filing"]["header"].get("documentOptionalEmail") | ||
| if filing.submitter_roles and UserRoles.staff in filing.submitter_roles and optional_email: | ||
| if filing.submitter_roles and UserRoles.staff in filing.submitter_roles: | ||
|
Collaborator
Author
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. if this is true and theres no optional email we don't actually want it to add the staff user email (reason for the change) |
||
| # when staff do filing documentOptionalEmail may contain completing party email | ||
| return optional_email | ||
| return filing.filing_json["filing"]["header"].get("documentOptionalEmail") | ||
| else: | ||
| return get_user_email_from_auth(filing.filing_submitter.username, token) | ||
|
|
||
|
|
||
| def _get_attachments_and_extra_pdf_types(status: str, filing_type: str, filing: Filing, legal_type_key: str) -> tuple[list[str], list[str]]: | ||
| """Get attachments for a filing type.""" | ||
| attachments = FILING_ATTACHMENTS.get(legal_type_key, {}).get(filing_type, {}).get("attachments", []) | ||
| extra_pdf_types = FILING_ATTACHMENTS.get(legal_type_key, {}).get(filing_type, {}).get("extraPdfTypes", []) | ||
| attachments = copy.deepcopy(FILING_ATTACHMENTS.get(legal_type_key, {}).get(filing_type, {}).get("attachments", [])) | ||
| extra_pdf_types = copy.deepcopy(FILING_ATTACHMENTS.get(legal_type_key, {}).get(filing_type, {}).get("extraPdfTypes", [])) | ||
|
|
||
| # filing sub type overrides attachments and extraPdfTypes if present | ||
| if filing.filing_sub_type and (attachments_sub := FILING_ATTACHMENTS.get(legal_type_key, {}).get(f"{filing_type}-{filing.filing_sub_type}", {})): | ||
| if filing.filing_sub_type and (attachments_sub := copy.deepcopy(FILING_ATTACHMENTS.get(legal_type_key, {}).get(f"{filing_type}-{filing.filing_sub_type}", {}))): | ||
| attachments = attachments_sub.get("attachments", []) | ||
| extra_pdf_types = attachments_sub.get("extraPdfTypes", []) | ||
| # filing attachments with change of name cert can override attachments and extraPdfTypes if present | ||
| if (_get_additional_info(filing).get("nameChange", False) | ||
| and (attachments_con := FILING_ATTACHMENTS.get(legal_type_key, {}).get(f"{filing_type}-con", {})) | ||
| ): | ||
| attachments = attachments_con.get("attachments", []) | ||
| extra_pdf_types = attachments_con.get("extraPdfTypes", []) | ||
|
|
||
| # adjust attachments for some filings that have dynamic attachments based on the filing data | ||
| additional_info = _get_additional_info(filing) | ||
| with suppress(ValueError): | ||
| if not additional_info.get("nameChange"): | ||
| # remove con if in the attachments list | ||
| attachments.remove("Certificate of Name Change") | ||
| extra_pdf_types.remove("certificateOfNameChange") | ||
|
|
||
| if not additional_info.get("rulesChange"): | ||
| # remove cr if in the attachments list | ||
| attachments.remove("Certified Rules") | ||
| extra_pdf_types.remove("certifiedRules") | ||
|
|
||
| if status != Filing.Status.COMPLETED.value: | ||
| extra_pdf_types = [] | ||
|
|
@@ -84,7 +97,7 @@ def _skip_email_check(status: str, filing: Filing, legal_type: str, filing_name: | |
| invalid_status = (status not in [Filing.Status.COMPLETED.value, Filing.Status.PAID.value] | ||
| or (status == Filing.Status.PAID.value and not filing.is_future_effective)) | ||
| invalid_data = not legal_type or not filing_name or not business_identifier | ||
| skipped_coop_filing_types = ["changeOfDirectors", "changeOfAddress"] | ||
| skipped_coop_filing_types = ["annualReport", "changeOfDirectors", "changeOfAddress"] | ||
| invalid_coop_filing = legal_type == Business.LegalTypes.COOP.value and filing.filing_type in skipped_coop_filing_types | ||
|
|
||
| return invalid_status or invalid_data or invalid_coop_filing | ||
|
|
||
103 changes: 0 additions & 103 deletions
103
...business-emailer/src/business_emailer/email_processors/special_resolution_notification.py
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
queue_services/business-emailer/src/business_emailer/email_templates/SR-CP-COMPLETED.html
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
queue_services/business-emailer/src/business_emailer/email_templates/SR-CP-PAID.html
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
...ices/business-emailer/src/business_emailer/email_templates/specialResolution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Your have successfully filed your special resolution with the BC Business Registry | ||
|
|
||
| --- | ||
|
|
||
| [[business-tombstone.md]] | ||
|
|
||
| --- | ||
|
|
||
| [[attachments.md]] | ||
|
|
||
| --- | ||
|
|
||
| [[business-registry-footer.md]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
the only case this was effecting for coops was annualReport which is now skipped earlier