Commit Graph
100 Commits
Author SHA1 Message Date
Pea Tyczynska cf1662e8b1 Merge pull request #3343 from alphagov/publish-alerts
Call publish-govuk-alerts task when alert is sent, cancelled or expires
2021-10-20 14:48:10 +01:00
Pea TyczynskaandKatie Smith 1b6f9505da Call publish-govuk-alerts task when alert expires
The `auto-expire-broadcast-messages` task checks for expired broadcasts
at five minute intervals. This change now calls the
`publish-govuk-alerts` task in govuk-alerts if there are expired
broadcasts so that the site is updated.

Co-authored-by: Katie Smith <katie.smith@digital.cabinet-office.gov.uk>
2021-10-18 08:41:25 +01:00
Pea Tyczynska 9334204cd2 Merge pull request #3305 from alphagov/fetch-alerts-list-for-govuk-alerts
get_broadcasts returns a list of alerts for gov.uk/alerts
2021-08-12 14:33:46 +01:00
Pea Tyczynska 9d2f8347b2 get_broadcasts returns a list of broadcasts for gov.uk/alerts 2021-08-12 14:03:33 +01:00
Pea Tyczynska 0f7f219a55 dao_get_all_broadcast_messages returns just fields govuk alerts need 2021-08-11 14:43:27 +01:00
Pea Tyczynska 74c9ca2bf6 Fetch all broadcast messages that are or were transmitted
Regardless of channel.
Do not include:
- broadcasts older than 25.05.2021
- stubbed broadcasts
- broadcasts that were not transmitted. So only broadcasting,
cancelled and completed make the list;
2021-08-11 14:43:27 +01:00
Pea Tyczynska 82e7724c56 Merge pull request #3296 from alphagov/separate_error_for_cancelling_cancelled_letters
Show separate error for when user tries to cancel letter
2021-08-03 10:29:47 +01:00
Pea Tyczynska 0c8dd247f9 Show separate error for when user tries to cancel letter
that is already cancelled vs when it is too late to
cancel letter vs when we don't know what's the cause
of failure.

This is so we could show useful error messages to the users
and also for better debugging.
2021-07-29 11:32:49 +01:00
Pea Tyczynska 2b2c240bee Update utils version to bring in too_late_to_cancel_letter
We need that method to show right errors to the user
when cancelling letter fails

Update dependencies
2021-07-28 16:33:01 +01:00
Pea Tyczynska 719ba698e2 Merge pull request #3288 from alphagov/bump-utils-to-revert-changes
Bump utils to revert changes to placeholders that introduced a bug
2021-07-09 14:58:02 +01:00
Pea Tyczynska e82b8bc33c Bump utils to revert changes to placeholders that introduced
a bug.
2021-07-09 14:45:41 +01:00
Pea Tyczynska 96f34bbd45 Merge pull request #3286 from alphagov/bump-utils-fix-placeholder-bug
Bump utils to bring in fix for optional placeholder bug
2021-07-09 11:24:42 +01:00
Pea Tyczynska c28e9451d4 Bump moto version to try solve dependencies version conflict
Also update mock import statements in some test files as they
stopped working with this dependency update.
2021-07-08 15:37:19 +01:00
Pea Tyczynska 9e8682ac29 Bump utils to bring in fix for optional placeholder bug
See https://github.com/alphagov/notifications-utils/pull/878 for
details.

Changes we had to make for our app and tests to work correctly
after the dependency updates:

1. Update emergency alerts polygons test because we changed
how exact we are with locations of the points on the map.

2. Use Flask's g object to set additional request attributes

So far we have been storing them in _request_ctx_stack which is
an innard for Flask's request context.

Because of major update to Werkzeug dependency, which Flask relies
on, the way we were using it stopped working, so we had a new
way to set those values.
The way we set those values now, by using g object, seems to also
be favoured in Flask documentation:
https://flask.palletsprojects.com/en/1.1.x/reqcontext/#how-the-context-works
2021-07-08 12:18:09 +01:00
Pea Tyczynska d16ceaf3dc Merge pull request #3245 from alphagov/validate-constraint
Validate ck_user_has_mobile_or_other_auth constraint
2021-05-14 10:12:50 +01:00
Pea Tyczynska 1f6e225a1b Validate ck_user_has_mobile_or_other_auth constraint
This is second step out of two step migration.
We divided it like this to avoid potentially locking
production database for extended amounts of time.
2021-05-13 17:34:35 +01:00
Pea Tyczynska 4b8c389d56 Merge pull request #3243 from alphagov/add-2fa-type-webauthn
Add webauthn as an auth type
2021-05-13 14:31:53 +01:00
Pea Tyczynska d6c3b5e0c9 Do not validate constraint when creating it
To avoid locking production database for extended amounts of time.
2021-05-13 14:13:54 +01:00
Pea Tyczynska 251107029a Add webauthn to tests that include other auth types 2021-05-13 12:44:36 +01:00
Pea Tyczynska 098c6f031b Add webauthn as an auth type.
Both in our models and as a migration to add it to auth_types
table.

Make sure that if we downgrade, we first clean up the data.
2021-05-13 12:44:36 +01:00
Pea Tyczynska d6fead7c04 On update, check that webauthn credential belongs to user 2021-05-12 17:48:38 +01:00
Pea Tyczynska e6291187ba Remove registration_response from webauthn serialize - not needed in admin app
Also fix tests:

First add init file so the tests are found correctly, then update
the tests after we stopped serialising webauthn
registration_response.
2021-05-12 17:48:37 +01:00
Pea Tyczynska 3798a3bd1d Add webauthn_credential table
This is to store data for registered webauthn credentials, so
platform admins can later use them to log in.
2021-05-12 17:48:36 +01:00
Pea Tyczynska df19a91b7f Update error messages after SQLAlchemy version update 2021-04-29 13:32:36 +01:00
Pea Tyczynska 317ae5dbd4 Apply requirements update 2021-04-29 13:32:36 +01:00
Pea Tyczynska e1a626855d Update error messages after SQLAlchemy version update 2021-04-23 16:48:36 +01:00
Pea Tyczynska 66127f3800 Apply requirements update 2021-04-22 16:59:15 +01:00
Pea Tyczynska 38af26cc78 Merge pull request #3199 from alphagov/admin-cancel-broadcast
Allow platform admins to cancel broadcasts.
2021-04-20 14:47:45 +01:00
Pea Tyczynska fce6a2d8dc Allow platform admins to cancel broadcasts.
Also update error message for when someone does not have permissions.

The message referenced approving broadcasts specifically, whereas
people would also see it if they try to cancel or reject
broadcast without permission.

Why we allow platform admins to cancel broadcasts:
we do this so they can react quickly if a broadcast was
approved by accident.
2021-04-20 12:27:38 +01:00
Pea Tyczynska 1a6ad92490 Merge pull request #3194 from alphagov/allow-double-hyphens-in-email-domains
Bump utils to allow double hyphens in email address domain
2021-03-30 11:06:08 +01:00
Pea Tyczynska a3aad24fe1 Bump utils to allow double hyphens in email address domain
It was requested by our user and it is an allowed domain format
with Amazon SES, so we started allowing it in our validation.
2021-03-29 17:53:29 +01:00
Pea Tyczynska 1903e8f268 Merge pull request #3168 from alphagov/client-reference
If client reference not given, try to get it from personalisation
2021-03-24 15:34:34 +00:00
Pea Tyczynska 52c529ab3a Use personalisation to set client_reference for letters
which were sent through Notify interface only. This is done
to avoid performance dip from additional operation for
other notification types.
2021-03-24 14:55:10 +00:00
Pea Tyczynska a2da8bc070 If client reference not given, try to get it from personalisation.
This is mostly useful for letters.

For templated letters sent via interface, whether one-offs
or CSV uploads, we do not give our users a way to set client reference.

Still, they often have a placeholder with reference that we could use
to set client_reference field.

Why is this helpful?

When letter is returned, or when we experience some printing issues,
often it is difficult to identify letters after the retention period.

This change will make it easier for some users to identify letters.
It will have more impact if we inform our users of this in template
editing guidance.
2021-03-24 14:55:10 +00:00
Pea Tyczynska 7c304f6753 Merge pull request #3163 from alphagov/billing-report
Update usage endpoint with billing details for orgs and services
2021-03-23 11:26:23 +00:00
Pea Tyczynska 0dbe4b27c8 Rearrange fixture for readability 2021-03-19 16:50:01 +00:00
Pea Tyczynska 04525dc8c1 Billing report only has services with bills to pay 2021-03-19 16:50:01 +00:00
Pea Tyczynska dd278a0567 Rename get_usage_for_all_services to get_data_for_billing_report
That describes what it does more correctly. As it does not include
services with no usage.
2021-03-19 16:50:01 +00:00
Pea Tyczynska 100d47f4e8 Refactor test and fixture for getting billing report data
Names of services and orgs were confusing, and variable setting
was done in a way that made it easy to introduce errors.

Now hopefully it is more readable and more error-proof.
2021-03-19 16:50:00 +00:00
Pea Tyczynska 4c3d70fd55 Update usage endpoint with billing details for orgs and services 2021-03-19 16:49:48 +00:00
Pea Tyczynska 516a982592 Merge pull request #3159 from alphagov/add-date-to-dvla-email-personalisation
Add date to personalisation for DVLA email
2021-02-24 14:54:06 +00:00
Pea Tyczynska f3e0cfc727 Pull DVLA address from credentials on staging
So that we can test this flow on staging.
2021-02-24 11:34:29 +00:00
Pea Tyczynska 8e3ef5ff05 Add DVLA_EMAIL_ADDRESS to manifest so it gets picked up from
credentials.
2021-02-24 10:32:20 +00:00
Pea Tyczynska 4fc3af9811 Add date to personalisation for DVLA email
Personalisation was missing date attribute. The email still got sent
tonight, just it didn't have a value for date placeholder.
2021-02-24 10:22:22 +00:00
Pea Tyczynska 8e5f956009 Merge pull request #3151 from alphagov/daily-volumes-dvla
Send daily email with volumes of letters and sheets to DVLA
2021-02-23 15:24:31 +00:00
Pea Tyczynska b05ddd4978 Don't donwgrade if the environment is production
Because we are nervous about deleting data on prod, since it can
block the db.
2021-02-23 15:13:53 +00:00
Pea Tyczynska 5c22c926b0 Stub DVLA email for all envs except prod
In prod we will get it from Credentials. In other envs, we don't
really want to send real email.
2021-02-23 15:13:52 +00:00
Pea Tyczynska e0c73ac342 Send daily email with letter and sheet volumes to DVLA 2021-02-23 15:13:19 +00:00
Pea Tyczynska 6dab63130d Make import order alphabetical 2021-02-23 15:13:19 +00:00
Pea Tyczynska c8ffebcce8 Query to get letter and sheet volumes
So we can send daily email with these volumes to DVLA.
2021-02-23 15:13:18 +00:00
Pea Tyczynska 88233543c3 Add email template for daily letter volumes 2021-02-23 15:13:18 +00:00
Pea Tyczynska df00e16100 Merge pull request #3127 from alphagov/stubbed-not-nullable
Make stubbed column on broadcast_message non-nullable
2021-02-10 14:02:17 +00:00
Pea Tyczynska 6e1c5a70c0 Make stubbed column on broadcast_message non-nullable
But first set any null values there to False.
2021-02-09 16:33:11 +00:00
Pea Tyczynska c2191d3a0e Merge pull request #3129 from alphagov/v2-set-stubbed
Set broadcast message to stubbed when posting broadcast via API
2021-02-09 15:37:01 +00:00
Pea Tyczynska 3037bf5fff Set broadcast message to stubbed when posting broadcast via API 2021-02-09 10:41:36 +00:00
Pea Tyczynska e0ddb5a39e Merge pull request #3126 from alphagov/fix-cryptography-build-problem
Pin cryptography to a version < 3.4
2021-02-08 17:25:44 +00:00
Pea Tyczynska 7cc8371c7f Pin cryptography to a version < 3.4
One of our dependencies has a dependency on cryptography, which has
recently released version 3.4.

This version introduced a circular import error
(pyca/cryptography#5756) which was fixed in
3.4.1.

However, 3.4.1 has a different error where it fails because it cannot
find a rust compiler.

The suggested
solutions are:

Install a newer version of pip which will install a pre-compiled
cryptography wheel OR
Have rust installed and available on our PATH so that it can be used
to build the package.
Since we can't change the buildpack's pip version and we cannot install
rust ourselves, the only we're left with is to avoid upgrading to 3.4 -
at least until PaaS updates their python buildpacks.
2021-02-08 17:05:46 +00:00
Pea Tyczynska f8b4c9151c Merge pull request #3122 from alphagov/add-billing-details-orgs
Add billing details for organisation
2021-02-08 16:43:08 +00:00
Pea Tyczynska bbc8cffb5b No need to alter the columns in services, they are already the right type 2021-02-08 10:45:28 +00:00
Pea Tyczynska aa7bc3d9b4 Serialise org notes and billing details 2021-02-05 14:44:43 +00:00
Pea Tyczynska 02bc87c096 Add billing details and notes for organisation table 2021-02-05 14:44:42 +00:00
Pea Tyczynska df4ba22912 Merge pull request #3114 from alphagov/preview-wont-stub
Don't stub broadcasts on preview
2021-01-29 16:00:11 +00:00
Pea Tyczynska 552e543bc2 Don't stub broadcasts on preview
So that MNOs can use training mode accounts to test end-to-end
broadcast sending. This will enable them to approve their own
broadcasts.
2021-01-29 15:49:50 +00:00
Pea Tyczynska 51c0ece130 Merge pull request #3108 from alphagov/stub-training-broadcasts
Stub training broadcasts
2021-01-28 11:58:47 +00:00
Pea Tyczynska d4cc250510 Don't create broadcast provider messages for stubbed broadcasts 2021-01-27 10:20:44 +00:00
Pea Tyczynska 26d6b4a958 Mark broadcast message as stubbed when sent from training account 2021-01-27 10:20:43 +00:00
Pea Tyczynska a93a35de8d Add 'stubbed' column to broadcast_message table
This is a boolean column. It will be set to True for broadcasts
created from training broadcast accounts.

This will help us debug, for example by excluding all the stubbed
broadcasts when we have some trouble with real broadcasts.
2021-01-27 10:20:43 +00:00
Pea Tyczynska dfbd31cef8 Merge pull request #3106 from alphagov/billing-fields-for-service
Add billing details fields to Service model and db table
2021-01-26 15:14:05 +00:00
Pea Tyczynska b3abdfb401 Rename billing contact email and name fields to plural
So:

'billing_contact_email_address' becomes 'billing_contact_email_addresses'
AND
'billing_contact_name' becomes 'billing_contact_names'

This is to signify that each of those fields can contain numerous
items
2021-01-25 17:53:27 +00:00
Pea Tyczynska ffac16a2a0 Add new billing details to test_get_service_by_id 2021-01-25 17:42:18 +00:00
Pea Tyczynska e703d1a172 Add billing details fields to Service model and db table
The fields are:
Purchase order number - string field
Billing contact name - text field to acommodate possible multiple
contacts
Billing contact email address - text field to acommodate possible
multiple contacts
Billing reference - string field

All these fields are nullable. Notify platform admins will be
able to check and edit those values in Service Settings
section in Notify interface.

This will help make billing tasks and reports simpler.

Similar fields will also be added to Organisation model and
db table.
2021-01-20 18:00:43 +00:00
Pea Tyczynska 882da84182 Merge pull request #3096 from alphagov/add-notes-to-service
Add notes column to services table
2021-01-19 14:45:42 +00:00
Pea M. Tyczynska 2749a707f2 Merge pull request #3067 from alphagov/fix-cancel-broadcast
Fix cancel broadcast by converting reference date to string
2020-12-21 13:56:19 +00:00
Pea M. Tyczynska 519568970c Merge pull request #3059 from alphagov/cancel_broadcast_cbc
Add cancel routes to cbc proxy clients
2020-12-18 12:09:49 +00:00
Pea M. Tyczynska bb41cabeb6 Merge pull request #3065 from alphagov/up-email-size-limit
Increase email size limit to 2MBby pulling in new utils
2020-12-16 16:14:58 +00:00
Pea M. Tyczynska a70b7c521e Merge pull request #3053 from alphagov/ibag-message-number
Add sequential message number to broadcast provider messages
2020-12-09 13:02:25 +00:00
Pea M. Tyczynska fefcb009d5 Merge pull request #3041 from alphagov/turn-on-sms-email-stubs-staging
Turn on SMS and email stubs on staging
2020-11-23 12:02:15 +00:00
Pea M. Tyczynska ffb19346e0 Merge pull request #3039 from alphagov/give-providers-equal-shares-of-traffic
Give sms providers equal shares of traffic
2020-11-19 10:48:56 +00:00
Pea M. Tyczynska b503267062 Merge pull request #2992 from alphagov/validate-email-size
Tailor message-too-long error message depending on the notification type
2020-10-30 11:07:29 +00:00
Pea M. Tyczynska c149f5020f Merge pull request #3004 from alphagov/divide-letters-by-service
Divide letters by service when putting in ZIP files
2020-10-21 15:31:26 +01:00
Pea M. Tyczynska 05160bc064 Merge pull request #2999 from alphagov/temporary-measure-letters
Temporarily do not send letters from Insolvency Service to DVLA
2020-10-16 16:24:34 +01:00
Pea M. Tyczynska 50982ff36a Merge pull request #2991 from alphagov/reset-password-email-gets-forward-link
Put redirect link in reset password email link
2020-10-12 12:26:42 +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 M. Tyczynska a2f911b253 Merge pull request #2924 from alphagov/add-contact-block-to-serialize-template
Add contact block to serialize template for v2
2020-07-23 15:42:17 +01:00
Pea M. Tyczynska fbdfa6416f Merge pull request #2921 from alphagov/remove-statsd-http-api-decorators
Remove statsd http api decorators and turn statsd back on for celery apps
2020-07-14 10:16:44 +01:00
Pea M. Tyczynska 5538c9697b Merge pull request #2905 from alphagov/dont-fail-check-migration
always run migrations if app is down
2020-07-08 11:49:32 +01:00
Pea M. Tyczynska 9186083ea7 Merge pull request #2796 from alphagov/split-letters-into-zips-based-on-postage
Split letters into zips based on postage
2020-07-08 11:49:21 +01:00
Pea M. Tyczynska 3954cd0e4a Merge pull request #2916 from alphagov/prevent-race-condition-sms-status
Do not update notification to sending if the status is already final
2020-07-06 13:16:36 +01:00
Pea M. Tyczynska 106185f418 Merge pull request #2913 from alphagov/turn-stubs-off-staging
Turn off the sms stub and email stub in staging
2020-07-03 10:33:29 +01:00
Pea M. Tyczynska 75a7e9b7fd Merge pull request #2892 from alphagov/refactor-crown-dependency-check
Refactor crown dependency check
2020-06-23 11:19:17 +01:00
Pea M. Tyczynska dcc407efea Merge pull request #2878 from alphagov/uk-prefix
Make sure people without international sms permission can send to crown dependencies
2020-06-19 16:58:48 +01:00
Pea M. Tyczynska 852d1ffa03 Merge pull request #2867 from alphagov/turn-off-email-stub
Turn off email stub on staging
2020-06-09 12:10:28 +01:00
Pea M. Tyczynska c63a78242c Merge pull request #2865 from alphagov/stub-email-and-sms-in-staging
Point API for staging at email and sms stubs for the soak tests.
2020-06-08 17:45:44 +01:00
Pea M. Tyczynska db040c40b9 Merge pull request #2860 from alphagov/put-status-codes-in-logs
Put status codes in logs
2020-06-02 16:06:05 +01:00
Pea M. Tyczynska 9f816ad5f5 Merge pull request #2856 from alphagov/mmg_detailed_response
Capture detailed delivery receipt status from MMG
2020-06-01 15:23:53 +01:00
Pea M. Tyczynska 2f8947afde Merge pull request #2832 from alphagov/move-pdf-creation-on-a-template-preview-task
Move pdf creation onto a template preview task
2020-05-11 16:18:58 +01:00
Pea M. Tyczynska 6724b2cd74 Merge pull request #2817 from alphagov/update_healthcheck_page
Update _status page - remove references to Travis
2020-04-24 14:09:44 +01:00
Pea M. Tyczynska d88b20beec Merge pull request #2813 from alphagov/firetext-check-code-on-failure-only
Check failure code on failure only.
2020-04-21 15:23:26 +01:00
Pea M. Tyczynska 750a573afc Merge pull request #2812 from alphagov/firetext-000-code
Take into consideration Firetext 000 code - no error.
2020-04-21 12:21:36 +01:00
Pea M. Tyczynska 850a56ab04 Merge pull request #2803 from alphagov/firetext-response-codes
Use firetext response code to see if temporary or permanent failure if available
2020-04-21 10:50:46 +01:00