diff --git a/queue_services/account-mailer/src/account_mailer/email_templates/pad_invoice_email.html b/queue_services/account-mailer/src/account_mailer/email_templates/pad_invoice_email.html index 6c6b47a1ec..1e415648fc 100644 --- a/queue_services/account-mailer/src/account_mailer/email_templates/pad_invoice_email.html +++ b/queue_services/account-mailer/src/account_mailer/email_templates/pad_invoice_email.html @@ -1,6 +1,10 @@ # Your {{ account_number }}: {{ account_name_with_branch }} account completed ${{ invoice_total }} in transactions during business hours on {{ invoice_process_date }}. -This amount will be debited from your financial institution in 2 business days. Please ensure you have sufficient funds in your financial institution account to cover this debit. +Transaction amount: ${{ invoice_total }} +{% if credit_total != '0.00' %}Account credits: -${{ credit_total }}{% endif %} +Amount to be charged: ${{ withdraw_total }} + +${{ withdraw_total }} will be debited from your financial institution in 2 business days. Please ensure you have sufficient funds in your financial institution account to cover this debit. Your account will be suspended and charged a ${{ nsf_fee }} dishonoured bank instrument fee for every failed payment. diff --git a/queue_services/account-mailer/src/account_mailer/enums.py b/queue_services/account-mailer/src/account_mailer/enums.py index 5de5443768..1a5207104a 100644 --- a/queue_services/account-mailer/src/account_mailer/enums.py +++ b/queue_services/account-mailer/src/account_mailer/enums.py @@ -21,7 +21,7 @@ class SubjectType(Enum): NSF_LOCK_ACCOUNT_SUBJECT = '[BC Registries and Online Services] Your account has been suspended' NSF_UNLOCK_ACCOUNT_SUBJECT = 'Your Account Was Successfully Restored' ACCOUNT_CONF_OVER_SUBJECT = '[BC Registries and Online Services] Your account is now active' - PAD_INVOICE_CREATED = '[BC Registries and Online Services] Your accounts PAD transaction details' + PAD_INVOICE_CREATED = '[BC Registries and Online Services] Your PAD Transaction Details' ADMIN_REMOVED_SUBJECT = '[BC Registries and Online Services] You have been removed as an administrator' TEAM_MODIFIED_SUBJECT = '[BC Registries and Online Services] Change in Team members' ONLINE_BANKING_PAYMENT_SUBJECT = '[BC Registries and Online Services] Online Banking payment has been received' diff --git a/queue_services/account-mailer/src/account_mailer/resources/worker.py b/queue_services/account-mailer/src/account_mailer/resources/worker.py index 15b8eba921..67bf357f62 100644 --- a/queue_services/account-mailer/src/account_mailer/resources/worker.py +++ b/queue_services/account-mailer/src/account_mailer/resources/worker.py @@ -15,6 +15,7 @@ import dataclasses import json from datetime import datetime, timezone +from decimal import Decimal from http import HTTPStatus from auth_api.models import db @@ -210,10 +211,15 @@ def handle_pad_invoice_created(message_type, email_msg): admin_coordinator_emails = get_member_emails(org_id, (ADMIN,)) subject = SubjectType.PAD_INVOICE_CREATED.value invoice_process_date = datetime.fromisoformat(email_msg.get('invoice_process_date')) + credit_total = email_msg.get('credit_total', '0') + invoice_total = email_msg.get('invoice_total', '0') + withdraw_total = Decimal(str(invoice_total)) - Decimal(str(credit_total)) args = { + 'credit_total': format_currency(credit_total), 'nsf_fee': format_currency(email_msg.get('nsfFee')), - 'invoice_total': format_currency(email_msg.get('invoice_total')), - 'invoice_process_date': get_local_formatted_date(invoice_process_date, '%m-%d-%Y') + 'invoice_total': format_currency(invoice_total), + 'invoice_process_date': get_local_formatted_date(invoice_process_date, '%m-%d-%Y'), + 'withdraw_total': format_currency(str(withdraw_total)) } logo_url = email_msg.get('logo_url') email_dict = common_mailer.process(org_id, admin_coordinator_emails, template_name, diff --git a/queue_services/account-mailer/tests/unit/test_worker_queue.py b/queue_services/account-mailer/tests/unit/test_worker_queue.py index ad097ae9f2..c6d0b3b0a4 100644 --- a/queue_services/account-mailer/tests/unit/test_worker_queue.py +++ b/queue_services/account-mailer/tests/unit/test_worker_queue.py @@ -224,9 +224,11 @@ def test_account_pad_invoice_mailer_queue(app, session, client): # add an event to queue, these are provided by cfs_create_invoice_task. mail_details = { 'accountId': id, + 'credit_total': '20', 'nsfFee': '30', 'invoice_total': '100', - 'invoice_process_date': f'{datetime.now()}' + 'invoice_process_date': f'{datetime.now()}', + 'withdraw_total': '80' } helper_add_event_to_queue(client, message_type=QueueMessageTypes.PAD_INVOICE_CREATED.value,