mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 09:42:38 -05:00
Send template id and version with delivery status callback
This adds the `template_id` and `template_version` fields to the data sent to services from the `send_delivery_status_to_service` task. We need to account for the task not being passed these fields at first since there might be tasks retrying which don't have that data. Once all tasks have been called with the new fields we can then update the code to assume they are always there. Since we only send delivery status callbacks for SMS and emails, I've removed the tests where we call that task with letters.
This commit is contained in:
@@ -26,6 +26,12 @@ def send_delivery_status_to_service(
|
||||
"sent_at": status_update['notification_sent_at'],
|
||||
"notification_type": status_update['notification_type']
|
||||
}
|
||||
# TODO: set the template_id and template_version keys when data dict is created once this change has
|
||||
# been deployed long enough for all tasks to have those keys in status_update
|
||||
if status_update.get("template_id"):
|
||||
data["template_id"] = status_update['template_id']
|
||||
data["template_version"] = status_update['template_version']
|
||||
|
||||
_send_data_to_service_callback_api(
|
||||
self,
|
||||
data,
|
||||
@@ -121,6 +127,8 @@ def create_delivery_status_callback_data(notification, service_callback_api):
|
||||
"notification_type": notification.notification_type,
|
||||
"service_callback_api_url": service_callback_api.url,
|
||||
"service_callback_api_bearer_token": service_callback_api.bearer_token,
|
||||
"template_id": str(notification.template_id),
|
||||
"template_version": notification.template_version,
|
||||
}
|
||||
return encryption.encrypt(data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user