mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Clean up more mmg and firetext references
This commit is contained in:
@@ -12,8 +12,7 @@ from app.dao.templates_dao import dao_get_template_by_id
|
||||
from app.models import NOTIFICATION_PENDING
|
||||
|
||||
sms_response_mapper = {
|
||||
# 'MMG': get_mmg_responses,
|
||||
# 'Firetext': get_firetext_responses,
|
||||
# 'SNS': get_sns_responses,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -147,12 +147,11 @@ def purge_functional_test_data(user_email_prefix):
|
||||
|
||||
@notify_command(name='insert-inbound-numbers')
|
||||
@click.option('-f', '--file_name', required=True,
|
||||
help="""Full path of the file to upload, file is a contains inbound numbers,
|
||||
one number per line. The number must have the format of 07... not 447....""")
|
||||
help="""Full path of the file to upload, file is a contains inbound numbers, one number per line.""")
|
||||
def insert_inbound_numbers_from_file(file_name):
|
||||
print("Inserting inbound numbers from {}".format(file_name))
|
||||
with open(file_name) as file:
|
||||
sql = "insert into inbound_numbers values('{}', '{}', 'mmg', null, True, now(), null);"
|
||||
sql = "insert into inbound_numbers values('{}', '{}', 'sns', null, True, now(), null);"
|
||||
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
|
||||
@@ -104,7 +104,7 @@ def _update_notification_status(notification, status, provider_response=None):
|
||||
|
||||
|
||||
@autocommit
|
||||
def update_notification_status_by_id(notification_id, status, sent_by=None, detailed_status_code=None):
|
||||
def update_notification_status_by_id(notification_id, status, sent_by=None):
|
||||
notification = Notification.query.with_for_update().filter(Notification.id == notification_id).first()
|
||||
|
||||
if not notification:
|
||||
@@ -134,8 +134,7 @@ def update_notification_status_by_id(notification_id, status, sent_by=None, deta
|
||||
notification.sent_by = sent_by
|
||||
return _update_notification_status(
|
||||
notification=notification,
|
||||
status=status,
|
||||
detailed_status_code=detailed_status_code
|
||||
status=status
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -24,10 +24,8 @@ def get_provider_details_by_identifier(identifier):
|
||||
|
||||
|
||||
def get_alternative_sms_provider(identifier):
|
||||
if identifier == 'firetext':
|
||||
return 'mmg'
|
||||
elif identifier == 'mmg':
|
||||
return 'firetext'
|
||||
if identifier == 'sns':
|
||||
raise Exception("No alternative SMS providers currently available")
|
||||
raise ValueError('Unrecognised sms provider {}'.format(identifier))
|
||||
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ def send_email_to_provider(notification):
|
||||
technical_failure(notification=notification)
|
||||
return
|
||||
if notification.status == 'created':
|
||||
provider = provider_to_use(EMAIL_TYPE)
|
||||
provider = provider_to_use(EMAIL_TYPE, False)
|
||||
|
||||
template_dict = SerialisedTemplate.from_id_and_service_id(
|
||||
template_id=notification.template_id, service_id=service.id, version=notification.template_version
|
||||
@@ -175,12 +175,10 @@ provider_cache = TTLCache(maxsize=8, ttl=10)
|
||||
|
||||
@cached(cache=provider_cache)
|
||||
def provider_to_use(notification_type, international=True):
|
||||
international = False # TODO: remove or resolve the functionality of this flag
|
||||
# TODO rip firetext and mmg out of early migrations and clean up the expression below
|
||||
active_providers = [
|
||||
p for p in get_provider_details_by_notification_type(
|
||||
notification_type, international
|
||||
) if p.active and p.identifier not in ['firetext', 'mmg']
|
||||
) if p.active
|
||||
]
|
||||
|
||||
if not active_providers:
|
||||
|
||||
Reference in New Issue
Block a user