Commit Graph

1504 Commits

Author SHA1 Message Date
Martyn Inglis
75bf693f44 Add the yearly free limit to the service model.
This allows us to reference it across the API code base and return it in the API.

But not currently attached to the service DB model - a static method on the class.
2017-06-06 14:49:05 +01:00
Martyn Inglis
29455b6d3b Strip leading 44 from inbound SMS numbers to normalise to how we store things. 2017-06-06 11:50:30 +01:00
minglis
85b9968473 Merge pull request #1012 from alphagov/firetext-inbound-sms
Firetext inbound sms
2017-06-05 16:59:03 +01:00
Martyn Inglis
b296e736f2 Reorder the migrations. 2017-06-05 11:51:30 +01:00
Martyn Inglis
f15d235d1e Merge branch 'master' into firetext-inbound-sms 2017-06-05 11:33:53 +01:00
Martyn Inglis
012f8d2675 Adds provider onto the inbound sms table so we know where this came from. 2017-06-02 16:37:57 +01:00
Imdad Ahad
56c3f3cf7c Add task to delete inbound sms everyday at 1am 2017-06-02 16:10:27 +01:00
Imdad Ahad
0631b6c988 Add dao to delete inbound sms after seven days 2017-06-02 16:10:27 +01:00
Martyn Inglis
3e1de2e901 Capture the fire text callbacks.
Parse the form data, and stop the message
2017-06-02 15:58:36 +01:00
Leo Hemsted
69c299dd6c ensure international numbers are handled correctly
the international flag semantically means 'Should we throw an error if an
international number is passed in?' (and the answer is no. We should not.)
2017-06-02 15:20:18 +01:00
Leo Hemsted
bf18b179b0 ensure the user_number in inbound sms is international
rather than using the `normalise_phone_number` function, use the
`validate_and_format_phone_number` function - this will also convert
all numbers to international format, which means we won't need to
worry about whether the user enters internaional or UK phone numbers
when searching
2017-06-02 15:20:18 +01:00
Leo Hemsted
ef52337d85 add inbound sms api
two endpoints:
* get all inbound sms for a service (you can limit to the X most
  recent, or filter by user's phone number [which will be normalised])
* get a summary of inbound sms for a service - returns the count of
  inbound sms in the database, and the date that the most recent was
  sent
2017-06-02 15:20:18 +01:00
Leo Hemsted
d89cb2c120 add an admin_request fixture
this gets rid of some boilerplate around mocking requests
from the front-end
2017-06-02 15:19:24 +01:00
Leo Hemsted
d9bdacb5cd parse datetimes from mmg inbound sms
the DateRecieved field from MMG comes in with +s instead of spaces,
and uriencoded (the same as how they format their messages)
Make sure we decode this, and then convert to a UTC timestamp
2017-06-02 10:14:01 +01:00
Leo Hemsted
dba4e2ad89 mmg spell received incorrectly, lets use that 2017-06-01 17:27:09 +01:00
Martyn Inglis
c57e2a6894 Merge branch 'master' into inbound-sms
Conflicts:
	app/notifications/receive_notifications.py
	tests/app/notifications/test_receive_notification.py
2017-06-01 15:56:33 +01:00
minglis
a4c8f83839 Merge pull request #983 from alphagov/remove-nasty-query-from-dashboard
Remove nasty query from dashboard
2017-06-01 15:31:02 +01:00
Martyn Inglis
c29f95381e Remved test re-added as part of a merge 2017-06-01 14:57:46 +01:00
Martyn Inglis
a60d40bbc0 Merge branch 'master' into remove-nasty-query-from-dashboard
Conflicts:
	tests/app/service/test_rest.py
2017-06-01 14:47:00 +01:00
Chris Hill-Scott
af087f36d6 Merge pull request #1005 from alphagov/hide-one-off-dashboard
Ignore one-off messages in job list on dashboard
2017-06-01 14:37:50 +01:00
Chris Hill-Scott
eb493f6817 Rename ‘One-off message’ to ‘Report’
See 7915845cb5
2017-06-01 13:56:47 +01:00
Leo Hemsted
3e47519045 Merge pull request #1006 from alphagov/revert-1001-revert-988-non-null-again
Revert "Revert "Remove nulls from sms_sender""
2017-06-01 13:14:03 +01:00
Leo Hemsted
dd9fd6cf92 still return RECEIVED even if we couldn't find a matching service
mmg don't need to retry that message or anything. just log it.
2017-06-01 13:13:51 +01:00
Martyn Inglis
7f65aa3eef Merge branch 'master' into remove-nasty-query-from-dashboard
Conflicts:
	app/service/rest.py
	tests/app/service/test_rest.py
2017-06-01 13:11:54 +01:00
Rebecca Law
40aadf2748 Merge pull request #991 from alphagov/invite-service-to-schedule
Invite the service to schedule notifications from the API
2017-06-01 12:37:32 +01:00
Chris Hill-Scott
78d071f22f Ignore one-off messages in job list on dashboard
Same as how we ignore ‘send yourself a test’ messages (see:
d8467bfc3c). The dashboard gets clogged
up with one off messages otherwise, which affects:
- performance
- users ability to find their jobs
2017-06-01 12:30:47 +01:00
Leo Hemsted
d33698216c Revert "Revert "Remove nulls from sms_sender"" 2017-06-01 11:00:26 +01:00
Martyn Inglis
a7fd624db5 Added simple logging endpoint for fire text inbound SMS calls
- logs post data
- OK to log all as not currently in use so no real user data expected.
2017-06-01 08:21:18 +01:00
Rebecca Law
e3baf71016 Update error message 2017-05-31 16:22:56 +01:00
Martyn Inglis
3c416d3631 Simple end point for fire text inbound SMS callbacks. 2017-05-31 16:15:25 +01:00
Leo Hemsted
ea0ba8d87a Revert "Remove nulls from sms_sender" 2017-05-31 14:52:48 +01:00
Leo Hemsted
6c5affbebc Merge pull request #988 from alphagov/non-null-again
Remove nulls from sms_sender
2017-05-31 14:27:49 +01:00
Chris Hill-Scott
9ada8b2753 Don’t 500 when searching with bad email address
In the future we might want to validate email addresses before
attempting to search by them. But for a first pass we can just return
no results when a user types in something that isn’t an email address
or phone number.

It definitely better than returning a 500.
2017-05-30 14:50:48 +01:00
Leo Hemsted
ef799d0515 add sad path tests for inbound sms 2017-05-30 11:14:18 +01:00
Leo Hemsted
db4b3e371a remove null sms sender test
it's no longer possible for an sms_sender to be null
2017-05-30 10:47:52 +01:00
Leo Hemsted
25011f09ef test no longer applicable as null sms_sender is an error now 2017-05-30 10:47:15 +01:00
Leo Hemsted
eb6edf06a3 add upgrade script to remove non-null values from the sender column 2017-05-30 10:47:15 +01:00
Leo Hemsted
58503c855a set sms_sender to be 'GOVUK' if not otherwise specified
this is a precursor to making the column non-nullable
2017-05-30 10:47:15 +01:00
Leo Hemsted
4a85818c34 add inbound sms table 2017-05-30 10:47:01 +01:00
Martyn Inglis
75c5e5e5d5 Merge branch 'master' into redo-queue-visibitlity-timeout
Conflicts:
	app/notifications/process_notifications.py
	app/v2/notifications/post_notifications.py
2017-05-30 10:18:18 +01:00
Ken Tsang
18b8382d6e Refactor schema and improve tests 2017-05-26 17:17:15 +01:00
Rebecca Law
3dc70b8c39 Check service.permissions for the existence of schedule_notifications if the notications is being created with a scheduled_for param. 2017-05-26 15:41:14 +01:00
kentsanggds
263adac805 Merge pull request #984 from alphagov/ken-update-api-service-permissions-handling
Ken update api service permissions handling
2017-05-26 14:39:27 +01:00
Ken Tsang
7aca3d8f43 Remove flags process in service_dao.create_service 2017-05-26 12:04:16 +01:00
Imdad Ahad
77b82305f4 Search normalised in get_notifications_for_service:
* Use dao method to search against normalised(recipient)
* Add filter to accept one or more statuses
2017-05-26 11:58:50 +01:00
Imdad Ahad
78c10b7d30 Search notification against normalised recipient with filter for status 2017-05-26 11:45:56 +01:00
Imdad Ahad
cfe08a4d8b Store the normalised number on the notification 2017-05-26 11:36:24 +01:00
Imdad Ahad
6c4377bd44 Persist normalised email 2017-05-26 10:26:07 +01:00
Imdad Ahad
cbc92a6173 Store the normalised number on the notification 2017-05-26 10:26:07 +01:00
Ken Tsang
1375bbe400 Refactor schema to improve error response 2017-05-25 17:55:24 +01:00