Commit Graph

1935 Commits

Author SHA1 Message Date
Athanasios Voutsadakis
dada25beb1 Update tests 2017-10-26 12:18:39 +01:00
Athanasios Voutsadakis
f10893d383 Allow for both an endpoint callback and SQS consumption 2017-10-26 12:17:35 +01:00
Athanasios Voutsadakis
263131f6ba Fix tests 2017-10-26 12:14:33 +01:00
Athanasios Voutsadakis
644b31ba75 Update tests 2017-10-26 12:14:33 +01:00
kentsanggds
d39bf96324 Merge pull request #1333 from alphagov/ken-handle-dvla-response-file
Handle DVLA response file
2017-10-26 11:09:09 +01:00
Ken Tsang
204f170de2 Use NOTIFICATION_TECHNICAL_FAILURE not NOTIFICATION_FAILED 2017-10-25 15:39:54 +01:00
Rebecca Law
d4678bc452 Merge pull request #1341 from alphagov/inbound-number-is-the-default-when-only-one
Do not create a new SMS sender when allocating an inbound number
2017-10-25 14:02:04 +01:00
Rebecca Law
5ed8f17885 Merge pull request #1338 from alphagov/use-default-sms-not-inbound
Use default sms not inbound
2017-10-25 13:39:18 +01:00
Rebecca Law
a8adf4d7d7 This PR is to retain current behaviour when we allocate an inbound number for a service.
When a service is allocated an inbound number and they only have one SMS sender, then update that SMS sender to the inbound number.
That way they will not have more than one SMS sender and will not have to choose to use either one.
2017-10-25 11:58:54 +01:00
Ken Tsang
ab55650871 Reordered imports 2017-10-25 10:48:35 +01:00
Ken Tsang
5da119f824 Update letter noti status based on dvla response file 2017-10-25 10:48:35 +01:00
Ken Tsang
98d5473788 Update test to to test letter status received 2017-10-25 10:48:35 +01:00
Ken Tsang
8bdc999818 Update notification schema to include received letter status 2017-10-25 10:48:35 +01:00
Ken Tsang
a2b42194cd Add letter status received to data model
- in order to reduce the number of statuses in the database the letter status `received` will be mapped to `delivered` internally
2017-10-25 10:48:35 +01:00
Rebecca Law
f519c2a4d9 fix import 2017-10-24 14:53:02 +01:00
Rebecca Law
8d6c38e1fe Now that we allow multiple SMS senders for a service, update the sender for SMS to be the default SMS sender, regardless if it is inbound number or not 2017-10-24 13:37:17 +01:00
Ken Tsang
9bdb8f10ce Add stats test for bst and fix existing stat test
- Existing test was failing as the expected results did not match when retrieving results between 11pm and 12am during bst, so time was fixed to when it wasn't affected
- New test is added to check results during the bst hour
2017-10-24 12:57:15 +01:00
Rebecca Law
ce13e62d84 Merge pull request #1332 from alphagov/improve-platform-admin
Improve platform admin
2017-10-24 10:25:54 +01:00
Rebecca Law
5ce44c07f5 Fix unit tests. 2017-10-23 16:07:10 +01:00
Rebecca Law
f1f2e5cd90 Fix the results to be returned in the same format that the admin app expects. 2017-10-23 15:06:11 +01:00
Chris Hill-Scott
c9a7ee991e Merge pull request #1328 from alphagov/international-default
Make international text messaging on by default for new services
2017-10-23 14:03:16 +01:00
Rebecca Law
bfb8528ea9 The /platform-admin takes a long time, probably because the marshmallow schema used joins to the service table to return all the service data and is inefficient.
The query itself has not been improved much at all but by not using a marshmallow schema I hope to get the performance gain I am looking for.
2017-10-23 10:58:06 +01:00
Rebecca Law
4675b91763 Merge pull request #1325 from alphagov/add-update-multiple-sms-sender
Add update multiple SMS senders for a service
2017-10-20 14:06:53 +01:00
Rebecca Law
d1c9335307 If the add sms sender is for an inbound number use the number from the inbound number object, rather than the value passed in. 2017-10-19 16:29:54 +01:00
Rebecca Law
954a80649e Merge branch 'master' into add-update-multiple-sms-sender 2017-10-19 14:34:58 +01:00
Rebecca Law
2193afe9a3 Remove 'data' from the json being returned. 2017-10-19 13:59:22 +01:00
Rebecca Law
cee916c68a As per review commemnts:
- Add the assert to a test - oops.
- Fix typo in error message.
2017-10-19 13:51:33 +01:00
Chris Hill-Scott
534a2ea7cd Factor permissions tests for code reuse
We had these fiddly little generator expressions repeated throughout
this file. Code is made easier to understand by refactoring them into a
function that describes what it does.
2017-10-19 11:43:28 +01:00
Chris Hill-Scott
46d45d8595 Make international SMS on for new services
International SMS is a mature, documented feature now. There’s no reason
it shouldn’t be available to everyone. If it’s turned off by default
then we’re relying on people finding it in the settings page to know
that it exists (which we found in research the other week that users,
who would have benefitted from having international SMS, were failing to
do).

This also fixes the problem whereby users signing up for Notify with an
international phone number (eg those working abroad for the Foreign and
Commonwealth Office) couldn’t get through the tour because they weren’t
able to send themselves the example text message (see
https://www.pivotaltracker.com/story/show/150705515).
2017-10-19 11:43:27 +01:00
Rebecca Law
709e24e267 Added endpoints to get sms senders for a service 2017-10-19 10:43:49 +01:00
Rebecca Law
6dc41c3b47 New endpoints to add and update multiple SMS sender for a service. 2017-10-19 09:58:23 +01:00
Katie Smith
0c9a4bce59 Add celery tasks- save_sms, save_email, save_letter
Created three new celery tasks:
* save_sms          (will replace send_sms)
* save_email        (will replace send_email)
* save_letter       (will replace persist_letter)

The difference between the new tasks and the tasks they are replacing is
that we no longer pass in the datetime as a parameter.

The code has been changed to use the new tasks, and the tests now run
against the new tasks too. The old tasks will need be removed in a separate
commit.
2017-10-18 17:00:37 +01:00
Rebecca Law
4ac2dc3606 Fix code style 2017-10-18 13:17:52 +01:00
Rebecca Law
4ca6fbc724 Added dao methods needed to add or update multiple sms senders for a service.
Remove the unique constraint for service on the ServiceSmsSender model.
2017-10-18 13:13:23 +01:00
Rebecca Law
fb85f22c2a Merge pull request #1322 from alphagov/set-accurate-created_at
Set accurate Notification.created_at
2017-10-18 13:10:46 +01:00
Chris Hill-Scott
2a5e6c2d0c Store organisation type against each service
> So that we can default services to their appropriate text allowance,
> we need to find out what sector they're in. So let's start collecting
> that from teams as they create new services.

In order to work out what a team’s allowance should be, we need to know
what part of government they’re from. We’re going to do this logic in
the admin app and then `POST` the allowance to the API.

So all we need to do with the information that the users give us is
store it against the service, so we have a record. Doesn’t need any
logic doing as a result of it, doesn’t need foreign keying to the
organisations table, etc.
2017-10-18 10:49:31 +01:00
Rebecca Law
f52ec2c406 Added an order by to the check_job_status query. The test was failing intermittently 2017-10-18 09:50:39 +01:00
Rebecca Law
24a87d8260 Small change to use the current datetime stamp for the Notification.created_at timestamp rather than the job.created_at start date. This will give us better more reflective data. 2017-10-17 16:05:31 +01:00
Rebecca Law
5aa37f09b6 Removed the _delivery_status endpoint.
The test this status check was doing does not reflect real traffic of Notify. It is typical for messages to be in 'sending' for a while (people turn off their phone for example).
2017-10-17 15:51:42 +01:00
Richard Chapman
5de0f46979 Merge pull request #1313 from alphagov/rc_process_missing_rows_in_csv
Process Incomplete Jobs, if a job have been discovered to be incomplete.
2017-10-17 12:35:34 +01:00
Richard Chapman
543535e2af Process Incomplete Jobs Updates
Comments are PR review. Updated code style in a few places to make it
more consistent with other code, added tests for letters and emails
so they are testedt, refactored some database queries to dao file

- Fixed code style
- Refactored database queries to dao code
- Added tests for emails and sms.
2017-10-17 11:07:36 +01:00
Leo Hemsted
5ad6bc7621 ensure emails are formatted before sending
we allow some invalid to addresses - for example, phone numbers with
spaces or brackets - in the database. This is so that users can match
up their data in a format that they expect (since they passed it in).
When we send SMS, we strip this formatting just before sending - but we
weren't with email. This commit changes that and adds some tests.

It also adds formatting for reply_to addresses. We should never expect
invalid reply_to email addresses in our data, but just in case, lets
validate them here.

Also, bump requirements.txt to capture some more email validation
2017-10-16 17:29:45 +01:00
Venus Bailey
9b60d69931 Revert "Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table"" 2017-10-16 16:24:34 +01:00
Leo Hemsted
19bb0d157d reset notification to created if fake callback throws exception
else we ignore it when retrying
2017-10-16 15:49:13 +01:00
Venus Bailey
616a6f8ef8 Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table" 2017-10-16 12:43:05 +01:00
Richard Chapman
0ff80bcb76 Process Incomplete Jobs Refactor
- Moved the process_incomplete_jobs to tasks.py
- Moved the process_incomplete_jobs test to test_tasks.py
- Cleaned up imports and other code style issues.

As the new tasks is not a scheduled one, moved the the tasks.py file.
This makes it more consisted with other tasks. Updated a few code style
issues to make it more consistent with other coe and hence more
maintainable in future.
2017-10-16 12:33:39 +01:00
Richard Chapman
9e6deddbd4 Merge branch 'master' of https://github.com/alphagov/notifications-api 2017-10-16 12:33:03 +01:00
Venus Bailey
e32350967e Merge pull request #1305 from alphagov/vk-free-sms-limit
[#151837054] Add new column free_sms_fragment_limit in the Services table
2017-10-16 11:51:35 +01:00
Richard Chapman
22b933b8f1 Merge branch 'master' of https://github.com/alphagov/notifications-api 2017-10-13 16:47:05 +01:00
Richard Chapman
0509669969 Process Incomplete Jobs
- Added a new task to process incomplete jobs
- Added tests to test the new method
- Updated the check for incomplete jobs method to start the new task

This will effectively resume tasks which for some reason were interrupted
whilst they were being processed. In some cases only some of the csv
was processed, this will find the place in the csv and continue processing
from that point.
2017-10-13 16:46:17 +01:00