Commit Graph

7880 Commits

Author SHA1 Message Date
Leo Hemsted
9d5b629dad add notify-api-sms-callbacks app
we might need to deal with a potential large volume of SMS delivery
receipts. These receipts are POSTed to oru public api to two URLs. The
actual endpoint just parses the response body and puts a task on an SQS
queue - no database connections are required or anything like that.

Split up this traffic from other traffic, so that any increase in volume
of callbacks won't affect the scaling/load/etc of the main api apps.
We've hard coded instance counts to 10 on prod for now until we get an
idea of load.
2020-09-24 18:00:25 +01:00
Leo Hemsted
078a40f4da Merge pull request #2977 from alphagov/add-broadcast-org
add broadcast org
2020-09-24 14:21:08 +01:00
Rebecca Law
d7e53cdf50 Adding reference to message for "precompiled letters have been pending-virus-check for over 90 minutes"
This saves having to go to the db to get it.
2020-09-24 14:16:16 +01:00
Leo Hemsted
aac6b16b3c add broadcast org
keep the ID the same as the existing prod broadcast org to keep things
simple.

Move all services with a broadcast permission across to this new
service. Note that we'll need to clear the service and organisation
cache after deploying this
2020-09-23 17:05:17 +01:00
David McDonald
5b0cc8819a Use new redis key for templates
Equivalent of https://github.com/alphagov/notifications-admin/pull/3639
but for the API.

This is the only place in the API we appear to be getting setting
templates or broadcast messages.
2020-09-21 17:40:54 +01:00
Leo Hemsted
1e928a926a rename sending_date to created_at
we don't name letters based on the day we send them on, rather, the day
we create them on. If we process a letter for a second time for whatever
reason, even if it's a couple of days later, it'll still go in a folder
based on the created_at timestamp. There's still a slight confusion,
however - if the timestamp is after 5:30pm, the folder will be for the
day after. However, still the day after creation, so I think created_at
still makes the most sense.

Remove the term `sending_date` to try and make this relationship more
apparent.
2020-09-21 14:40:22 +01:00
Leo Hemsted
4f1e5ee5a3 remove ignore_folder from get_folder_name
it doesn't make sense to get the folder name if you know you aren't
going to use it.
2020-09-21 14:33:38 +01:00
Leo Hemsted
bb33927b3d rename letter get_folder_name args
`_now`? why would we ever use a different _now? instead say created_at,
because that's what it'll always be set to, even if we're replaying old
letters. We always set the folder name to when the letter was
created_at, or we might not know where to look to find it.

`dont_use_sending_date` doesn't really tell us what might happen if we
don't use it - the answer is we return an empty string. we ignore the
folder entirely. so lets call it that.

Also, remove use of freeze_gun in the tests, to prove that we don't use
the current time in any calculations. Also add an assert to a mock in
the get_pdf_for_templated_letter test, because we were mocking but not
asserting before, so the tests didn't fail when the function signature
changed.
2020-09-21 14:32:57 +01:00
David McDonald
120b760cae Merge pull request #2972 from alphagov/broadcast-invite-template
Broadcast invite template
2020-09-16 14:34:31 +01:00
David McDonald
f9911c7965 Send broadcast invite email for broadcast service invites
This means the copy is more accurate and mentions sending emergency
alerts rather than previous copy about sending emails texts and letters.
2020-09-15 16:47:41 +01:00
David McDonald
23ac7bcf56 Use sample broadcast service instead of sample service for tests
We only want to use a service that has permissions for broadcasts to
make our tests more realistic
2020-09-15 16:47:41 +01:00
David McDonald
6620590aad Add template for broadcast service invite 2020-09-15 16:47:41 +01:00
Katie Smith
15b782d595 Merge pull request #2971 from alphagov/fix-international-filenames
Fix the filenames for international precompiled letters
2020-09-15 16:45:10 +01:00
Katie Smith
aee7887c14 Fix the filenames for international precompiled letters
We were determing the filename for precompiled letters before we had
checked if the letters were international. This meant that a letter
could have a filename indicating it was 2nd class, but once we had
sanitised the letter and checked the address we were setting the
notification to international.

This stopped these letters from being picked up to be sent to the DVLA,
since the filename and postage of the letter did not match.

We now regenerate the filename after the letter has been sanitised (and when
we know the postage) and use the updated filename when moving the letter
into the live PDF letters bucket.
2020-09-15 16:17:33 +01:00
David McDonald
507e50d822 Merge pull request #2970 from alphagov/fix-govuk-link
Bring in latest version of utils to fix link breaking bug
2020-09-14 15:40:14 +01:00
David McDonald
5b2dee5ddb Bump utils to 42.0.0
Requires unit test updating as we now expect broadcast event areas to
be a dict containing a list of areas and simple polygons.
2020-09-14 15:21:55 +01:00
David McDonald
d352c99142 Remove unused send_broadcast_message task
We only call send_broadcast_event now
2020-09-14 15:16:59 +01:00
David McDonald
5aee6269e0 Fix format of simple_polygons
It is not of the form
[[lat, long][lat, long]] as this would only hold a single polygon. It
instead needs to handle multiple polygons so instead is of the form
[[[lat, long][lat, long]]].
2020-09-14 14:55:01 +01:00
David McDonald
288e3ae811 Bring in latest version of utils to fix link breaking bug
Fixes https://github.com/alphagov/notifications-utils/pull/784

Note, also is a breaking change of the utils, see
https://github.com/alphagov/notifications-utils/pull/769
but I don't believe it requires any changes on the API because of this
2020-09-10 14:32:02 +01:00
Rebecca Law
8d4228dd55 Merge pull request #2963 from alphagov/catch-exception-for-event
Catch and log any exception thrown in the checkin event method.
2020-09-10 13:16:08 +01:00
Rebecca Law
da4efbbb82 Catch and log any exception thrown in the checkin event method.
We don't want an exception while recording metrics to affect a user action. A KeyError exception was thrown today, that meant that a user say a 500, the action being performed was to download a document from the document-download-frontend app. By catching the error we prevent the user from seeing a 500 when a recording the connection metric fails.

Also catch the exception in the checkout event.
2020-09-10 12:25:35 +01:00
Chris Hill-Scott
92af5b8d67 Merge pull request #2968 from alphagov/cancel-international-letters
Allow international letters to be cancelled
2020-09-09 14:10:23 +01:00
Chris Hill-Scott
0e1f6f31e4 Use constant for notification type
Co-authored-by: Katie Smith <klssmith@users.noreply.github.com>
2020-09-09 11:12:06 +01:00
Chris Hill-Scott
cfda289746 Allow international letters to be cancelled
Our code was assuming that any notifications with `international` set to
`True` were text messages. It was then trying to look up delivery
information for a notification which wasn’t sent to a phone number,
causing an exception.
2020-09-09 10:55:55 +01:00
Rebecca Law
ea36a3804e Merge pull request #2967 from alphagov/fix-update-organisations
Fix update organisations
2020-09-09 10:55:33 +01:00
Rebecca Law
795a035fac When the organisation updates the crown attribute it should update all the services associated with that organisation too. 2020-09-09 10:43:16 +01:00
Pea M. Tyczynska
a9168d38a7 Merge pull request #2965 from alphagov/send-polygons-to-api
Persist simple polygons in the db.
2020-09-08 12:08:53 +01:00
Pea Tyczynska
b86ce6844f Ensure data model the same at creation as when updating broadcast message 2020-09-08 11:04:13 +01:00
David McDonald
bd9ce53ba1 Merge pull request #2966 from alphagov/provider-split
Converting resting provider split to 60/40
2020-09-08 10:35:53 +01:00
Pete Herlihy
7db4a882ce Converting resting provider split to 60/40 2020-09-08 10:17:27 +01:00
Pea Tyczynska
b3ff172780 Validate that both polygons and areas have to be updated
Because areas and polygons for broadcast messages should
be in sync.
2020-09-07 15:54:31 +01:00
Pea Tyczynska
5927aae019 Serialise simple_polygons attribute of BroadcastMessage 2020-09-07 15:54:31 +01:00
Pea Tyczynska
2f6b96dafc Ensure broadcast with no areas cannot be approved
This is already checked by admin app, but we want to have a
fallback safety measure as a precaution.
2020-09-07 15:54:30 +01:00
Pea Tyczynska
bceb5d8fde Purge broadcast data
To avoid problems after changing data type for areas column from
array to dictionary.
2020-09-07 15:54:30 +01:00
Pea Tyczynska
5cf6e1cf72 Persist simple polygons in the db.
They are being sent over from admin, and persisted
in the db so we can send them on to the broadcast
provider later on.
2020-09-07 15:52:14 +01:00
David McDonald
06ff8723d2 Merge pull request #2964 from alphagov/pyup-scheduled-update-2020-09-02
Scheduled weekly dependency update for week 35
2020-09-07 14:33:57 +01:00
David McDonald
86565fcee9 make freeze 2020-09-07 14:24:13 +01:00
Rebecca Law
5e88df5384 Merge pull request #2951 from alphagov/international-letters-for-all-part2
Add international letter service permissions for all services
2020-09-07 08:34:22 +01:00
Rebecca Law
93475912ba Merge pull request #2950 from alphagov/international-letters-for-all
Default international_letters for service permissions.
2020-09-07 07:39:52 +01:00
pyup-bot
87599dce4a Update sqlalchemy from 1.3.18 to 1.3.19 2020-09-02 14:00:06 +01:00
pyup-bot
c5688dde2b Update eventlet from 0.26.1 to 0.27.0 2020-09-02 14:00:05 +01:00
pyup-bot
e7e1e9d478 Update flask-marshmallow from 0.11.0 to 0.13.0 2020-09-02 14:00:04 +01:00
pyup-bot
90045646d3 Update cffi from 1.14.1 to 1.14.2 2020-09-02 14:00:03 +01:00
Katie Smith
cf20588603 Merge pull request #2960 from alphagov/int-ft-billing
Set 'international' for letters in ft_billing
2020-08-25 10:27:51 +01:00
Katie Smith
b30701d7e1 Set 'international' for letters in ft_billing
`international` for letters in `ft_billing` was always False. Now that
letters can be international, this changes the column value to the value
of `international` for the notification.
2020-08-21 09:19:27 +01:00
Katie Smith
6439200c71 Merge pull request #2958 from alphagov/invited-user-endpoints
Add endpoints to get invited users
2020-08-19 09:00:51 +01:00
Katie Smith
8dcc65d11c Add endpoints to get invited users
We want to display flash messages in admin when invites have been
cancelled. This message needs to display the user's email address, so
this commit adds endpoints to GET a single invited service user and org
user so that we can look up the email address of a cancelled user.
2020-08-19 08:49:33 +01:00
David McDonald
4ff0f5c4de Merge pull request #2953 from alphagov/pyup-scheduled-update-2020-08-12
Scheduled weekly dependency update for week 32
2020-08-18 12:16:07 +01:00
David McDonald
1b36a75927 Dont upgrade flask marshmallow as breaks things 2020-08-18 12:04:48 +01:00
David McDonald
bc5a5cf1ab make freeze requirements 2020-08-18 10:00:58 +01:00