mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Revert "Process SNS request triggered by a DVLA S3 update"
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import random
|
||||
|
||||
from datetime import (datetime)
|
||||
from collections import namedtuple
|
||||
|
||||
from flask import current_app
|
||||
from notifications_utils.recipients import (
|
||||
@@ -24,10 +23,7 @@ from app.dao.jobs_dao import (
|
||||
all_notifications_are_created_for_job,
|
||||
dao_get_all_notifications_for_job,
|
||||
dao_update_job_status)
|
||||
from app.dao.notifications_dao import (
|
||||
get_notification_by_id,
|
||||
dao_update_notifications_sent_to_dvla
|
||||
)
|
||||
from app.dao.notifications_dao import get_notification_by_id, dao_update_notifications_sent_to_dvla
|
||||
from app.dao.provider_details_dao import get_current_provider
|
||||
from app.dao.services_dao import dao_fetch_service_by_id, fetch_todays_total_message_count
|
||||
from app.dao.templates_dao import dao_get_template_by_id
|
||||
@@ -358,27 +354,3 @@ def get_template_class(template_type):
|
||||
# since we don't need rendering capabilities (we only need to extract placeholders) both email and letter can
|
||||
# use the same base template
|
||||
return WithSubjectTemplate
|
||||
|
||||
|
||||
@notify_celery.task(bind=True, name='update-letter-notifications-statuses')
|
||||
@statsd(namespace="tasks")
|
||||
def update_letter_notifications_statuses(self, filename):
|
||||
bucket_location = '{}-ftp'.format(current_app.config['NOTIFY_EMAIL_DOMAIN'])
|
||||
response_file = s3.get_s3_object(bucket_location, filename).decode('utf-8')
|
||||
|
||||
try:
|
||||
NotificationUpdate = namedtuple('NotificationUpdate', ['reference', 'status', 'page_count', 'cost_threshold'])
|
||||
notification_updates = [NotificationUpdate(*line.split('|')) for line in response_file.splitlines()]
|
||||
|
||||
except TypeError:
|
||||
current_app.logger.exception('DVLA response file: {} has an invalid format'.format(filename))
|
||||
raise
|
||||
|
||||
else:
|
||||
if notification_updates:
|
||||
for update in notification_updates:
|
||||
current_app.logger.info('DVLA update: {}'.format(str(update)))
|
||||
# TODO: Update notifications with desired status
|
||||
return notification_updates
|
||||
else:
|
||||
current_app.logger.exception('DVLA response file contained no updates')
|
||||
|
||||
Reference in New Issue
Block a user