diff --git a/queue_services/business-emailer/src/business_emailer/email_processors/__init__.py b/queue_services/business-emailer/src/business_emailer/email_processors/__init__.py
index aa2e0f5854..cf6759ef30 100644
--- a/queue_services/business-emailer/src/business_emailer/email_processors/__init__.py
+++ b/queue_services/business-emailer/src/business_emailer/email_processors/__init__.py
@@ -183,6 +183,7 @@ def substitute_template_parts(template_code: str, file_type = "html") -> str:
"business-tombstone-out-filing",
"consent",
"consent-next-steps",
+ "continuation-application-details",
"out-details",
"what-happens-next"
]
@@ -194,7 +195,6 @@ def substitute_template_parts(template_code: str, file_type = "html") -> str:
"business-info",
"business-information",
"consent-letter-information",
- "continuation-application-details",
"reg-business-info",
"cra-notice",
"nr-footer",
diff --git a/queue_services/business-emailer/src/business_emailer/email_processors/continuation_in_notification.py b/queue_services/business-emailer/src/business_emailer/email_processors/continuation_authorization_notification.py
similarity index 83%
rename from queue_services/business-emailer/src/business_emailer/email_processors/continuation_in_notification.py
rename to queue_services/business-emailer/src/business_emailer/email_processors/continuation_authorization_notification.py
index adb669365f..6aba07dbaa 100644
--- a/queue_services/business-emailer/src/business_emailer/email_processors/continuation_in_notification.py
+++ b/queue_services/business-emailer/src/business_emailer/email_processors/continuation_authorization_notification.py
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Email processing rules and actions for Continuation In notifications."""
+"""Email processing rules and actions for Continuation Authorization notifications."""
from __future__ import annotations
import re
@@ -29,6 +29,13 @@
)
from business_model.models import Business, Filing, ReviewResult
+CONTINUATION_IN_AUTHORIZATION_TEMPLATE_SUFFIXES = {
+ Filing.Status.APPROVED.value: "approved",
+ Filing.Status.AWAITING_REVIEW.value: "awaitingReview",
+ Filing.Status.CHANGE_REQUESTED.value: "changeRequested",
+ Filing.Status.REJECTED.value: "rejected",
+ "RESUBMITTED": "resubmitted",
+}
def _get_pdfs(
status: str,
@@ -78,7 +85,7 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
numbered_description = Business.BUSINESSES.get(legal_type, {}).get("numberedDescription")
review_result = ReviewResult.get_last_review_result(filing.id)
# encode newlines in review comment only
- latest_review_comment = review_result.comments.replace("\n", "\\n") if review_result else None
+ latest_review_comment = review_result.comments if review_result else None
# compute Foreign Jurisdiction string as in report.py and business_document.py
country_code = filing_data["foreignJurisdiction"]["country"]
@@ -87,12 +94,13 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
region = None
if region_code and region_code.upper() != "FEDERAL":
region = pycountry.subdivisions.get(code=f"{country_code}-{region_code}")
- foreign_jurisdiction = f"{region.name}, {country.name}" if region else country.name
+ foreign_jurisdiction = region.name if region else country.name
# get template and fill in parts
- template = (Path(f'{current_app.config.get("TEMPLATE_PATH")}/CONT-IN-{status}.html')
+ template_suffix = CONTINUATION_IN_AUTHORIZATION_TEMPLATE_SUFFIXES[status]
+ template = (Path(f'{current_app.config.get("TEMPLATE_PATH")}/{filing_type}-{template_suffix}.md')
.read_text(encoding="utf-8"))
- filled_template = substitute_template_parts(template)
+ filled_template = substitute_template_parts(template, "md")
jnja_template = Template(filled_template, autoescape=True)
# render template with vars
@@ -125,15 +133,15 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
# assign subject
legal_name = business.get("legalName", None)
if status == Filing.Status.APPROVED.value:
- subject = "Authorization Approved"
+ subject = "Continuation Authorization Results"
if status == Filing.Status.REJECTED.value:
- subject = "Authorization Rejected"
+ subject = "Continuation Authorization Results"
elif status == Filing.Status.AWAITING_REVIEW.value:
- subject = "Authorization Documents Received"
+ subject = "Continuation Authorization Documents Received"
elif status == Filing.Status.CHANGE_REQUESTED.value:
- subject = "Changes Needed to Authorization"
+ subject = "Change Requested for your Continuation Authorization"
elif status == "RESUBMITTED":
- subject = "Authorization Updates Received"
+ subject = "Updated Continuation Authorization Documents Received"
subject = f"{legal_name} - {subject}" if legal_name else subject
@@ -145,4 +153,4 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
"body": f"{html_out}",
"attachments": pdfs
}
- }
\ No newline at end of file
+ }
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-APPROVED.html b/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-APPROVED.html
deleted file mode 100644
index a185765ded..0000000000
--- a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-APPROVED.html
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
-
-
- Results of your Continuation Authorization
- [[style.html]]
-
-
-
-
-
-
- [[header.html]]
-
-
-
- Results of your Continuation Authorization
-
- Your Continuation Authorization is approved. Follow the steps below to complete
- your continuation application.
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- Your Next Steps
-
-
- - Return to My Business Registry to resume your Continuation
- Application
-
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- [[continuation-application-details.html]]
-
- [[20px.html]]
-
-
- [[24px.html]]
- [[footer.html]]
-
- |
-
-
-
-
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-AWAITING_REVIEW.html b/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-AWAITING_REVIEW.html
deleted file mode 100644
index 1639bf5226..0000000000
--- a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-AWAITING_REVIEW.html
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
- Confirmation of Submission from the Business Registry
- [[style.html]]
-
-
-
-
-
-
- [[header.html]]
-
-
-
- We have received your Continuation Authorization documents
-
- BC Registries will review your Continuation Authorization documents and contact you with the results
- within 5 business days.
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- Your Next Steps
-
- Once your authorization has been approved, you will be notified and can then return to the BC Business
- Registry to complete your continuation application.
-
-
- [[continuation-application-details.html]]
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
- [[24px.html]]
- [[footer.html]]
-
- |
-
-
-
-
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-CHANGE_REQUESTED.html b/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-CHANGE_REQUESTED.html
deleted file mode 100644
index 319551491b..0000000000
--- a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-CHANGE_REQUESTED.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
-
- Continuation Authorization Results from the Business Registry
- [[style.html]]
-
-
-
-
-
-
- [[header.html]]
-
-
-
- Make changes to your Continuation Authorization
-
- BC Registries would like you to make changes to your Continuation
- Authorization. Follow the steps below to make changes and resubmit your application.
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- Your Next Steps
-
- Follow these steps to complete your application:
-
- - Go to My Business Registry.
- - Select “Make Changes” to satisfy the request from BC Registries as described below:
-
-
- {{ latest_review_comment }}
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- [[continuation-application-details.html]]
-
-
- [[24px.html]]
- [[footer.html]]
-
- |
-
-
-
-
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-REJECTED.html b/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-REJECTED.html
deleted file mode 100644
index 29daf600f0..0000000000
--- a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-REJECTED.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
- Continuation Authorization Results from the Business Registry
- [[style.html]]
-
-
-
-
-
-
- [[header.html]]
-
-
-
- Results of your Continuation Authorization
-
- Your Continuation Authorization was rejected.
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- Your Next Steps
-
-
- - Review the reasons your authorization was rejected below:
- {{ latest_review_comment }}
- - Visit My Business Registry to submit
- a new Continuation Application.
-
-
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- [[continuation-application-details.html]]
-
- [[20px.html]]
-
-
- [[24px.html]]
- [[footer.html]]
-
- |
-
-
-
-
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-RESUBMITTED.html b/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-RESUBMITTED.html
deleted file mode 100644
index 93e1d3ae2a..0000000000
--- a/queue_services/business-emailer/src/business_emailer/email_templates/CONT-IN-RESUBMITTED.html
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
- Confirmation of Submission from the Business Registry
- [[style.html]]
-
-
-
-
-
-
- [[header.html]]
-
-
-
- We have received your updated Continuation Authorization documents
-
- BC Registries will review your Continuation Authorization documents and contact you with the results
- within 5 business days.
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- Your Next Steps
-
- Once your authorization has been approved, you will be notified and can then return to the BC Business
- Registry to complete your continuation application.
-
-
- [[continuation-application-details.html]]
-
- [[20px.html]]
- [[divider.html]]
- [[20px.html]]
-
-
- [[24px.html]]
- [[footer.html]]
-
- |
-
-
-
-
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/common/continuation-application-details.html b/queue_services/business-emailer/src/business_emailer/email_templates/common/continuation-application-details.html
deleted file mode 100644
index f63ce03b85..0000000000
--- a/queue_services/business-emailer/src/business_emailer/email_templates/common/continuation-application-details.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
Your Continuation Application Details
-
-
Previous Jurisdiction:
-
{{ foreign_jurisdiction }}
-
- [[16px.html]]
-
-
Identifying Number in Previous Jurisdiction:
-
{{ filing.foreignJurisdiction.identifier }}
-
- [[16px.html]]
-
-
Name in Previous Jurisdiction:
-
{{ filing.foreignJurisdiction.legalName }}
-
-
- {% if filing.business %}
- [[16px.html]]
-
-
Extraprovincial Registration Number in B.C.:
-
{{ filing.business.identifier }}
-
- {% endif %}
-
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/common/continuation-application-details.md b/queue_services/business-emailer/src/business_emailer/email_templates/common/continuation-application-details.md
new file mode 100644
index 0000000000..6774bf8144
--- /dev/null
+++ b/queue_services/business-emailer/src/business_emailer/email_templates/common/continuation-application-details.md
@@ -0,0 +1,7 @@
+## Your Continuation Application Details
+**Previous Jurisdiction:** {{ foreign_jurisdiction }}
+**Name in Previous Jurisdiction:** {{ filing.foreignJurisdiction.legalName }}
+**Number in Previous Jurisdiction:** {{ filing.foreignJurisdiction.identifier }}
+{% if filing.business %}
+**Extraprovincial Registration Number in BC:** {{ filing.business.identifier }}
+{% endif %}
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-approved.md b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-approved.md
new file mode 100644
index 0000000000..97f88e44fa
--- /dev/null
+++ b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-approved.md
@@ -0,0 +1,19 @@
+# Results of your Continuation Authorization
+
+---
+
+Your Continuation Authorization was **approved**. Follow the steps below to complete your continuation application.
+
+---
+
+## Next Steps
+
+1. Return to [My Business Registry]({{ entity_dashboard_url }}) to resume your Continuation Application
+
+---
+
+[[continuation-application-details.md]]
+
+---
+
+[[business-registry-footer.md]]
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-awaitingReview.md b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-awaitingReview.md
new file mode 100644
index 0000000000..ba1a03caee
--- /dev/null
+++ b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-awaitingReview.md
@@ -0,0 +1,19 @@
+# We have received your Continuation Authorization documents
+
+---
+
+BC Registries will review your Continuation Authorization documents and contact you with the results within 5 business days.
+
+---
+
+## Next Steps
+
+Once your authorization has been approved, you will be notified and can then return to the [BC Business Registry]({{ entity_dashboard_url }}) to complete your continuation application.
+
+---
+
+[[continuation-application-details.md]]
+
+---
+
+[[business-registry-footer.md]]
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-changeRequested.md b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-changeRequested.md
new file mode 100644
index 0000000000..b67ac9359b
--- /dev/null
+++ b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-changeRequested.md
@@ -0,0 +1,24 @@
+# Change Requested to your Continuation Authorization
+
+---
+
+BC Registries would like you to make changes to your Continuation Authorization. Follow the steps below to make changes and resubmit your application.
+
+---
+
+## Next Steps
+
+Follow these steps to complete your application:
+
+1. Go to [My Business Registry]({{ entity_dashboard_url }}).
+2. Select "Make Changes" to satisfy the request from BC Registries as described below:
+
+***{{ latest_review_comment }}***
+
+---
+
+[[continuation-application-details.md]]
+
+---
+
+[[business-registry-footer.md]]
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-rejected.md b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-rejected.md
new file mode 100644
index 0000000000..f5eb444ad5
--- /dev/null
+++ b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-rejected.md
@@ -0,0 +1,21 @@
+# Results of your Continuation Authorization
+
+---
+
+Your Continuation Authorization was **rejected**.
+
+---
+
+## Next Steps
+
+1. Review the reasons your authorization was rejected below:
+ ***{{ latest_review_comment }}***
+2. Visit [My Business Registry]({{ entity_dashboard_url }}) to submit a new Continuation Application.
+
+---
+
+[[continuation-application-details.md]]
+
+---
+
+[[business-registry-footer.md]]
diff --git a/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-resubmitted.md b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-resubmitted.md
new file mode 100644
index 0000000000..392301891a
--- /dev/null
+++ b/queue_services/business-emailer/src/business_emailer/email_templates/continuationIn-resubmitted.md
@@ -0,0 +1,19 @@
+# We have received your updated Continuation Authorization documents
+
+---
+
+BC Registries will review your updated Continuation Authorization documents and contact you with the results within 5 business days.
+
+---
+
+## Next Steps
+
+Once your authorization has been approved, you will be notified and can then return to the [BC Business Registry]({{ entity_dashboard_url }}) to complete your continuation application.
+
+---
+
+[[continuation-application-details.md]]
+
+---
+
+[[business-registry-footer.md]]
diff --git a/queue_services/business-emailer/src/business_emailer/resources/business_emailer.py b/queue_services/business-emailer/src/business_emailer/resources/business_emailer.py
index cc052cca4e..f1ade78690 100644
--- a/queue_services/business-emailer/src/business_emailer/resources/business_emailer.py
+++ b/queue_services/business-emailer/src/business_emailer/resources/business_emailer.py
@@ -51,7 +51,7 @@
bn_notification,
cease_receiver_notification,
consent_amalgamation_out_notification,
- continuation_in_notification,
+ continuation_authorization_notification,
filing_notification,
intent_to_liquidate_notification,
involuntary_dissolution_stage_1_notification,
@@ -238,7 +238,7 @@ def process_email(ce: SimpleCloudEvent): # pylint: disable=too-many-branches, t
send_email(email, token)
elif etype == "continuationIn" and option in ReviewStatus._member_names_:
# Special case for review step of continuation in filing. Regular filing notifications are handled by the filing_notification processor.
- email = continuation_in_notification.process(email_msg["email"], token)
+ email = continuation_authorization_notification.process(email_msg["email"], token)
send_email(email, token)
elif etype == "intentToLiquidate":
email = intent_to_liquidate_notification.process(email_msg["email"], token)
diff --git a/queue_services/business-emailer/tests/unit/email_processors/test_continuation_in_notification.py b/queue_services/business-emailer/tests/unit/email_processors/test_continuation_in_notification.py
index a399c4d88b..3d06624812 100644
--- a/queue_services/business-emailer/tests/unit/email_processors/test_continuation_in_notification.py
+++ b/queue_services/business-emailer/tests/unit/email_processors/test_continuation_in_notification.py
@@ -19,16 +19,16 @@
import requests_mock
from business_model.models import Filing
-from business_emailer.email_processors import continuation_in_notification
+from business_emailer.email_processors import continuation_authorization_notification
from tests.unit import CONTACT_POINT, prep_bootstrap_filing
@pytest.mark.parametrize('status, subject, content', [
- (Filing.Status.APPROVED.value, 'Authorization Approved', 'Results of your Continuation Authorization'),
- (Filing.Status.AWAITING_REVIEW.value, 'Authorization Documents Received', 'We have received your Continuation Authorization documents'),
- (Filing.Status.CHANGE_REQUESTED.value, 'Changes Needed to Authorization', 'Make changes to your Continuation Authorization'),
- (Filing.Status.REJECTED.value, 'Authorization Rejected', 'rejected'),
- ('RESUBMITTED', 'Authorization Updates Received', 'your updated'),
+ (Filing.Status.APPROVED.value, 'Continuation Authorization Results', 'Results of your Continuation Authorization'),
+ (Filing.Status.AWAITING_REVIEW.value, 'Continuation Authorization Documents Received', 'We have received your Continuation Authorization documents'),
+ (Filing.Status.CHANGE_REQUESTED.value, 'Change Requested for your Continuation Authorization', 'Change Requested to your Continuation Authorization'),
+ (Filing.Status.REJECTED.value, 'Continuation Authorization Results', 'Results of your Continuation Authorization'),
+ ('RESUBMITTED', 'Updated Continuation Authorization Documents Received', 'We have received your updated Continuation Authorization documents'),
])
def test_continuation_in_notification(app, session, mocker, status, subject, content):
"""Assert Continuation review notification is created."""
@@ -37,8 +37,8 @@ def test_continuation_in_notification(app, session, mocker, status, subject, con
token = 'token'
# test processor
- with patch.object(continuation_in_notification, '_get_pdfs', return_value=[]) as mock_get_pdfs:
- email = continuation_in_notification.process(
+ with patch.object(continuation_authorization_notification, '_get_pdfs', return_value=[]) as mock_get_pdfs:
+ email = continuation_authorization_notification.process(
{'filingId': filing.id, 'type': 'continuationIn', 'option': status}, token)
assert CONTACT_POINT in email['recipients']
@@ -65,7 +65,7 @@ def test_continuation_in_attachments_resubmitted(session, mocker, config):
content=b'pdf_content_1',
status_code=200,
)
- output = continuation_in_notification.process(
+ output = continuation_authorization_notification.process(
{'filingId': filing.id, 'type': 'continuationIn', 'option': 'RESUBMITTED'}, token)
attachments = output['content']['attachments']
diff --git a/queue_services/business-emailer/tests/unit/test_worker.py b/queue_services/business-emailer/tests/unit/test_worker.py
index cc48db1edd..68c62fab59 100644
--- a/queue_services/business-emailer/tests/unit/test_worker.py
+++ b/queue_services/business-emailer/tests/unit/test_worker.py
@@ -24,7 +24,7 @@
from business_emailer.email_processors import (
ar_reminder_notification,
- continuation_in_notification,
+ continuation_authorization_notification,
filing_notification,
name_request,
nr_notification,
@@ -573,11 +573,11 @@ def test_involuntary_dissolution_stage_1_notification(app, db, session, mocker,
@pytest.mark.parametrize(['option', 'expected_processor'], [
(Filing.Status.PAID.value, filing_notification),
(Filing.Status.COMPLETED.value, filing_notification),
- (ReviewStatus.APPROVED.name, continuation_in_notification),
- (ReviewStatus.AWAITING_REVIEW.name, continuation_in_notification),
- (ReviewStatus.CHANGE_REQUESTED.name, continuation_in_notification),
- (ReviewStatus.REJECTED.name, continuation_in_notification),
- (ReviewStatus.RESUBMITTED.name, continuation_in_notification),
+ (ReviewStatus.APPROVED.name, continuation_authorization_notification),
+ (ReviewStatus.AWAITING_REVIEW.name, continuation_authorization_notification),
+ (ReviewStatus.CHANGE_REQUESTED.name, continuation_authorization_notification),
+ (ReviewStatus.REJECTED.name, continuation_authorization_notification),
+ (ReviewStatus.RESUBMITTED.name, continuation_authorization_notification),
])
def test_continuation_in_notification(app, db, session, mocker, option, expected_processor):
"""Assert that the worker uses the correct continuation in processor for each option."""