Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

19182 - Changes to pad invoice email to consider credits #3130

Merged
merged 9 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion queue_services/account-mailer/src/account_mailer/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading