Commit Graph

23 Commits

Author SHA1 Message Date
Rebecca Law
4fc004b00a Increase the number of days we calculate billing from 3 to 10 days.
Log exception if the billing counts for letters are different in the dvla response file than what we collected.
2018-07-24 16:28:30 +01:00
Rebecca Law
0dc50190b2 Throw an exception whenever we updated a notification to technical failure.
If this is happening we want to know about it.
2018-03-16 17:18:44 +00:00
Rebecca Law
82cc6d6bef As it turns out the s3ftp used to mount the s3 bucket to our ftp server puts the file on s3 more than once. So the SNS topic is triggered more than once.
We need to deal with this, it's ok when updating a notification status from delivered to delivered. But the DailySortedLetter counts are being doubled.
Adding the file_name to the table as a unique key to get around this issue. It will mean we have multiple rows for each billing_day, but that's ok we can aggregate that.
This will also give us a way to see which file created which count.
2018-03-14 17:04:58 +00:00
Katie Smith
41a9f5a06e Change format of the letter response file we expect
We were previously expecting the letter response files to be in the
format of 'NOTIFY.<datetime>.RSP.TXT' but the response files we receive
use '-' in the filenames instead of '.' which was causing an error when
we tried to get the date from the filename.
2018-03-14 09:25:51 +00:00
Katie Smith
79b5a735e2 Ensure update letter notification status always handles temporary failure
In the 'update-letter-notifications-statuses' task we want to ensure
that temporary failures are always handled, regardless of whether the
response file we receive contains unknown Sorted statuses or not.
2018-03-14 09:25:51 +00:00
Katie Smith
136d89e2f1 Persist daily sorted letter counts from response file
In the update_letter_notifications_statuses task we now check whether
each row in the response file that we receive from the DVLA has the
value of 'Sorted' or 'Unsorted' in the postcode validation field. We
then calculate the number of Sorted and Unsorted rows for each day and
save each day as a row in the daily_sorted_letter table.

The data in daily_sorted_letter table should be in local time, so we
convert the datetime before saving.
2018-03-06 09:09:02 +00:00
Rebecca Law
c474b2312b Process responses for letters even after the notification has been deleted.
This will continue to update the notification history for letter notifications.
We currently have an issue where the responses to letters from the provider is taking a long time.
This is due to the manual nature of their process.
Updating the status of the letter will still work if the notification has been purged.

Also turned back on the purge letter notification scheduled task.
2018-03-02 11:29:22 +00:00
Rebecca Law
d6c929d127 Another unused method to delete 2018-03-02 11:05:06 +00:00
Rebecca Law
385653af44 Added a new exception type for DVLAException.
The Notify team needs to investigate when a notification is marked as failed.
We will process the whole file and mark the notifications with the appropriate status, if any are failed an exception is raised.
The exception will trigger a cloud watch error for the team to investigate.
2018-02-22 15:05:37 +00:00
Katie Smith
84e25d6b98 Compare letter page count with billable units in DVLA response file
We compare the page_count in the response file we receive from the DVLA
with the billable_units of the letter. If these don't match, we log an
error.
2018-01-23 08:59:01 +00:00
Katie Smith
f1c75c5c5d 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.
2018-01-23 08:59:01 +00:00
Katie Smith
83711a9a0d Remove the delivery receipt callback for letters
This has been removed because the services only see one status.

Pivotal story: https://www.pivotaltracker.com/story/show/153674962
2018-01-03 16:41:10 +00:00
venusbb
cef8d6e294 use callback queue 2017-12-13 11:55:08 +00:00
venusbb
20b306bfdb added more unit tests 2017-12-05 13:57:46 +00:00
venusbb
5482ee4fe7 - wrap apply_async parameter notification_id in a str() argument
- check if service_callback_api exist before putting tasks on queue
- create_service_callback_api in tests before asserting if send_delivery_status_to_service has been called.
2017-12-04 17:58:38 +00:00
venusbb
f5a0ca9184 Added delivery status to services for letter callbacks 2017-12-01 21:59:46 +00:00
Rebecca Law
ca10c72fe6 Fix typo 2017-10-27 16:00:07 +01:00
Rebecca Law
76c8b15f59 Update the billable units with the page count from the response file for letter notifications. 2017-10-27 13:53:55 +01:00
Ken Tsang
204f170de2 Use NOTIFICATION_TECHNICAL_FAILURE not NOTIFICATION_FAILED 2017-10-25 15:39:54 +01:00
Ken Tsang
ab55650871 Reordered imports 2017-10-25 10:48:35 +01:00
Ken Tsang
5da119f824 Update letter noti status based on dvla response file 2017-10-25 10:48:35 +01:00
Rebecca Law
0db39bfac8 Fix the unit tests.
I think there was some imports missed when resolving merge conflicts.
Also I'm not sure why the test_update_letter_notification_to_sent or error passed, I've updated them so they do pass.
2017-10-02 15:29:13 +01:00
Leo Hemsted
c97b130540 test dvla callback update tasks 2017-09-26 12:36:42 +01:00