Commit Graph

815 Commits

Author SHA1 Message Date
Nicholas Staples
3b1423a2ea Provider Statistics added.
Rates command added with a test.

Updated to include added migration.
2016-04-21 13:47:04 +01:00
Adam Shimali
054d8baa0a Changed notifications stats day column to date type from string. 2016-04-20 15:38:06 +01:00
Rebecca Law
794e922d94 Merge pull request #248 from alphagov/mmg-client-fix
Update MMG responses so that 3 is success.
2016-04-20 14:45:08 +01:00
Rebecca Law
9a25062943 Update mmg responses so that 3 is success.
Status codes from mmg are:
2: UNDELIVERABLE Message is undeliverable.
3: DELIVERED Message is delivered.
4: EXPIRED Message is expired.
5: REJECTED Message is rejected.
2016-04-20 14:29:31 +01:00
Nicholas Staples
bee23281fc Updated text send to user for the authorization code. 2016-04-20 12:02:17 +01:00
Rebecca Law
7187ba6dc7 Merge pull request #242 from alphagov/mmg-client-fix
Update to processing the the response from MMG
2016-04-20 11:27:37 +01:00
Rebecca Law
f283379646 Defend against status code 00 or 0 from mmg 2016-04-20 11:07:21 +01:00
Chris Hill-Scott
425cc8340e Fix missing import on notification stats endpoint
The response import was missing, which broke things.

There was no test to catch this.

This commit adds a rudimentary test to make sure that the endpoint
doesn’t 500, at the very least.
2016-04-20 10:33:41 +01:00
Chris Hill-Scott
85d5c656f8 Merge pull request #241 from alphagov/get-notification-stats-last-7-days
Allow filtering of notification stats by days
2016-04-20 10:07:17 +01:00
Rebecca Law
41ce691704 Update to processing the the response from MMG
MMG changed the datatype and the status codes they send us for the delivery receipts.
This PR accounts for that change.
2016-04-20 09:45:13 +01:00
Adam Shimali
a6a18c1a6f This approach uses part of sqlalchemy example history_meta code
adapted to recording inserts and updates.

This removes need to manually create history tables.

Our code still remains in control of when history records are
created.
2016-04-19 17:13:26 +01:00
Chris Hill-Scott
9c2c9435e3 Allow filtering of notification stats by days
https://www.pivotaltracker.com/story/show/117920839

On the dashboard we want to show counts of notifications sent in the
last 7 days, plus today. So the API enpoint needs to accept an argument
to limit how many days worth of statistics it will return.

This is a bit fiddly at the DAO level because the date is just stored as
a string.
2016-04-19 16:44:19 +01:00
Nicholas Staples
31978bd987 Added page_size parameter for notifications api. All tests passing.
Add page_size and total parameters to all calls for notifications.
2016-04-19 11:26:21 +01:00
NIcholas Staples
58ab831df9 Merge pull request #229 from alphagov/process_email_subject_placeholders
Character count added and tests passing.
2016-04-18 16:16:10 +01:00
Nicholas Staples
15c4fb47f7 Added multi parameter for sending messages. 2016-04-18 09:55:56 +01:00
Nicholas Staples
f681d40366 Character count added and tests passing.
Remove sql restriction for count to not be null.
2016-04-15 16:31:13 +01:00
Chris Hill-Scott
a6f78ecdbd Merge pull request #225 from alphagov/unlink-govuk
Stop GOV.UK becoming a link in email clients
2016-04-15 13:34:06 +01:00
Chris Hill-Scott
02f903b44c Stop GOV.UK becoming a link in email clients
Implements (and depends on)
https://github.com/alphagov/notifications-utils/pull/24

Works for:
- emails we send to users, eg invite, forgot password
- email templates that users have created
2016-04-15 12:33:58 +01:00
Rebecca Law
282a62e636 Use the new version of the notifications-python-client. This version no longer adds the req and pay to the claims of the jwt.
The change is backward compatible so an older client that sends a jwt with the extra claims will pass authentication.
Once all the clients have been updated to not include the extra claims some updates to exclude them from the method signatures will happen as well.
2016-04-14 18:12:33 +01:00
Nicholas Staples
1b76646170 Working placeholders in subject with upgraded notifications-utils.
Fix test.
2016-04-13 15:53:27 +01:00
Nicholas Staples
7fa33a52a9 Fixed bug with deleting the 'delivered' notifications. 2016-04-13 12:49:38 +01:00
Rebecca Law
cf883ed339 Merge pull request #217 from alphagov/update_uuid_all_db_models
Update uuid all db models
2016-04-13 11:59:40 +01:00
Chris Hill-Scott
29b9e50952 Order templates by last updated date
The template you want to send/edit is probably one of the ones you
recently sent from or edited.

https://www.pivotaltracker.com/story/show/117159263
2016-04-11 17:39:49 +01:00
Nicholas Staples
90f0505a3d Update limit to message_limit.
Further db changes and updates.

Remove traceback print out.

Fix bug in passing template id to a task.
2016-04-11 16:53:40 +01:00
Nicholas Staples
c4b316bde6 Rebased migrations, all tests working. 2016-04-08 13:34:54 +01:00
Nicholas Staples
143d1b0db8 Updated to retrieve csv upload from new bucket.
Fix test errors.
2016-04-07 14:10:30 +01:00
Rebecca Law
fb04b36cba Fix **kwargs 2016-04-07 10:53:59 +01:00
Rebecca Law
b4473a2825 Merge branch 'master' into integrate_MMG 2016-04-07 10:44:13 +01:00
Rebecca Law
c132bbf46e Rename NOTIFY_FROM_NUMBER to MMG_FROM_NUMBER, there should be a separate short code per provider. 2016-04-07 10:18:46 +01:00
Adam Shimali
4ed2e7f8f2 Fix for misunderstanding about date range required for templates
stats.

It should always be last n days, whether or not there is data.
2016-04-07 09:30:02 +01:00
Rebecca Law
340f8ceaf6 Update mmg send_sms to include cid and request headers
Use mmg to send_sms
2016-04-06 17:35:14 +01:00
Rebecca Law
90194cbbb8 Remove the abstract ClientResponses class. Refactor aws_ses not to require the class.
All three client now use a response_map for the delivery receipt processing.
2016-04-06 16:34:45 +01:00
Rebecca Law
323b2ff537 Use MMG client for send-sms 2016-04-06 15:56:34 +01:00
Rebecca Law
e8d5a9292a Merge branch 'master' into integrate_MMG
Conflicts:
	app/notifications/rest.py
2016-04-06 14:58:13 +01:00
Rebecca Law
4806123d5c Add process_mmg_responses
Refactor process_firetext_responses
Removed the abstract ClientResponses for firetext and mmg. There is a map for each response to handle the status codes sent by each client.
Since MMG has about 20 different status code, none of which seem to be a pending state (unlike firetext that has 3 status one for pending - network delay).
For MMG status codes, look for 00 as successful, everything else is assumed to be a failure.
2016-04-06 14:31:33 +01:00
Adam Shimali
3057641e40 Change sort order for templates from name to date using full timestamp
so that it would be most recently used at top.
2016-04-06 14:30:13 +01:00
Chris Hill-Scott
044f2b7896 Merge pull request #203 from alphagov/double-check-restricted-mode
Catch sending to restricted recipients in Celery
2016-04-06 13:10:45 +01:00
Chris Hill-Scott
eef6d80ae2 Catch sending to restricted recipients in Celery
The Celery `send_sms` and `send_email` tasks _could_ assume that all the
recipients it gets are safe, because they have been checked either:
- when the admin app processes the CSV
- in the `/notifications/sms|email` endpoint

*However*, it’s probably safer to make the check again when the Celery
task run and passes the message off to the third party.

This also means that changing a service _back_ to restricted would have
an effect on messages that were queued, as well as all subsequent
messages.

This commit:
- restores the test that was removed here:
  e56aee5d1d (diff-e5627619e387fccc04783c32a23e6859L346)
- adds checks back into the Celery tasks for sending email and SMS,
  using the `allowed_to_send_to` function that was introduced into utils
  in https://github.com/alphagov/notifications-utils/pull/16
2016-04-05 15:11:27 +01:00
NIcholas Staples
2e09ead30f Merge pull request #198 from alphagov/retain_all_notifications_for_7_days
Successful notifications are deleted after a week now. All tests pass…
2016-04-05 15:05:58 +01:00
Nicholas Staples
4cc0028b01 Remove csv after process job is finished.
Fixed new tests.
2016-04-05 14:55:03 +01:00
Rebecca Law
f2ee8f3eb7 WIP 2016-04-05 14:39:59 +01:00
Nicholas Staples
4d15409781 Successful notifications are deleted after a week now. All tests passing. 2016-04-05 11:07:21 +01:00
Chris Hill-Scott
e465dc8bc4 Merge pull request #195 from alphagov/use-utils-validate-restricted
Validate recipient for restricted service using utils
2016-04-05 10:20:27 +01:00
Chris Hill-Scott
e56aee5d1d Validate recipient for restricted service w/ utils
Implements
https://github.com/alphagov/notifications-utils/pull/16

Once
https://github.com/alphagov/notifications-admin/pull/376
is merged it will no longer be possible for a user to upload a CSV file
containing recipients that they’re not allowed to send to.

So this commit also removes any restricted service checks in the task,
because any public phone numbers/email addresses no longer have any way
of reach this point if the service is restricted.
2016-04-04 20:10:19 +01:00
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
Rebecca Law
2ba12da77d WIP: adding delivery receipt endpoint for mmg 2016-04-04 15:02:21 +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