From b21d44f09559b3d5fba27ded5d6b317a5b6d6351 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Mon, 29 Jul 2024 20:24:59 -0400 Subject: [PATCH 1/4] Add no transition email template --- ...untary_dissolution_stage_1_notification.py | 22 ++++- ...GE-1.html => INVOL-DIS-NO-AR-STAGE-1.html} | 0 .../INVOL-DIS-NO-TR-STAGE-1.html | 85 +++++++++++++++++++ 3 files changed, 104 insertions(+), 3 deletions(-) rename queue_services/entity-emailer/src/entity_emailer/email_templates/{INVOL-DIS-STAGE-1.html => INVOL-DIS-NO-AR-STAGE-1.html} (100%) create mode 100644 queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-TR-STAGE-1.html diff --git a/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py b/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py index 64cfd519ee..10aebfee33 100644 --- a/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py +++ b/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py @@ -41,9 +41,25 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l furnishing = Furnishing.find_by_id(furnishing_id) business = furnishing.business business_identifier = business.identifier - template = Path( - f'{current_app.config.get("TEMPLATE_PATH")}/INVOL-DIS-STAGE-1.html' - ).read_text() + + # get template + if furnishing.furnishing_name in [ + Furnishing.FurnishingName.DISSOLUTION_COMMENCEMENT_NO_AR.name, + Furnishing.FurnishingName.DISSOLUTION_COMMENCEMENT_NO_AR_XPRO.name + ]: + template = Path( + f'{current_app.config.get("TEMPLATE_PATH")}/INVOL-DIS-NO-AR-STAGE-1.html' + ).read_text() + elif furnishing.furnishing_name in [ + Furnishing.FurnishingName.DISSOLUTION_COMMENCEMENT_NO_TR.name, + Furnishing.FurnishingName.DISSOLUTION_COMMENCEMENT_NO_TR_XPRO.name + ]: + template = Path( + f'{current_app.config.get("TEMPLATE_PATH")}/INVOL-DIS-NO-TR-STAGE-1.html' + ).read_text() + else: + pass + filled_template = substitute_template_parts(template) # render template with vars jnja_template = Template(filled_template, autoescape=True) diff --git a/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-STAGE-1.html b/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-AR-STAGE-1.html similarity index 100% rename from queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-STAGE-1.html rename to queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-AR-STAGE-1.html diff --git a/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-TR-STAGE-1.html b/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-TR-STAGE-1.html new file mode 100644 index 0000000000..7f60247063 --- /dev/null +++ b/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-TR-STAGE-1.html @@ -0,0 +1,85 @@ + + + + + + + + + Attention {{ business.identifier }} {{ business.legalName }} + [[style.html]] + + + + + + + + + + From d3aa92dfeb397bb2224542b177387f47a10d833a Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Tue, 30 Jul 2024 09:15:04 -0700 Subject: [PATCH 2/4] Update invol dissolution email template --- .../entity-emailer/requirements.txt | 18 +++++++-------- ...untary_dissolution_stage_1_notification.py | 22 +++++-------------- ...AR-STAGE-1.html => INVOL-DIS-STAGE-1.html} | 17 ++++++++++++++ .../entity-emailer/tests/unit/test_worker.py | 2 +- 4 files changed, 32 insertions(+), 27 deletions(-) rename queue_services/entity-emailer/src/entity_emailer/email_templates/{INVOL-DIS-NO-AR-STAGE-1.html => INVOL-DIS-STAGE-1.html} (77%) diff --git a/queue_services/entity-emailer/requirements.txt b/queue_services/entity-emailer/requirements.txt index 4492e99ddc..d579a477a9 100644 --- a/queue_services/entity-emailer/requirements.txt +++ b/queue_services/entity-emailer/requirements.txt @@ -1,19 +1,19 @@ aiohttp==3.8.4 aiosignal==1.3.1 -alembic==1.6.0 +alembic==1.7.5 aniso8601==9.0.1 arrow==1.2.3 async-timeout==4.0.2 asyncio-nats-client==0.11.4 asyncio-nats-streaming==0.4.0 attrs==23.1.0 -Babel==2.12.1 +Babel==2.9.1 blinker==1.4 -cachelib==0.1.1 +cachelib==0.9.0 certifi==2020.12.5 chardet==4.0.0 charset-normalizer==3.1.0 -click==7.1.2 +click==8.1.3 datedelta==1.3 dpath==2.0.1 ecdsa==0.14.1 @@ -54,12 +54,12 @@ pydantic==1.10.2 PyPDF2==1.26.0 pyRFC3339==1.1 pyrsistent==0.17.3 -python-dateutil==2.8.2 +python-dateutil==2.8.1 python-dotenv==0.17.1 python-editor==1.0.4 python-jose==3.2.0 -pytz==2023.3 -reportlab==3.6.12 +pytz==2024.1 +reportlab==4.2.0 requests==2.25.1 rfc3339-validator==0.1.4 rfc3987==1.3.8 @@ -67,9 +67,9 @@ rsa==4.7.2 semver==2.13.0 sentry-sdk==1.20.0 six==1.15.0 -SQLAlchemy==1.3.24 +SQLAlchemy==1.4.44 SQLAlchemy-Continuum==1.3.13 -SQLAlchemy-Utils==0.37.1 +SQLAlchemy-Utils==0.37.8 strict-rfc3339==0.7 typing-extensions==4.5.0 uri-template==1.2.0 diff --git a/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py b/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py index 10aebfee33..e531bad1a6 100644 --- a/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py +++ b/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py @@ -43,22 +43,9 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l business_identifier = business.identifier # get template - if furnishing.furnishing_name in [ - Furnishing.FurnishingName.DISSOLUTION_COMMENCEMENT_NO_AR.name, - Furnishing.FurnishingName.DISSOLUTION_COMMENCEMENT_NO_AR_XPRO.name - ]: - template = Path( - f'{current_app.config.get("TEMPLATE_PATH")}/INVOL-DIS-NO-AR-STAGE-1.html' - ).read_text() - elif furnishing.furnishing_name in [ - Furnishing.FurnishingName.DISSOLUTION_COMMENCEMENT_NO_TR.name, - Furnishing.FurnishingName.DISSOLUTION_COMMENCEMENT_NO_TR_XPRO.name - ]: - template = Path( - f'{current_app.config.get("TEMPLATE_PATH")}/INVOL-DIS-NO-TR-STAGE-1.html' - ).read_text() - else: - pass + template = Path( + f'{current_app.config.get("TEMPLATE_PATH")}/INVOL-DIS-STAGE-1.html' + ).read_text() filled_template = substitute_template_parts(template) # render template with vars @@ -70,7 +57,8 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l html_out = jnja_template.render( business=business.json(), entity_dashboard_url=get_entity_dashboard_url(business_identifier, token), - extra_provincials=extra_provincials + extra_provincials=extra_provincials, + furnishing_name=furnishing.furnishing_name ) # get recipients recipients = [] diff --git a/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-AR-STAGE-1.html b/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-STAGE-1.html similarity index 77% rename from queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-AR-STAGE-1.html rename to queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-STAGE-1.html index 066047d732..d9bc2b0bd0 100644 --- a/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-AR-STAGE-1.html +++ b/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-STAGE-1.html @@ -23,19 +23,36 @@ [[20px.html]] + {% if 'NO_AR' in furnishing_name %}

Your business is in the process of being dissolved because it hasn't filed its required annual reports. Please file your overdue annual reports as soon as possible by logging into your Business Page.

+ {% else %} +

Your business is in the process of being dissolved because it hasn't + filed its required Post Restoration Transition Application (PRTA). + Please file your overdue PRTA as soon as possible by logging into + your Business Page. +

+ {% endif %} [[whitespace-16px.html]] + {% if 'NO_AR' in furnishing_name %}

Under the Business Corporations Act, if you don't file these reports within one month from today, the Registrar will post a public notice on www.bclaws.ca. This notice will state that your company may be dissolved if the annual reports aren't filed after one month.

+ {% else %} +

+ Under the Business Corporations Act, if you don't file your PRTA + within one month from today, the Registrar will post a public notice + on www.bclaws.ca. This notice will state that your company may be + dissolved if the PRTA aren't filed after one month. +

+ {% endif %} [[whitespace-16px.html]] diff --git a/queue_services/entity-emailer/tests/unit/test_worker.py b/queue_services/entity-emailer/tests/unit/test_worker.py index f0a97faf51..2d3a5a41ff 100644 --- a/queue_services/entity-emailer/tests/unit/test_worker.py +++ b/queue_services/entity-emailer/tests/unit/test_worker.py @@ -480,7 +480,7 @@ def test_send_email_with_incomplete_payload(app, session, email_msg): ]) def test_involuntary_dissolution_stage_1_notification(app, db, session, mocker, test_name, exception, furnishing_name, expected_furnishing_status): - """Assert that the stage 1 overdue ARs notification can be processed.""" + """Assert that the stage 1 notifications can be processed.""" business_identifier = 'BC1234567' business = create_business(business_identifier, 'BC', 'Test Business') furnishing = create_furnishing(session, business=business) From d3983e38fba592913c306d44cda4bc9208261a25 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Tue, 30 Jul 2024 09:20:02 -0700 Subject: [PATCH 3/4] Clean up code changes --- .../entity-emailer/requirements.txt | 18 ++-- ...untary_dissolution_stage_1_notification.py | 2 - .../INVOL-DIS-NO-TR-STAGE-1.html | 85 ------------------- 3 files changed, 9 insertions(+), 96 deletions(-) delete mode 100644 queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-TR-STAGE-1.html diff --git a/queue_services/entity-emailer/requirements.txt b/queue_services/entity-emailer/requirements.txt index d579a477a9..4492e99ddc 100644 --- a/queue_services/entity-emailer/requirements.txt +++ b/queue_services/entity-emailer/requirements.txt @@ -1,19 +1,19 @@ aiohttp==3.8.4 aiosignal==1.3.1 -alembic==1.7.5 +alembic==1.6.0 aniso8601==9.0.1 arrow==1.2.3 async-timeout==4.0.2 asyncio-nats-client==0.11.4 asyncio-nats-streaming==0.4.0 attrs==23.1.0 -Babel==2.9.1 +Babel==2.12.1 blinker==1.4 -cachelib==0.9.0 +cachelib==0.1.1 certifi==2020.12.5 chardet==4.0.0 charset-normalizer==3.1.0 -click==8.1.3 +click==7.1.2 datedelta==1.3 dpath==2.0.1 ecdsa==0.14.1 @@ -54,12 +54,12 @@ pydantic==1.10.2 PyPDF2==1.26.0 pyRFC3339==1.1 pyrsistent==0.17.3 -python-dateutil==2.8.1 +python-dateutil==2.8.2 python-dotenv==0.17.1 python-editor==1.0.4 python-jose==3.2.0 -pytz==2024.1 -reportlab==4.2.0 +pytz==2023.3 +reportlab==3.6.12 requests==2.25.1 rfc3339-validator==0.1.4 rfc3987==1.3.8 @@ -67,9 +67,9 @@ rsa==4.7.2 semver==2.13.0 sentry-sdk==1.20.0 six==1.15.0 -SQLAlchemy==1.4.44 +SQLAlchemy==1.3.24 SQLAlchemy-Continuum==1.3.13 -SQLAlchemy-Utils==0.37.8 +SQLAlchemy-Utils==0.37.1 strict-rfc3339==0.7 typing-extensions==4.5.0 uri-template==1.2.0 diff --git a/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py b/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py index e531bad1a6..43db7ba987 100644 --- a/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py +++ b/queue_services/entity-emailer/src/entity_emailer/email_processors/involuntary_dissolution_stage_1_notification.py @@ -41,12 +41,10 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l furnishing = Furnishing.find_by_id(furnishing_id) business = furnishing.business business_identifier = business.identifier - # get template template = Path( f'{current_app.config.get("TEMPLATE_PATH")}/INVOL-DIS-STAGE-1.html' ).read_text() - filled_template = substitute_template_parts(template) # render template with vars jnja_template = Template(filled_template, autoescape=True) diff --git a/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-TR-STAGE-1.html b/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-TR-STAGE-1.html deleted file mode 100644 index 7f60247063..0000000000 --- a/queue_services/entity-emailer/src/entity_emailer/email_templates/INVOL-DIS-NO-TR-STAGE-1.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - Attention {{ business.identifier }} {{ business.legalName }} - [[style.html]] - - - - - - - - - - From 325ead0220787f0440d9e4c942bc47b3b4683960 Mon Sep 17 00:00:00 2001 From: leodube-aot Date: Wed, 31 Jul 2024 15:09:52 -0700 Subject: [PATCH 4/4] Add unit test --- .../entity-emailer/tests/unit/test_tracker.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/queue_services/entity-emailer/tests/unit/test_tracker.py b/queue_services/entity-emailer/tests/unit/test_tracker.py index 8e6fc5147f..88f837d96b 100644 --- a/queue_services/entity-emailer/tests/unit/test_tracker.py +++ b/queue_services/entity-emailer/tests/unit/test_tracker.py @@ -140,6 +140,23 @@ } } }), + ('f36e3af7-90c3-4859-a6f6-2feefbdc1e30', + { + 'specversion': '1.x-wip', + 'type': 'bc.registry.dissolution', + 'source': 'furnishingsJob', + 'id': 'f36e3af7-90c3-4859-a6f6-2feefbdc1e30', + 'time': '', + 'datacontenttype': 'application/json', + 'identifier': 'BC123223', + 'data': { + 'furnishing': { + 'type': 'INVOLUNTARY_DISSOLUTION', + 'furnishingId': 1, + 'furnishingName': 'DISSOLUTION_COMMENCEMENT_NO_TR' + } + } + }), ('bc.registry.affiliation_1', { 'type': 'bc.registry.affiliation',