Commit Graph

2257 Commits

Author SHA1 Message Date
Ken Tsang
dca331e3ea Refactor to use query string rather than path params 2017-11-07 16:39:11 +00:00
Ken Tsang
ac15e7fd8b Renamed inbound_sms_list key name to received_text_messages 2017-11-07 13:29:40 +00:00
Ken Tsang
2e66fe5e38 Removed page from get paginated args as not used 2017-11-07 13:29:40 +00:00
Ken Tsang
0350c99a3e Updated inbound sms API endpoints
- from `/v2/inbound_sms` to `/v2/received-text-messages`
- use paginated results
2017-11-07 13:29:40 +00:00
Ken Tsang
02ee072251 Refactor inbound sms dao
Added function for paginated results
2017-11-07 13:29:40 +00:00
Ken Tsang
85b8e24e17 Add V2 inbound_sms API
- had to update the serialization in the model so that the date time is appended with the UTC timezone
- test has been added to ensure that the schema will validate the response correctly
2017-11-07 13:29:40 +00:00
Chris Hill-Scott
6e8202522e Merge pull request #1369 from alphagov/default-sms-prefix-true
Default new services to prefixing text messages
2017-11-07 10:46:16 +00:00
Venus Bailey
7aa0976bec Merge pull request #1368 from alphagov/vb-route-secret
initial logging for route protection
2017-11-06 16:31:48 +00:00
venusbb
cae42fe862 Changed logging way 2017-11-06 13:40:20 +00:00
Rebecca Law
c0f7809819 Merge pull request #1366 from alphagov/downgrade-error-msg
Downgrade error message
2017-11-06 13:26:49 +00:00
venusbb
f81b6e9d99 add protection if the parameter route-secret does not exist 2017-11-06 12:27:48 +00:00
venusbb
03fc781b8c create new method to validate secret header, new tests 2017-11-06 11:56:57 +00:00
Chris Hill-Scott
812090b104 Default new services to prefixing text messages
We want new services, when they do the tour, to see how the service name
they just made shows up in the messages. This is how it (should) work
at the moment (although got broken because of the multiple senders
stuff).

Need to do this before we do the migration now otherwise a new service
could sneak in with this setting still set to `null`.
2017-11-03 15:52:56 +00:00
venusbb
f4d005c7fb initial logging for route protection 2017-11-03 14:43:56 +00:00
Chris Hill-Scott
ab583c0bc6 Merge pull request #1364 from alphagov/put-sms-prefix-on-model
Work out SMS message prefixing in a way that is aware of multiple SMS senders
2017-11-03 13:35:38 +00:00
Chris Hill-Scott
cccffdd2ac Add a column for a service to set SMS prefixing
In future changes, services will be able to control whether their text
messages will be prefixed with the name of their service.

This commit:
- adds a column to store the value of that setting
- makes the service model take notice of it, if it were to have a value
  set

It doesn’t:
- provide a way of setting the value of this column

Currently the column can have three values:
- `None` – ignore it (this is what all current services will start as)
  and continue to determine whether to prefix messages by looking at the
  sender
- `True` – always the service name to the start of text messages
- `False` – never add the service name to the start of text messages

In the future we’ll migrate all services to be either `True` or `False`,
the `None` will go away and all services will have direct control over
the setting.
2017-11-03 12:53:06 +00:00
Chris Hill-Scott
e1239bea06 Use model to work out whether to prefix message
`service.sms_sender` has been deprecated; we should be looking at which
of the service’s SMS senders is default to work out if the message
has been sent from GOVUK or not (and if it has, then prefix the message
with the service name).

The arguments to `SMSMessageTemplate` are _super_ badly named – `sender`
isn’t really used as a string, it’s a boolean that effectively means
‘is this a custom sender (`True`) or the platform default (`False`)’. We
should rename it once this bug is fixed.
2017-11-03 12:28:43 +00:00
Chris Hill-Scott
92b605833f Add prefix SMS with service name to service model
If the service is sending messages from GOVUK, then its messages should
be prefixed with the service name. Right now this logic is:
- worked out separately in the admin app and API
- isn’t aware of multiple senders

This commit moves the logic to one place (the service model). It does
this in a slightly naive way, in that it only looks at the default
sender, not the actual sender of the message.

In the future this will go away because we’ll move it to being a setting
that’s controlled independently of the service name. But this is the
first step towards that.

fixup! Add prefix SMS with service name to service model
2017-11-03 12:28:35 +00:00
Rebecca Law
168231f3ce Downgrade the error message to a warning. 2017-11-03 12:09:20 +00:00
venusbb
bdc24dbf0e Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history 2017-11-03 11:50:22 +00:00
venusbb
0f0110a1d1 removed printout of route secret 2017-11-03 10:41:53 +00:00
Rebecca Law
efe0f3b99b Downgrade error to warning 2017-11-03 10:15:09 +00:00
venusbb
ad386b7d28 removed unused import and minor syntax 2017-11-02 17:02:00 +00:00
Leo Hemsted
b0f58a8dcb Merge pull request #1362 from alphagov/send-inbound-api-logging
always log when we send out inbound sms
2017-11-02 16:38:07 +00:00
venusbb
6875ab150a Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history 2017-11-02 12:38:52 +00:00
venusbb
6f7793d761 - Add update dao_update_annual_billing_for_current_and_future_years
- moved get_current_financial_year_start_year from service.utils to dao.date_utils
- Moved logic for data persistence from rest to dao when updating records in db
2017-11-02 12:38:43 +00:00
Leo Hemsted
aef99a8cba always log when we send out inbound sms
also, downgrade client returning bad status codes from `exception` to
error - it's not a problem with our system so we don't want it to trip
any cloudwatch alerts or anything.
2017-11-02 11:25:11 +00:00
Rebecca Law
f5e79302cd Remove NotificationStatistics
NotificationStatistics was added as a spike but didn't work out as expected. This is finally removing all that unused code.
I'll drop the table in the next PR
2017-11-01 15:02:50 +00:00
Rebecca Law
ea1b6d1b31 Merge pull request #1354 from alphagov/sms_sender_id-for-post-notfications
SMS sender id for post notifications
2017-11-01 11:34:17 +00:00
Rebecca Law
830619194e Renamed some tests.
Fix some imports.
Added test for a function
2017-11-01 11:01:20 +00:00
Rebecca Law
c8a210afd1 Added a command to re-run the build_dvla_file for a given job id.
There was an instance where the file failed to create because the address in the personalisation had punctuation which caused the address lines to merge into one.
Utils has been updated to fix that problem, this task will allow us to re-run the task so that the notifications can be sent.
2017-10-31 15:20:14 +00:00
Rebecca Law
f01c088f2f Update utils with a fix for address formats for letters. 2017-10-31 15:03:12 +00:00
chrisw
a95d6e8b2e allow updating auth type 2017-10-31 10:36:53 +00:00
Leo Hemsted
8cb74f5f90 Merge pull request #1352 from alphagov/auth-type
Add auth_type column to user and invited user
2017-10-30 17:10:26 +00:00
venusbb
cc3d5ba8d1 Added logic to return past and future free_sms_limit_data that dont exist 2017-10-30 17:10:12 +00:00
Rebecca Law
d671adc1eb Fix codestyle 2017-10-30 16:51:27 +00:00
Rebecca Law
b1b231ba90 Merge branch 'master' into sms_sender_id-for-post-notfications 2017-10-30 15:20:39 +00:00
Rebecca Law
db6668eb61 Added the notification_to_sms_sender mapping table to the purge notifications query 2017-10-30 15:17:01 +00:00
Rebecca Law
0887910b1b Get the sms sender from the notificaiton_sms_sender mapping table if that does not exist get the default sms sender to pass on to the sms provider. 2017-10-30 14:55:44 +00:00
Richard Chapman
d85a71758c Retry in only certain scenarios
Instead of retrying if there are genuine errors, only retry if there are
errors which are unexpected as otherwise the retries will happen and
fail for the same reason e.g. that the message has changed format and
will require a code update.

- Updated process_ses_results to only retry if there in an unknown
exception
- Update test and assert that there is a retry there is a unknown
exception
2017-10-30 13:43:23 +00:00
Rebecca Law
4eec11b633 Added an optional parameter in the form for POST /v2/notifications/sms and /service/<service_id>/send-notification to pass in the SMS sender id.
The send_sms_to_provider still needs to use the SMS sender being passed in to the POST.

As part of https://www.pivotaltracker.com/story/show/152106587
2017-10-30 13:36:49 +00:00
Leo Hemsted
7c8586f959 add auth_type to schemas to enable updating in endpoints 2017-10-30 12:29:01 +00:00
Leo Hemsted
c39ec90727 add auth type table, currently contains sms_auth and email_auth 2017-10-30 11:11:37 +00:00
venusbb
b648c2e632 Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history 2017-10-30 09:34:23 +00:00
Rebecca Law
f66b7f0a5d Merge pull request #1350 from alphagov/update-page-counts-for-letters
Update page count when processing response file for letters
2017-10-27 16:21:28 +01:00
Leo Hemsted
46f5896b3b add new email_auth service permission 2017-10-27 14:28:20 +01:00
Rebecca Law
76c8b15f59 Update the billable units with the page count from the response file for letter notifications. 2017-10-27 13:53:55 +01:00
venusbb
6f02ee516c Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history 2017-10-27 10:47:20 +01:00
Rebecca Law
43843eb5d1 Merge pull request #1344 from alphagov/notification_to_sms_sender
Create a new table to map a notification to a SMS sender.
2017-10-27 09:51:27 +01:00
venusbb
c991df3209 Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history 2017-10-26 20:47:18 +01:00