Commit Graph

2550 Commits

Author SHA1 Message Date
Imdad Ahad
4003edfa67 Add DVLA callback:
* Process SNS callback, trigger the update notifications celery task
* Put autoconfirm into its own method and use in callbacks
2017-05-15 11:12:31 +01:00
Imdad Ahad
ee484ec368 Add get_s3_file method for use in DVLA processing 2017-05-15 10:48:37 +01:00
Imdad Ahad
cd85550889 Merge pull request #953 from alphagov/revert-939-imdad-feat-process-dvla-sns-callback
Revert "Process SNS request triggered by a DVLA S3 update"
2017-05-12 17:23:00 +01:00
Imdad Ahad
7a10a91262 Revert "Process SNS request triggered by a DVLA S3 update" 2017-05-12 17:21:07 +01:00
Imdad Ahad
c1e41e7dc8 Merge pull request #939 from alphagov/imdad-feat-process-dvla-sns-callback
Process SNS request triggered by a DVLA S3 update
2017-05-12 16:37:39 +01:00
Imdad Ahad
0f7093fc38 Refactor and add filename in logging 2017-05-12 14:32:01 +01:00
Imdad Ahad
95aa5680f9 Add more logging in update letter notifications task 2017-05-12 14:24:27 +01:00
Imdad Ahad
4d82512ec6 Update SES callback to use autconfirm method 2017-05-12 14:24:27 +01:00
Imdad Ahad
37165e5b6a Add autoconfirm sns in dvla callback 2017-05-12 14:24:27 +01:00
Imdad Ahad
8a5e82904e Update to pull from correct bucket and fix tests not mocking out correctly 2017-05-12 14:24:26 +01:00
Imdad Ahad
20bb91bfdd Update DVLA callback to process request and call task (if it can) 2017-05-12 14:24:26 +01:00
Imdad Ahad
f766f90207 Add task to process a DVLA response file:
* Currently we do nothing with the parsed response. We will
* update the status of the notifications in a separate PR
2017-05-12 14:24:26 +01:00
Leo Hemsted
4d0b90bbe2 Merge pull request #943 from alphagov/schema-validation
fix v2 schema phone/email validation when non-str passed in
2017-05-11 14:42:22 +01:00
Imdad Ahad
8e9c811665 Merge pull request #945 from alphagov/imdad-migration-add-go-live-template
Add go live template (Migration)
2017-05-11 13:58:42 +01:00
Imdad Ahad
373c2b029f Add go live template 2017-05-11 12:38:32 +01:00
Rebecca Law
ae85bcf45a Merge pull request #947 from alphagov/revert-944-update-notification-international
Revert "Update notification international"
2017-05-11 12:12:46 +01:00
Rebecca Law
c7479b6fbb Revert "Update notification international" 2017-05-11 12:12:27 +01:00
Rebecca Law
75e1d922e3 Merge pull request #944 from alphagov/update-notification-international
Update notification international
2017-05-11 11:27:01 +01:00
Leo Hemsted
7032e426c2 Merge pull request #946 from alphagov/schema-fix
marshmallow schemas no longer return _status_enum column
2017-05-11 09:36:04 +01:00
Leo Hemsted
466c833c39 marshmallow schemas no longer return _status_enum column
now return `status`, as they should
2017-05-10 17:30:09 +01:00
Rebecca Law
ed4a8fba6c Script to update the international column to be not null 2017-05-10 16:14:30 +01:00
Rebecca Law
d1e9586fbb Update the script to set the international flag to do the notifications and notification_history in separate loops.
It takes about 1.5 minutes to update 27,000 notifications and 27,000 notification_history. The update is a row level lock so will only affect updates to the same row.
This is unlikely as the data being updated should be older than 3 days.
The second scripts updates the table to set international as not null, to make the model.
2017-05-10 14:38:21 +01:00
Rebecca Law
3473bc8965 Merge branch 'master' into update-notification-international 2017-05-10 14:04:18 +01:00
Rebecca Law
f0a5851d73 The script updates 10,000 rows at a time, committing after each one. This should limit the distrubtion to the environment as only the rows being updated will be locked.
It is likely those rows will not have a conflicting update at the same time since the records are older than 3 days.
2017-05-10 14:02:11 +01:00
Leo Hemsted
348183d93b Merge pull request #942 from alphagov/status-as-table
notification status as table
2017-05-10 13:54:49 +01:00
Leo Hemsted
5ec4829d00 fix v2 schema phone/email validation when non-str passed in
jsonschema states:

> A format attribute can generally only validate a given set of
> instance types. If the type of the instance to validate is not in
> this set, validation for this format attribute and instance SHOULD
> succeed.

We were not checking for the type of the input, and our validators were
behaving in unexpected manners (throwing TypeErrors etc etc). Despite
us declaring that the phone_number field is of type `str`, we still
need to make sure the validator passes gracefully, so that the inbuilt
type check can be the bit that catches if someone passes in a non-str
value. We've seen this with people passing in integers instead of strs
for phone numbers. This'll make them receive a nice 400 error
(e.g. "phone_number 12345 is not of type string"), rather than us
having a 500 internal server error
2017-05-10 11:04:12 +01:00
Leo Hemsted
c10d4a36e7 populate notification_status_types table, and add foreign keys 2017-05-09 15:46:58 +01:00
Leo Hemsted
4ff4717fdf make sure we update both statuses when updating notification history 2017-05-09 11:09:16 +01:00
Rebecca Law
aa19c727e1 Merge branch 'master' into update-notification-international 2017-05-09 10:12:14 +01:00
Rebecca Law
f5beb62c9f Merge pull request #940 from alphagov/search-by-number-or-email
Search for notification by number or email
2017-05-09 10:11:28 +01:00
Rebecca Law
a564b9aeb0 Update /service/{}/notifications to look for a "to" query string, if it exists call the search notifications_by_to_field method. 2017-05-08 17:20:21 +01:00
Rebecca Law
3513670408 Script to update the international flag in the notifications and notification_history tables.
This script may move where it is not run on db migration but as a one-off script from a server command.
2017-05-08 16:40:56 +01:00
Rebecca Law
d252dc8976 New endpoint to search by "to" field of the notification.
The query ignores case and spaces.
2017-05-05 14:12:50 +01:00
Leo Hemsted
7e52fa4d13 add new notification_status column to models.py
We now have a new column in the database, but it isn't being
populated. The first step is to make sure we update this column,
while still keeping the old enum based column up to date as well.

A couple of changes have had to happen to support this - one irritating
thing is that if we're ever querying columns individually, including
`Notification.status`, then we'll need to give that column a label,
since under the hood it translates to `Notification._status_enum`.
Accessing status through the ORM (i.e., my_noti.status = 'sending' or
similar) will work fine.
2017-05-04 17:24:28 +01:00
Leo Hemsted
34e6ab3211 add new notification_status_types static table
enums are hard to develop with - it is a slow and unchunkable change
to add a new type or remove an old type. We're slowly moving away from
using enums, in favour of static type tables, where the name is the
primary key.

This commit contains an alembic script that creates that table, and
creates a new nullable column on notifications and
notification_history that refer to it.
2017-05-04 17:08:30 +01:00
Rebecca Law
42032f871f removed Flask-Redis dependency, it's included in notification-utils. 2017-05-04 14:57:57 +01:00
kentsanggds
61eb8cd625 Merge pull request #938 from alphagov/fix-rates
Update the valid_from date for the rate
2017-05-04 10:10:48 +01:00
Rebecca Law
81e10896ea Remove print statement 2017-05-04 09:47:27 +01:00
Rebecca Law
93e76d2362 Update the valid_from date for the rate that is intended to start at the begining of the financial year.
It was the start of the financial year in BST, needed to convert it to UTC.
Small change to the logic to find the rates.
2017-05-03 17:11:48 +01:00
minglis
64ef843777 Merge pull request #936 from alphagov/switch-on-rate-limit-in-prod
Switch on API rate limiting on production.
2017-05-03 16:11:23 +01:00
kentsanggds
195f8a305a Merge pull request #937 from alphagov/udpate_rates
Udpate rates
2017-05-03 13:52:50 +01:00
Ken Tsang
03885fea2f Update tests with new rates 2017-05-03 13:13:13 +01:00
Ken Tsang
d0df5c2180 Adjust rates in line to what admin expects 2017-05-03 13:02:36 +01:00
Martyn Inglis
97dcf766bc Switch on API rate limiting on production.
Limits POST API calls to send notifications on V1/V2 to 3000 in 60 seconds.
2017-05-03 12:13:32 +01:00
kentsanggds
31069ea5f5 Merge pull request #935 from alphagov/fix-usage_future_dates
Update billing data to handle future dates
2017-05-03 10:18:14 +01:00
Ken Tsang
a1a8397f74 Update billing data to handle future dates 2017-05-02 19:23:57 +01:00
Sakis
01e3a88d55 Merge pull request #920 from alphagov/autoconfirm_http_subscriptions
Autoconfirm http subscriptions
2017-05-02 17:03:41 +01:00
minglis
2dcebc0b52 Merge pull request #917 from alphagov/rate-limit-api-calls
Rate limit api calls
2017-05-02 15:07:54 +01:00
Rebecca Law
93a325eaae Merge pull request #934 from alphagov/fix-get_rates_for_year
Fix get rates for year
2017-05-02 11:40:50 +01:00
Rebecca Law
c40111a576 Split up a test 2017-05-02 11:20:01 +01:00