mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 05:58:53 -04:00
Update ses callback to interpret hard and soft bounces.
If the notification has a status == sending then update the status otherwise do not update the status. In other words do not change the status more than once.
This commit is contained in:
@@ -58,6 +58,11 @@ def process_ses_response():
|
||||
), 400
|
||||
|
||||
notification_type = ses_message['notificationType']
|
||||
if notification_type == 'Bounce':
|
||||
if ses_message['bounce']['bounceType'] == 'Permanent':
|
||||
notification_type = ses_message['bounce']['bounceType'] # permanent or not
|
||||
else:
|
||||
notification_type = 'Temporary'
|
||||
try:
|
||||
aws_response_dict = get_aws_responses(notification_type)
|
||||
except KeyError:
|
||||
@@ -87,12 +92,14 @@ def process_ses_response():
|
||||
notification_status,
|
||||
notification_statistics_status
|
||||
) == 0:
|
||||
message = "SES callback failed: notification either not found or already updated " \
|
||||
"from sending. Status {}".format(notification_status)
|
||||
current_app.logger.info(
|
||||
"SES callback failed: notification not found. Status {}".format(notification_status)
|
||||
message
|
||||
)
|
||||
return jsonify(
|
||||
result="error",
|
||||
message="SES callback failed: notification not found. Status {}".format(notification_status)
|
||||
message=message
|
||||
), 404
|
||||
|
||||
if not aws_response_dict['success']:
|
||||
|
||||
Reference in New Issue
Block a user