Skip to content

Commit

Permalink
18380 - Affiliation Request, Email content update. (#2640)
Browse files Browse the repository at this point in the history
* 18380 - Affiliation Request, Email content update.

* Lint fix.

* Fixed, updated tests expectations with changes I did.
  • Loading branch information
hfekete authored Nov 16, 2023
1 parent 6ddc40b commit 874bc5b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 27 deletions.
3 changes: 3 additions & 0 deletions auth-api/src/auth_api/services/affiliation_invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,10 @@ def send_affiliation_invitation(affiliation_invitation: AffiliationInvitationMod

# if ACCESS REQUEST type, add data for access request type
data['fromOrgName'] = affiliation_invitation.from_org.name
data['fromOrgBranchName'] = affiliation_invitation.from_org.branch_name
data['toOrgName'] = to_org_name
data['toOrgBranchName'] = affiliation_invitation.to_org.branch_name

if is_authorized is not None:
notification_type = 'affiliationInvitationRequestAuthorization'
data['isAuthorized'] = is_authorized
Expand Down
7 changes: 7 additions & 0 deletions auth-api/tests/unit/services/test_affiliation_invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def _setup_affiliation_invitation_data(affiliation_invitation_type='EMAIL',
from_org = OrgModel()
from_org.id = 1
from_org.name = 'From the moon inc.'
from_org.branch_name = 'Luna division'
to_org = OrgModel()
to_org.id = 2
to_org.name = 'To the stars inc.'
Expand Down Expand Up @@ -518,7 +519,9 @@ def test_send_affiliation_invitation_request_sent(publish_to_mailer_mock,
'emailAddresses': affiliation_invitation.recipient_email,
'orgName': affiliation_invitation.from_org.name,
'fromOrgName': affiliation_invitation.from_org.name,
'fromOrgBranchName': affiliation_invitation.from_org.branch_name,
'toOrgName': affiliation_invitation.to_org.name,
'toOrgBranchName': affiliation_invitation.to_org.branch_name,
'additionalMessage': additional_message
}

Expand Down Expand Up @@ -558,7 +561,9 @@ def test_send_affiliation_invitation_request_authorized(publish_to_mailer_mock,
'emailAddresses': expected_email,
'orgName': affiliation_invitation.from_org.name,
'fromOrgName': affiliation_invitation.from_org.name,
'fromOrgBranchName': affiliation_invitation.from_org.branch_name,
'toOrgName': affiliation_invitation.to_org.name,
'toOrgBranchName': affiliation_invitation.to_org.branch_name,
'isAuthorized': True
}

Expand Down Expand Up @@ -600,7 +605,9 @@ def test_send_affiliation_invitation_request_refused(publish_to_mailer_mock,
'emailAddresses': expected_email,
'orgName': affiliation_invitation.from_org.name,
'fromOrgName': affiliation_invitation.from_org.name,
'fromOrgBranchName': affiliation_invitation.from_org.branch_name,
'toOrgName': affiliation_invitation.to_org.name,
'toOrgBranchName': affiliation_invitation.to_org.branch_name,
'isAuthorized': False
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
Attention **{{ account_name }}**.
Attention **{{ account }}**.

Your BC Registries and Online Services account is listed as the account managing **{{ business_name }}**.

The following account is requesting authorisation to manage Registries activities for {{ business_name }}:

**{{ requesting_account }}**

Only authorise this account if you recognize it.

Allowing **{{ requesting_account }}** to manage all Registries activities for **{{ business_name }}**, will allow it to do the following (including but not limited to):
* Authorisation of accounts to manage the business,
* Appointment and cessation of directors,
* Dissolution of the business,
* Filing of Annual Reports, and
* Changing the records office of the business.

___
{% if additional_message %}
**Message from the Requesting Account:**
**Message from the Requesting Account**

{{ additional_message }}
___
{% endif %}
Go to {{ business_name }} to respond to this request:

**Note:** This request has been sent to all Account Administrators and Coordinators of {{ account_name }}.

To manage this request from **{{ requesting_account }}** to manage Registries activities for {{ business_name }} follow the link below:
[Log in to your BC Registries Dashboard]({{ url }})

To authorise or not authorise **{{ requesting_account }}** to manage Registries activities for **{{ business_name }}**, log in to your BC Registries Account:
Only authorize this account if you recognize it.

[Log in to my BC Registries Account]({{ url }})
Allowing **{{ requesting_account }}** to manage all Registries activities for **{{ business_name }}**, will allow it to do the following (including but not limited to):

If you have questions about this request please contact the Business Registry:
Toll Free: [1-877-370-1033](1-877-370-1033)
Victoria Office: [250-370-1033](250-370-1033)
* Appoint and cease directors,
* File dissolution,
* File annual reports,
* Change the registered and records office of the business, and
* Authorize other accounts to manage this business.
___
**Note:** This request has been sent to all Account Administrators and Coordinators of {{ account }}.

If you have questions about this request please contact the Business Registry.
___
**Business Registry**
BC Registries and Online Services
Toll Free: [1-877-526-1526](1-877-526-1526)
Victoria Office:
Email: [BCRegistries@gov.bc.ca](BCRegistries@gov.bc.ca)
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
Attention {{ requesting_account }}

{% if is_authorized %}
Your BC Registries and Online Services account is now authorised to manage {{ business_name }}.
Your BC Registries and Online Services account is now authorized to manage {{ business_name }}.

To manage this business now follow the link below:
To manage this business now, [Log in to your BC Registries Dashboard]({{ url }})
{% else %}
Your request to manage {{ business_name }} has been declined.

To change your request or make a new request to manage this business follow the link below:
To change your request or make a new request to manage this business, [log in to your BC Registries Dashboard]({{ url }})
{% endif %}

[Log in to my BC Registries Account]({{ url }})
___
**Business Registry**
BC Registries and Online Services
Toll Free: [1-877-526-1526](1-877-526-1526)
Victoria Office:
Email: [BCRegistries@gov.bc.ca](BCRegistries@gov.bc.ca)
13 changes: 11 additions & 2 deletions queue_services/account-mailer/src/account_mailer/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ async def process_event(event_message: dict, flask_app):
elif message_type in {MessageType.AFFILIATION_INVITATION_REQUEST.value,
MessageType.AFFILIATION_INVITATION_REQUEST_AUTHORIZATION.value}:
business_name = email_msg.get('businessName')

requesting_account = email_msg.get('fromOrgName')
if from_branch_name := email_msg.get('fromOrgBranchName'):
requesting_account += ' - ' + from_branch_name

account = email_msg.get('toOrgName')
if to_branch_name := email_msg.get('toOrgBranchName'):
account += ' - ' + to_branch_name

email_dict = common_mailer.process(
**{
'org_id': None,
Expand All @@ -218,8 +227,8 @@ async def process_event(event_message: dict, flask_app):
'subject': SubjectType[MessageType(message_type).name].value.format(business_name=business_name),
'logo_url': logo_url,
'business_name': business_name,
'requesting_account': email_msg.get('fromOrgName'),
'account_name': email_msg.get('toOrgName'),
'requesting_account': requesting_account,
'account': account,
'is_authorized': email_msg.get('isAuthorized', None),
'additional_message': email_msg.get('additionalMessage', None)
})
Expand Down

0 comments on commit 874bc5b

Please sign in to comment.