Skip to content

Commit ae35f9e

Browse files
TVWerdalseverinbeauvaisCopilot
authored
30343 use alternate name for sole props chg of reg (#3767)
* 30343 Update to add in alterative name if it matches id Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * 30343 update to business-emailer. Entity-emailer is no longer used. Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * 30343 - update to properly grab alternate names for email subject and body Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * 30343-Lint fixes Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * Update to address some PR suggestions Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * 30343-Rebase, update to simplify code as per suggestions Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * 30343-Updating code as per suggestions Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * 30343-adding in businessName var lost in rebase Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * 30343-update to quotes used Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * 30343-Update to incorporate suggested code fix Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> * Update queue_services/business-emailer/src/business_emailer/email_templates/common/reg-business-info.html Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update queue_services/business-emailer/src/business_emailer/email_templates/common/reg-business-info.html Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Thayne Werdal <thayne.werdal@gov.bc.ca> Co-authored-by: Séverin Beauvais <severinbeauvais@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8500296 commit ae35f9e

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

queue_services/business-emailer/src/business_emailer/email_processors/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def get_filing_info(filing_id: str) -> tuple[Filing, dict, dict, str, str]:
3636
if filing.business_id:
3737
business = Business.find_by_internal_id(filing.business_id)
3838
business_json = business.json()
39+
if business.legal_type in ("SP", "GP"):
40+
business_json["businessName"] = business.legal_name # `legalName` in json would be replaced for firms
3941

4042
# payment date if available otherwise filing date
4143
leg_tmz_filing_date = LegislationDatetime.format_as_report_string(

queue_services/business-emailer/src/business_emailer/email_processors/change_of_registration_notification.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
120120
f'{current_app.config.get("TEMPLATE_PATH")}/CHGREG-{status}.html'
121121
).read_text()
122122
filled_template = substitute_template_parts(template)
123+
123124
# render template with vars
124125
jnja_template = Template(filled_template, autoescape=True)
125126
filing_data = (filing.json)["filing"][f"{filing_type}"]
@@ -169,9 +170,8 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
169170
if not subject: # fallback case - should never happen
170171
subject = "Notification from the BC Business Registry"
171172

172-
legal_name = business.get("legalName", None)
173+
legal_name = business.get("businessName") or business.get("legalName")
173174
subject = f"{legal_name} - {subject}" if legal_name else subject
174-
175175
return {
176176
"recipients": recipients,
177177
"requestBy": "BCRegistries@gov.bc.ca",

queue_services/business-emailer/src/business_emailer/email_templates/common/reg-business-info.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
<div class="value">Unknown</div>
1414
{% endif %}
1515
{% else %}
16+
{% if business.businessName %}
17+
<div class="value">{{ business.businessName }}</div>
18+
{% else %}
1619
<div class="value">{{ business.legalName }}</div>
20+
{% endif %}
1721
{% endif %}
1822
</div>
1923

queue_services/business-emailer/tests/unit/email_processors/test_change_of_registration_notification.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ def test_change_of_registration_notification(app, session, mocker, status, legal
5454
email = change_of_registration_notification.process(
5555
{'filingId': filing.id, 'type': 'changeOfRegistration', 'option': status}, token)
5656
if status == 'PAID':
57-
assert email['content']['subject'] == 'JANE A DOE - Confirmation of Filing from the Business Registry'
57+
assert email['content']['subject'] == 'test business - Confirmation of Filing from the Business Registry'
5858
else:
5959
assert email['content']['subject'] == \
60-
'JANE A DOE - Change of Registration Documents from the Business Registry'
60+
'test business - Change of Registration Documents from the Business Registry'
6161

6262
if submitter_role:
6363
assert f'{submitter_role}@email.com' in email['recipients']

0 commit comments

Comments
 (0)