diff --git a/app/clients/sms/aws_pinpoint.py b/app/clients/sms/aws_pinpoint.py index b1cf596774..bf09985d5c 100644 --- a/app/clients/sms/aws_pinpoint.py +++ b/app/clients/sms/aws_pinpoint.py @@ -4,9 +4,9 @@ import phonenumbers from app.clients.sms import SmsClient - from app.config import Config + class AwsPinpointClient(SmsClient): """ AWS Pinpoint SMS client @@ -31,7 +31,7 @@ def send_sms(self, to, content, reference, multi=True, sender=None, template_id= pool_id = Config.AWS_PINPOINT_SC_POOL_ID else: pool_id = Config.AWS_PINPOINT_DEFAULT_POOL_ID - + for match in phonenumbers.PhoneNumberMatcher(to, "US"): matched = True to = phonenumbers.format_number(match.number, phonenumbers.PhoneNumberFormat.E164) diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index b77a5d6480..f4a758aba8 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -338,7 +338,6 @@ def update_notification_to_sending(notification, provider): def provider_to_use(notification_type, notification_id, international=False, sender=None, template_id=None): - # TODO: remove the first option once we have pinpoint fully integrated if Config.AWS_PINPOINT_SC_POOL_ID is None or Config.AWS_PINPOINT_DEFAULT_POOL_ID is None: active_providers_in_order = [ @@ -346,11 +345,9 @@ def provider_to_use(notification_type, notification_id, international=False, sen for p in get_provider_details_by_notification_type(notification_type, international) if p.active and p.identifier != PINPOINT_PROVIDER ] - else: + else: active_providers_in_order = [ - p - for p in get_provider_details_by_notification_type(notification_type, international) - if p.active + p for p in get_provider_details_by_notification_type(notification_type, international) if p.active ] if not active_providers_in_order: