Commit Graph

181 Commits

Author SHA1 Message Date
Chris Hill-Scott
cc741003c0 Log FireText exceptions as exceptions 2016-03-02 11:14:32 +00:00
Chris Hill-Scott
0e5d72494e Prefix all SMS messages with service name
Implements https://github.com/alphagov/notifications-utils/pull/4
2016-03-02 11:14:32 +00:00
Chris Hill-Scott
d6f7c7d1c9 Replace placeholders before sending a message
This commit replaces placeholders in a template with the user’s data, using
the Template class from utils
(https://github.com/alphagov/notifications-utils/tree/master/utils#template)

It also extracts the personalisation data from the CSV, taking account of the
different column headings that SMS and email CSVs will have.

At the point of creating the task to send an individual messages, validation of
the placeholders matching the template is assumed to have been done either:
- in processing the CSV in the admin app
- in the endpoint for the API call

No exceptions should be raised at this point.
2016-03-02 08:59:34 +00:00
Rebecca Law
9f6255ac94 Add subject line to the invitation email. 2016-02-29 16:12:12 +00:00
Rebecca Law
3879350c12 Send email invitation to invited user 2016-02-29 15:56:00 +00:00
Rebecca Law
df278a8e6e Email invitation to an invited user.
New celery task to send the email.
2016-02-29 13:21:12 +00:00
Martyn Inglis
44632c36d3 Add sender name to the notification
- also ensure that the created time is handled properly
2016-02-25 11:23:04 +00:00
Martyn Inglis
10a764a2c1 Renamed the header of the CSV to 'to' from 'number' to allow for email jobs
- added new columns to Job and Notification to capture the start/end dates accurately
2016-02-25 09:59:50 +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
Martyn Inglis
1667f82df1 Removed some unused template dao methods 2016-02-24 11:51:02 +00:00
Martyn Inglis
b0609b1813 More refactors
- single base method to send notifications
- knows about service id (present if job based)
- knows about jobs - if needed
- knows about type

Does the right thing

Was lots of shared code around error checking now in one place.
2016-02-24 09:55:05 +00:00
Martyn Inglis
201c2d01ba Task is the same whether job based or not
- use notification to build action
- notification has job
- based in encrypted blob
2016-02-23 17:39:08 +00:00
Martyn Inglis
635debb5a6 Moved the sending sms for a job into celery tasks 2016-02-23 17:30:50 +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
Nicholas Staples
c8bb96b883 Fixes added. 2016-02-22 13:02:09 +00:00
Rebecca Law
aff948e9ca Merge branch 'celery-send-sms-code' into celery-send-email-code
Conflicts:
	app/celery/tasks.py
	app/user/rest.py
	scripts/run_celery.sh
2016-02-18 10:50:14 +00:00
Rebecca Law
3ce6758f3e Change names for clarity sake.
Rename test.
What we do when the validation_code fails to send is still to be decided.
2016-02-18 09:59:18 +00:00
Rebecca Law
c1df61a7d4 Use celery to send the email verification code. 2016-02-18 09:52:27 +00:00
Rebecca Law
9073814d9f I have an issue with the test, not sure why? 2016-02-17 17:48:23 +00:00
Rebecca Law
66cf6cfd30 Use Firetext client 2016-02-17 15:52:09 +00:00
Rebecca Law
7afa87c367 Merge branch 'master' into celery-send-sms-code
Conflicts:
	tests/app/celery/test_tasks.py
2016-02-17 15:43:57 +00:00
Rebecca Law
d022d036dc Celery task to send the sms verify code.
Each celery task will use it's own queue.
2016-02-17 15:41:33 +00:00
Martyn Inglis
837c9b7cdb Removed logging, and make fire text only client. 2016-02-17 13:59:01 +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
95cdfe08d1 Updated logging in run-celery script to log to application logs
- poll every second
- visibility of 1 minute
2016-02-17 11:18:27 +00:00
Martyn Inglis
a2341be0e2 Don't send the SMS if we have failed to save in the database 2016-02-16 17:42:04 +00:00
Martyn Inglis
0933e5c647 Building tests for the tasks class 2016-02-16 17:17:02 +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
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
fb41acdac9 Celery tests 2016-02-09 13:31:45 +00:00