Commit Graph

210 Commits

Author SHA1 Message Date
Adam Shimali
b51ee0b4d0 Add delivery status endpoint 2016-04-29 13:00:21 +01:00
Adam Shimali
dacbbfbf2f Endpoint for recording events in api.
An event has an id, a type and a blob of json attached.
2016-04-27 10:36:59 +01:00
Nicholas Staples
1b76646170 Working placeholders in subject with upgraded notifications-utils.
Fix test.
2016-04-13 15:53:27 +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
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
Rebecca Law
69697388d7 Initial set up for mmg client integration 2016-04-01 16:42:31 +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
Martyn Inglis
9a7788a6f5 Allowing overrides on a per environment basis 2016-03-17 11:47:44 +00:00
Martyn Inglis
6ceddf0ebf pep8 fixed 2016-03-16 14:08:25 +00:00
Martyn Inglis
27d48a9746 Pass application name in from start scripts
- allows logger to log as correct application
2016-03-16 13:25:09 +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
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
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
Martyn Inglis
e07d16e8c6 Fixed up dates so that we respect mills 2016-03-08 17:45:37 +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
Martyn Inglis
5a2cf1baca Appeased pep8 2016-03-03 15:38:22 +00:00
Martyn Inglis
24a9487a20 Updated status page
- include travis build number
- renamed properties
- ELB version
- moved code all into health check
- changed health check to be on same URL for admin and api
2016-03-03 15:18:12 +00:00
Adam Shimali
3b66745677 [WIP] Start of api for accepting invite. 2016-03-01 14:13:38 +00:00
Nicholas Staples
16e1ecb134 Working permissions and all tests passing.
Remove print statements.

Fix for review comments.
2016-02-26 15:00:29 +00:00
Martyn Inglis
a3a9d673a6 Merge branch 'master' into celery-jobs 2016-02-25 12:06:53 +00:00
Martyn Inglis
b3884e2d6c Move job processing into celery
- brings boto S3 into new AWS folder
- CSV processing utils method

Rejigs the jobs rest endpoint - removes some now unused endpoints,

Calls to the task with the job, job processing in task, delegating SMS calls to the sms task
2016-02-24 17:12:30 +00:00
Adam Shimali
e6fe10cbdc [WIP] added endpoint and dao to create invites for users.
Droped token as later code to send email invite can generate
timebased url to send to user. That can then be checked
against configurable time threshold for expiry. Therefore
no need to store a token.
2016-02-24 14:18:56 +00:00
Martyn Inglis
b01782bbe6 Send Email via the API
- uses the new subject/email from fields present on the templates / service tables
- brings the send email api call into line with the sms one.
- same fields (to/template_id)
- same rules regarding restricted services
- wired in as a task into celery

Requires
- new celery queue
- new env property (NOTIFY_EMAIL_DOMAIN)
2016-02-22 17:17:29 +00:00
Martyn Inglis
9bb95a53ec Updates to template endpoints:
- moved into templates rest class
- updated dao
- removed delete methods
- constraint on subject line
2016-02-22 12:55:18 +00:00
Rebecca Law
9073814d9f I have an issue with the test, not sure why? 2016-02-17 17:48:23 +00:00
Martyn Inglis
226459132a Basic (Very basic) implementation of the fire text API.
[https://www.firetext.co.uk/docs#sendingsms](https://www.firetext.co.uk/docs#sendingsms)

Not to be merged. This API has a limit on it at the moment that will need to be removed before it is used in anger.
2016-02-17 12:57:51 +00:00
Martyn Inglis
73d0e67e68 Removed alpha api client 2016-02-17 09:22:06 +00:00
Martyn Inglis
cb265896a7 Merge branch 'master' into move-sms-notifications-into-celery
Conflicts:
	app/__init__.py
	tests/conftest.py
2016-02-17 09:14:37 +00:00
Rebecca Law
08ba5de61b Update config
Source the configuration from an environment file, this way it is similar to how the aws environment works
2016-02-16 16:01:50 +00:00
Martyn Inglis
18d63e241b Extracted serialiser for encryption into a flask module
- allows mocking easier
- shared across methods
- not built everytime
2016-02-16 15:28:30 +00:00
Martyn Inglis
e42da7dd54 Fixing up tests to validate the call to the celery tasks.
- mocker used to test call or otherwise of the task
- no new tests just a spring clean
2016-02-16 14:06:56 +00:00
Martyn Inglis
655beddba6 Fixed up the get_notitication endpoint
- returns a notification
2016-02-16 11:22:44 +00:00
Martyn Inglis
223cb8c2dd Made SMS messages go through celery
- twilio client pulled in from delivery app
- made method to perform task
2016-02-15 16:01:14 +00:00
Martyn Inglis
fcc1585fdf Merge branch 'master' into celery-spike
Conflicts:
	app/__init__.py
	app/notifications/rest.py
	config.py
	wsgi.py
2016-02-12 09:36:49 +00:00
Nicholas Staples
1b25a3c762 Removed alpha client imports. 2016-02-09 16:13:48 +00:00
Martyn Inglis
fb41acdac9 Celery tests 2016-02-09 13:31:45 +00:00
Nicholas Staples
cd5a91d4c8 version file has been updated to include a travis commit and time of build. 2016-02-01 11:37:22 +00:00
Nicholas Staples
99b849171f Status page updated with api version and db version. 2016-01-29 12:51:33 +00:00
Adam Shimali
c15fdbe197 Fixed formatting 2016-01-20 15:51:13 +00:00
Nicholas Staples
92697d2671 Addedcors response. 2016-01-20 15:28:39 +00:00
Adam Shimali
f18071084e Merge pull request #18 from alphagov/proxy-to-alpha
Proxy to alpha
2016-01-19 16:02:42 +00:00
Martyn Inglis
fa30782d70 Removed Status endpoints from requiring Auth tokens
- auth tests now use service endpoints

- one test commented out and needs reworked
2016-01-19 15:32:33 +00:00
Martyn Inglis
742a567036 Added AWS files to
- upgrade database
- use credstash for secret overrides
2016-01-19 14:50:42 +00:00
Martyn Inglis
d275ba83a2 Added endpoints for the proxy to notifications.
- this uses alpha API for delivery
- no DB model included as just proving
- all notifications for same service at the moment (!)
2016-01-19 11:23:09 +00:00
Adam Shimali
f4a0a9b8d9 Fix for job urls that should have been within context of a service.
The service id path parameter is captured in the url prefix for the
job blueprint.
2016-01-18 09:57:04 +00:00
Rebecca Law
5f59b631e1 Added the before_request so that all calls must have a valid token.
Next is to get all the rest tests to pass again.
2016-01-15 17:01:26 +00:00
Adam Shimali
834801d19b Added endpoints for creating job, and getting job/jobs. 2016-01-15 15:48:05 +00:00
Rebecca Law
010408d98a Remove the view packages 2016-01-14 16:13:27 +00:00
Rebecca Law
34693d70af Removed the main package. 2016-01-14 14:28:23 +00:00