Change notification status of failed letters

- Changed the notification status of letters for letters that DVLA marks
as 'failed' from NOTIFICATION_TECHNICAL_FAILURE to
NOTIFICATION_TEMPORARY_FAILURE.
This commit is contained in:
Katie Smith
2018-01-15 14:22:09 +00:00
parent 6a3c2734ca
commit f1c75c5c5d
2 changed files with 4 additions and 2 deletions

View File

@@ -63,6 +63,7 @@ from app.models import (
LETTER_TYPE, LETTER_TYPE,
NOTIFICATION_DELIVERED, NOTIFICATION_DELIVERED,
NOTIFICATION_SENDING, NOTIFICATION_SENDING,
NOTIFICATION_TEMPORARY_FAILURE,
NOTIFICATION_TECHNICAL_FAILURE, NOTIFICATION_TECHNICAL_FAILURE,
SMS_TYPE, SMS_TYPE,
) )
@@ -476,7 +477,7 @@ def update_letter_notifications_statuses(self, filename):
else: else:
for update in notification_updates: for update in notification_updates:
status = NOTIFICATION_DELIVERED if update.status == DVLA_RESPONSE_STATUS_SENT \ status = NOTIFICATION_DELIVERED if update.status == DVLA_RESPONSE_STATUS_SENT \
else NOTIFICATION_TECHNICAL_FAILURE else NOTIFICATION_TEMPORARY_FAILURE
updated_count = dao_update_notifications_by_reference( updated_count = dao_update_notifications_by_reference(
references=[update.reference], references=[update.reference],
update_dict={"status": status, update_dict={"status": status,

View File

@@ -10,6 +10,7 @@ from app.models import (
NOTIFICATION_CREATED, NOTIFICATION_CREATED,
NOTIFICATION_DELIVERED, NOTIFICATION_DELIVERED,
NOTIFICATION_SENDING, NOTIFICATION_SENDING,
NOTIFICATION_TEMPORARY_FAILURE,
NOTIFICATION_TECHNICAL_FAILURE NOTIFICATION_TECHNICAL_FAILURE
) )
from app.celery.tasks import ( from app.celery.tasks import (
@@ -107,7 +108,7 @@ def test_update_letter_notifications_statuses_persisted(notify_api, mocker, samp
assert sent_letter.status == NOTIFICATION_DELIVERED assert sent_letter.status == NOTIFICATION_DELIVERED
assert sent_letter.billable_units == 1 assert sent_letter.billable_units == 1
assert sent_letter.updated_at assert sent_letter.updated_at
assert failed_letter.status == NOTIFICATION_TECHNICAL_FAILURE assert failed_letter.status == NOTIFICATION_TEMPORARY_FAILURE
assert failed_letter.billable_units == 2 assert failed_letter.billable_units == 2
assert failed_letter.updated_at assert failed_letter.updated_at