Commit Graph

549 Commits

Author SHA1 Message Date
Martyn Inglis
b88b0499b9 Order jobs on dashboard page 2016-03-14 16:31:57 +00:00
Martyn Inglis
beb6f7ca57 Order jobs by service
- newest first
2016-03-14 16:15:39 +00:00
minglis
1aa6856ec0 Merge pull request #149 from alphagov/client-callbacks
SES Callback testing
2016-03-14 14:51:53 +00:00
Martyn Inglis
3192f5f6d1 SES Callback testing
- SES/AWS JSON is horrible and not valid.
- JSON in tests did not test accurately what it looked like in reality
- Using very odd looking bytes/strings as input into API which is more accurate
2016-03-14 14:49:02 +00:00
minglis
2982c51e83 Merge pull request #146 from alphagov/client-callbacks
Client callbacks
2016-03-14 11:49:10 +00:00
Martyn Inglis
1ff4ebad5c Merge branch 'master' into client-callbacks
Conflicts:
	app/notifications/rest.py
	tests/app/celery/test_tasks.py
2016-03-14 11:45:21 +00:00
Martyn Inglis
fd973179cc - Commit session on job update
- log at exception level
2016-03-14 11:34:09 +00:00
Rebecca Law
c75bb9c5c3 Merge pull request #148 from alphagov/error-handing
Error handing
2016-03-14 09:31:59 +00:00
Rebecca Law
b96b226bad Log exception 2016-03-11 15:52:28 +00:00
Rebecca Law
123b0ead3a Replaced first queries with one queries, which throws a NoResultFound.
Able to remove many of the None checks as a result of this.
Fixed the tests were needed.
2016-03-11 15:34:20 +00:00
Rebecca Law
ef5969be77 Merge branch 'master' into error-handing 2016-03-11 13:59:16 +00:00
Chris Hill-Scott
ee3f2c3e65 Merge pull request #147 from alphagov/fix-phone-number-matching-restricted-service
Be agnostic about format when comparing phone numbers
2016-03-11 13:51:00 +00:00
Chris Hill-Scott
d6cf15469f Be agnostic about format when comparing phone #s
If a service is in restricted mode then a user can’t send messages to anyone
other than themselves and members of their team. To do this the API has to
compare the numbers they are sending to with those of their team members.

It will (falsely) say the numbers do not match if they are in a different
format, eg 07700 900849 vs +447700900849

This commit uses the code we use elsewhere for formatting phone numbers to
make sure that both numbers are in a consistent format before doing a
comparison.

I have a strong preference for doing it this way, rather than formatting numbers
before we store them:

1. https://en.wikipedia.org/wiki/Robustness_principle
2. It’s confusing to a user to see their own phone number formatted in a
   different way to that which they entered it, and the alternative, storing
   the phone number in two different formats is grim
2016-03-11 13:19:54 +00:00
Rebecca Law
e055590b07 Changed db queries to use one, which throws NoResultFound exception, this exception is dealt with in our error handlers.
Now a lot of the if none checks can be removed.
2016-03-11 12:39:55 +00:00
Martyn Inglis
62a7b8bcd0 Update notification status by message reference
- SES sends a reference to allow us to identify the notification
- use this to update status

If source of email is one of our internal emails (invites or validations) - don't try and update a notification.
2016-03-11 10:19:40 +00:00
Martyn Inglis
901d04605f Ad a reference to the model
- used if 3rd party needs to record an ID for reconciliation purposes
2016-03-11 09:40:35 +00:00
Martyn Inglis
8d9b5b172b Changed exception type to ValueError 2016-03-11 09:06:22 +00:00
Martyn Inglis
58c78f864b Changed path to decode error for 3.4.x compatibility 2016-03-11 09:00:02 +00:00
Martyn Inglis
2d3364d946 Fixing import path to JSON decode exception 2016-03-11 08:37:04 +00:00
Martyn Inglis
f88f86a924 Endpoint to allow SES updates to occur
- update notification with delivery state
2016-03-10 17:29:17 +00:00
Martyn Inglis
2922712f0b Make sms code task use a reference too
- makes the fire text callback behave in consistent way
2016-03-10 15:51:11 +00:00
Martyn Inglis
1f22f2b7cc Updates to fire text integration:
- client updated to raise errors with fire text error codes/messages

New endpoint
- /notifications/sms/firetext
For delivery notifications to be sent to.
2016-03-10 15:40:41 +00:00
Martyn Inglis
c580b9c084 Pass notification ID to fire text as our reference
- also handle fire text errors, non-zero response code means error.
2016-03-10 13:22:45 +00:00
minglis
209244ff19 Merge pull request #144 from alphagov/delete-expired-things
Delete expired things
2016-03-10 12:45:31 +00:00
NIcholas Staples
c29769724a Merge pull request #145 from alphagov/duplicate_service_name_bug
Duplicate service name check added and all tests passing.
2016-03-10 10:40:31 +00:00
Nicholas Staples
b409e4459d Duplicate service name check added and all tests passing. 2016-03-10 10:34:46 +00:00
Martyn Inglis
685c66b3d3 Print statement 2016-03-10 09:57:44 +00:00
Martyn Inglis
fd7eb54d10 Merge branch 'master' into delete-expired-things
Conflicts:
	app/celery/tasks.py
	tests/app/celery/test_tasks.py
	tests/app/dao/test_notification_dao.py
2016-03-10 09:48:29 +00:00
Martyn Inglis
976a4c06e3 Renamed some files and fixed a bug on deleting the failed notifications 2016-03-10 09:34:27 +00:00
Martyn Inglis
c8a5366484 Scheduled tasks to clean up the database
- tasks run hourly
- uses celery beat to schedule the tasks

4 new tasks
- delete verify codes (after 1 day)
- delete invitations (after 1 day)
- delete successful notifications  (after 1 day)
- delete failed notifications (after 7 days)

Delete methods in the DAO classes
2016-03-09 17:46:01 +00:00
minglis
ff97d0b064 Merge pull request #143 from alphagov/rate-limit
Rate limit
2016-03-09 15:08:49 +00:00
Martyn Inglis
593d753ed5 Updated tests 2016-03-09 14:52:07 +00:00
Martyn Inglis
45b19a49a4 Updated tests 2016-03-09 14:49:14 +00:00
Martyn Inglis
fbfa176895 First schedule 2016-03-09 14:41:36 +00:00
Martyn Inglis
2a13fe4a54 Merge branch 'master' into rate-limit
Conflicts:
	app/celery/tasks.py
	tests/app/celery/test_tasks.py
2016-03-09 14:16:59 +00:00
Martyn Inglis
4a880af8ef Drop all services sending limits to 50. 2016-03-09 14:03:44 +00:00
Martyn Inglis
b0074449bd Adds another job state to account for when sending limits have been exceeded. 2016-03-09 13:57:53 +00:00
Martyn Inglis
61af70a392 Some more tests around edge cases 2016-03-09 11:35:12 +00:00
Martyn Inglis
14d621d243 Job processing respects sendlimits
- If a job starts it MUST be able to fit into the days sending limits
- So if service limit is 10, and we've sent 5 messages and the current job is 4 then it's OK.
- If the job is 6 then it's over the limit and it should fail
- Job should NOT start if can't complete in the limit
2016-03-09 11:28:52 +00:00
Chris Hill-Scott
03f5f01a51 Merge pull request #142 from alphagov/allow-csvs-with-extra-personalisation
Accept CSV files with additional columns
2016-03-09 11:13:18 +00:00
Martyn Inglis
61a0cf32c8 Ensure clients have rate limit enforced
- rate limiting is a hard number per day
- not limited in terms of rate of request
- limit is a single number held against the service
- every notification counts against the limit, regardless of type
- return a 429 if limit exceeded.
2016-03-09 11:06:37 +00:00
Rebecca Law
63fa6ddbbb Merge pull request #139 from alphagov/reset-password
Reset password
2016-03-09 10:42:38 +00:00
Rebecca Law
d0c5977b9d Fix extra space in test 2016-03-09 09:57:14 +00:00
Chris Hill-Scott
589b4de5f9 Accept CSV files with additional columns
Currently when the Celery task processes a CSV it will call the API with the
values for all the non-recipient columns in the `personalisation` field. This
means that those API calls would fail, even though the CSV has been processed
‘successfully’.

This was not being caught by the tests, so this commit adds extra tests to check
what data the task is passing to the API call.

It then updates utils to version 2.0.1 which brings in this fix:
https://github.com/alphagov/notifications-utils/pull/10
2016-03-09 09:52:39 +00:00
Rebecca Law
49198b26e7 Merge branch 'master' into reset-password
Conflicts:
	app/schemas.py
	tests/app/celery/test_tasks.py
2016-03-09 09:36:57 +00:00
NIcholas Staples
528f570ab6 Merge pull request #141 from alphagov/capture-aggregate-data
Capture aggregate data
2016-03-08 17:54:39 +00:00
Rebecca Law
114cfa6b17 Use the validation error message from the InvalidEmailError 2016-03-08 17:46:00 +00:00
Martyn Inglis
e07d16e8c6 Fixed up dates so that we respect mills 2016-03-08 17:45:37 +00:00
Chris Hill-Scott
6308a5b2ca Merge pull request #140 from alphagov/remove_delivery_config
Removed DELIVERY_CLIENT_USER_NAME and DELIVERY_CLIENT_SECRET
2016-03-08 17:10:44 +00:00
Martyn Inglis
67c4bd2263 Build rest endpoint to read service stats
- get stats by service id
- returns a list of stats objects

Not paginated - have 1 row per day.
2016-03-08 16:34:03 +00:00