Commit Graph

696 Commits

Author SHA1 Message Date
Rebecca Law
3820090a19 WIP: building the mmg delivery receipt endpoint. 2016-04-04 18:08:37 +01:00
Adam Shimali
f6620792b5 Additional sort order by template name for template statistics. 2016-04-04 17:51:24 +01:00
Adam Shimali
e4a5e3890a Corrected error message format 2016-04-04 14:51:56 +01:00
Adam Shimali
0d06be05e1 [WIP] Added dao method and rest endpoint for getting template
statistics by service.

Some cosmetic changes to imports.

Added fix for job rest not correctly returning errors.
2016-04-04 14:38:54 +01:00
NIcholas Staples
e2d0d39ea7 Merge pull request #192 from alphagov/update_filter_for_multiple_arguments
Added functionality to allow filtering by multiple arguments.
2016-04-04 14:29:53 +01:00
Nicholas Staples
fac34aff10 Added functionality to allow filtering by multiple arguments.
Removed commented out code.
2016-04-04 13:21:51 +01:00
Rebecca Law
ec180980ee Merge branch 'master' into remove_email_safe 2016-04-01 13:45:21 +01:00
Rebecca Law
8493e29acc Added some more tests.
Removed the validation in the schema - it was adding complexity, let the unique constraint on the db throw the exception. This should only ever happen on a race condition which seems unlikely (two people changing a service to the same name at the same time)
Do no set debug=true to the test config. If debug=true it changes the behaviour of the error handlers, throwing the exception rather than returning a 500.
2016-04-01 13:42:11 +01:00
Nicholas Staples
514d490d2f No limit for live services. 2016-04-01 11:12:44 +01:00
Rebecca Law
8df4919029 The admin app now sends the email from when creating a service and when updating the service name.
This PR removes the need for the email_safe function. The api does not create the email_from field for the service.
Tests were updated to reflect this change.
2016-03-31 17:46:18 +01:00
Adam Shimali
0d0cfbb6ac Better test for failed update of stats 2016-03-31 17:20:57 +01:00
Adam Shimali
efc382f18b Added test to verify a number of notications followed by a failure does
not increment stats counts.
2016-03-31 16:53:47 +01:00
Adam Shimali
ca9c886c3e [WIP] On create of notification. Upsert record for template stats
recording usages of template by day.
2016-03-31 15:57:50 +01:00
Rebecca Law
c7c845cea6 Remove access_developer_docs as a permission type. It does not make sense to have permission for viewing the documentation.
On the downgrade method of the db script the assumption that all users with manage_api_keys had the access_developer_docs permission.
2016-03-29 17:00:42 +01:00
Adam Shimali
7bc81528bb Post endpoint to create notificaition and get endpoint
to retrieve notification by id return data in shape more
consistent with other api endpoints.
2016-03-24 13:34:45 +00:00
Nicholas Staples
090babaaeb Added endpoint for removing user from service, all tests passing. 2016-03-22 13:14:23 +00:00
Martyn Inglis
268819284f Merge branch 'master' into capture-delivery-outcomes
Conflicts:
	tests/app/notifications/test_rest.py
2016-03-21 13:32:31 +00:00
Martyn Inglis
00a04ce079 Removed SES debug line 2016-03-21 13:25:41 +00:00
Martyn Inglis
e0316d1881 Adds notification stats update into the callback process
- when a provider callback occurs and we update the status of the notification, also update the statistics table

Adds:
- Mapping object to the clients to handle mapping to various states from the response codes, this replaces the map.
- query lookup in the DAO to get the query based on response type / template type

Tests around rest class and dao to check correct updating of stats

Missing:
- multiple client callbacks will keep incrementing the counts of success/failure. This edge case needs to be handle in a future story.
2016-03-21 13:24:37 +00:00
Nicholas Staples
327f169575 Filtering added and tests working. 2016-03-21 12:37:34 +00:00
Martyn Inglis
e2cfbce8c4 Added base object for response statuses, and tests around it's behaviour 2016-03-21 09:20:38 +00:00
Chris Hill-Scott
a0022455f0 Merge pull request #173 from alphagov/email-wrapper
Add HTML email
2016-03-18 15:42:32 +00:00
Martyn Inglis
86579fba71 Merge branch 'master' into capture-delivery-outcomes 2016-03-18 15:35:51 +00:00
Chris Hill-Scott
f3ddf1f456 Add HTML email
Make the SES client optionally pass through HTML and text body, as per:
http://docs.aws.amazon.com/ses/latest/APIReference/API_Body.html

Gets the message as HTML from:
https://github.com/alphagov/notifications-utils/pull/12
2016-03-18 15:26:32 +00:00
NIcholas Staples
7d99787146 Merge pull request #161 from alphagov/fix_pagination_bug
Fix pagination bug and swapped file name with original file name.
2016-03-18 15:08:30 +00:00
Adam Shimali
2d1d883283 Added task for sending email verification links out on intial
registration.

Left original email code endpoint in as it is still used for things like
email change.
2016-03-17 15:21:04 +00:00
Rebecca Law
bd26c4740c Merge branch 'master' into default-stats-to-zero 2016-03-17 11:40:49 +00:00
Rebecca Law
15fac879e3 Merge pull request #162 from alphagov/platform-admin-role
Add platform_admin boolean on the User data model.
2016-03-17 11:33:52 +00:00
Rebecca Law
b7f65feadd Set default to 0 for the notification_statistics table. 2016-03-17 11:32:55 +00:00
Rebecca Law
bd2d77fec8 Add platform_admin boolean on the User data model. 2016-03-17 10:37:24 +00:00
Nicholas Staples
f41d01780a whoops test fixes. 2016-03-16 17:01:58 +00:00
Rebecca Law
4268f8453b Use the same validation in the endpoint and the task to validate the phone number is ok to send to.
Format the phone number before sending it to the sms provider.
2016-03-16 13:36:46 +00:00
Nicholas Staples
16882961ad Added check for job in notifications json dump. 2016-03-15 14:57:15 +00:00
Martyn Inglis
69654f4209 Parking some code that updates stats when notification delivery happens 2016-03-15 14:40:42 +00:00
Nicholas Staples
356083e8ac Update schemas to return more details about the job and template for notifications. 2016-03-15 14:24:10 +00:00
minglis
c2b2ce3878 Merge pull request #151 from alphagov/order-jobs
Order jobs
2016-03-14 16:43:48 +00:00
Martyn Inglis
35b2ec513b Fixed pep8 2016-03-14 16:37:51 +00:00
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
Rebecca Law
fb24c1d04e Merge pull request #150 from alphagov/format-auth-errors
Format authentication error messages for the client.
2016-03-14 16:15:09 +00:00
Rebecca Law
fe9bf13064 Format authentication error messages for the client. 2016-03-14 15:51:04 +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
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
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
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
f88f86a924 Endpoint to allow SES updates to occur
- update notification with delivery state
2016-03-10 17:29:17 +00:00