diff --git a/pay-api/src/pay_api/models/eft_refund.py b/pay-api/src/pay_api/models/eft_refund.py index 82d5e0e2e..e6b88f6bb 100644 --- a/pay-api/src/pay_api/models/eft_refund.py +++ b/pay-api/src/pay_api/models/eft_refund.py @@ -77,7 +77,7 @@ def find_refunds(cls, statuses: List[str], short_name_id: int = None): """Return all refunds by status.""" query = cls.query if statuses: - query = cls.query.filter(EFTRefund.status.in_(statuses)) + query = query.filter(EFTRefund.status.in_(statuses)) if short_name_id: - query = cls.query.filter(EFTRefund.short_name_id == short_name_id) + query = query.filter(EFTRefund.short_name_id == short_name_id) return query.all() diff --git a/pay-api/src/pay_api/services/auth.py b/pay-api/src/pay_api/services/auth.py index 29768f75c..e12b78177 100644 --- a/pay-api/src/pay_api/services/auth.py +++ b/pay-api/src/pay_api/services/auth.py @@ -14,6 +14,7 @@ """This manages all of the authorization service.""" import base64 +from typing import List from flask import abort, current_app, g @@ -148,13 +149,13 @@ def get_account_admin_users(auth_account_id, **kwargs): ).json() -def get_emails_with_keycloak_role(role: str) -> str: +def get_emails_with_keycloak_role(role: str) -> List[str]: """Retrieve emails with the specified keycloak role.""" users = get_users_with_keycloak_role(role) # Purpose of this is so our TEST users don't get hammered with emails, also our tester can easily switch this on. if flags.is_on("override-eft-refund-emails", default=False): - return flags.value("override-eft-refund-emails") - return ",".join([user["email"] for user in users]) + return flags.value("override-eft-refund-emails").split(",") + return [user["email"] for user in users] def get_users_with_keycloak_role(role: str) -> dict: diff --git a/pay-api/src/pay_api/services/eft_refund.py b/pay-api/src/pay_api/services/eft_refund.py index 50f41aa4f..8a671f9a7 100644 --- a/pay-api/src/pay_api/services/eft_refund.py +++ b/pay-api/src/pay_api/services/eft_refund.py @@ -241,7 +241,7 @@ def update_shortname_refund(refund_id: int, data: EFTShortNameRefundPatchRequest staff_body = content.render_body() expense_authority_recipients = get_emails_with_keycloak_role(Role.EFT_REFUND_APPROVER.value) send_email(expense_authority_recipients, subject, staff_body) - client_recipients = refund.refund_email + client_recipients = [refund.refund_email] client_body = content.render_body(is_for_client=True) send_email(client_recipients, subject, client_body) case _: diff --git a/pay-api/src/pay_api/services/email_service.py b/pay-api/src/pay_api/services/email_service.py index d5328b340..11ccc826e 100644 --- a/pay-api/src/pay_api/services/email_service.py +++ b/pay-api/src/pay_api/services/email_service.py @@ -27,7 +27,7 @@ from pay_api.utils.serializable import Serializable -def send_email(recipients: list, subject: str, body: str): +def send_email(recipients: list[str], subject: str, body: str): """Send the email notification.""" # Note if we send HTML in the body, we aren't sending through GCNotify, ideally we'd like to send through GCNotify. token = get_service_account_token()