mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
notify-api-522
This commit is contained in:
@@ -90,20 +90,24 @@ def _decide_permanent_temporary_failure(current_status, status):
|
||||
return status
|
||||
|
||||
|
||||
def _update_notification_status(notification, status, provider_response=None):
|
||||
def _update_notification_status(
|
||||
notification, status, provider_response=None, carrier=None
|
||||
):
|
||||
status = _decide_permanent_temporary_failure(
|
||||
current_status=notification.status, status=status
|
||||
)
|
||||
notification.status = status
|
||||
if provider_response:
|
||||
notification.provider_response = provider_response
|
||||
if carrier:
|
||||
notification.carrier = carrier
|
||||
dao_update_notification(notification)
|
||||
return notification
|
||||
|
||||
|
||||
@autocommit
|
||||
def update_notification_status_by_id(
|
||||
notification_id, status, sent_by=None, provider_response=None
|
||||
notification_id, status, sent_by=None, provider_response=None, carrier=None
|
||||
):
|
||||
notification = (
|
||||
Notification.query.with_for_update()
|
||||
@@ -137,12 +141,15 @@ def update_notification_status_by_id(
|
||||
return None
|
||||
if provider_response:
|
||||
notification.provider_response = provider_response
|
||||
if carrier:
|
||||
notification.carrier = carrier
|
||||
if not notification.sent_by and sent_by:
|
||||
notification.sent_by = sent_by
|
||||
return _update_notification_status(
|
||||
notification=notification,
|
||||
status=status,
|
||||
provider_response=notification.provider_response,
|
||||
carrier=notification.carrier,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user