Commit Graph

2283 Commits

Author SHA1 Message Date
Rebecca Law
52bf6dabcd The regex to validate uuids was not rejecting uuids with a space at the end.
Switched to using a isinstance check on the string.
Added an order by clause to dao_get_template_usage_stats_by_service, it was causing an itermitten failure in the tests.
2018-02-15 13:34:06 +00:00
Rebecca Law
d8b062a960 Merge pull request #1664 from alphagov/switch-to-pdf-flow
Switch to using the pdf letter flow.
2018-02-14 15:36:12 +00:00
Rebecca Law
12352a4153 Merge pull request #1635 from alphagov/remove-failed-as-a-status
Remove failed as a possible status
2018-02-14 14:35:01 +00:00
Katie Smith
e1cc8175d7 Allow services to add puntuation to or change the case of their name
Changed the '/service/unique' endpoint to optionally accept the
service_id parameter. It now doesn't matter if a user tries to change
the capitalization or add punctuation to their own service name. But
there should still be an error if a user tries to change the punctuation
or capitalization of another service.

service_id needs to be allowed to be None until notifications-admin is
updated to always pass in the service_id.
2018-02-14 10:11:46 +00:00
Rebecca Law
e736c90d00 Switch to using the pdf letter flow.
When sending letters always use the pdf letter flow regardless of service permissions.
2018-02-13 18:38:32 +00:00
Ken Tsang
f09bcf5ed9 Refactored organisation dao test 2018-02-13 16:38:35 +00:00
Ken Tsang
4576bdd64f Reraise integrity errors on org name unique contraints as 400
- currently being raised as 500s, but should really be 400s as the request data has the duplicate name
2018-02-13 14:47:03 +00:00
Ken Tsang
d80c7d4f65 Return services serialized for dashboard for orgs
- rather than returning the entire service, return only whats needed when listing the service on the org dashboard
2018-02-13 14:06:43 +00:00
Ken Tsang
085110417f Refactor organisation_dao 2018-02-13 14:06:43 +00:00
Ken Tsang
44f9143d08 Organisation services API endpoints 2018-02-13 14:06:43 +00:00
Ken Tsang
60f96ab598 Organisation service DAO 2018-02-13 14:06:43 +00:00
Richard Chapman
da669e46f0 Import of time was not needed - removed 2018-02-12 17:08:10 +00:00
Richard Chapman
d2f4f544c1 Added a freezetime to the test test_create_letters_pdf_calls_s3upload
as it failed on prodction and I managed to get it to fail locally

{'file_location': '2018-02-12/NOTIFY.FOO.D.2.C.N.20180212164427.PDF'}
!= {'file_location': '2018-02-12/NOTIFY.FOO.D.2.C.N.20180212164428.PDF'}

A freeze time till ensure that the finame which is based on the time
will not fail.
2018-02-12 16:55:15 +00:00
Leo Hemsted
1ef6718918 Merge pull request #1646 from alphagov/add-tags-to-pdf-letters
upload letter pdfs with retention tag
2018-02-12 15:03:53 +00:00
Rebecca Law
fa8cd780b0 Make the errors in the process_sms_client_reponse more obvious by changing variable name.
Added a missing test if mmg sends a CID (or reference) that is not a UUID.

NB: All client specific tests are in test_callbacks.
2018-02-12 12:06:43 +00:00
Katie Smith
5eee0cf78b Merge pull request #1639 from alphagov/create-new-organisation-model
Create new organisation model
2018-02-12 12:02:58 +00:00
Leo Hemsted
093e8083e0 upload letter pdfs with retention tag
so we can delete them automatically with s3's lifecycle policy
2018-02-09 17:13:37 +00:00
Chris Hill-Scott
c0e2a478f6 Allow admin to specify domain for email auth links
Similar to https://github.com/alphagov/notifications-api/pull/1515

This lets the admin app pass in a domain to use for email auth links,
so that when it’s running on a different URL users who try to sign in
will get an email auth link for the domain they sign in on, not the
default admin domain for the environment in which the API is running.
2018-02-09 14:19:17 +00:00
Katie Smith
4a14225d04 Change Organisation DAO update method
- Changed the organisation DAO update method to only make 1 query
- Updated the update rest endpoint to not return an organisation when
the update is successful
2018-02-09 11:17:13 +00:00
Rebecca Law
e68604a600 Merge branch 'master' into remove-failed-as-a-status 2018-02-09 10:58:25 +00:00
Katie Smith
269923ba28 Add Organisations endpoints
As part of this we also needed to add:
- schemas for validation
- serialize method for Organisation model
2018-02-08 15:22:21 +00:00
Katie Smith
6a79eedbce Add Organisation DAO 2018-02-08 14:44:40 +00:00
Leo Hemsted
7ac351d9b3 Merge pull request #1633 from alphagov/email-branding-remove-org
Email branding remove org
2018-02-08 10:59:11 +00:00
Rebecca Law
b2dfa59b1b We are not handling the case of an unknown status code sent by the SMS provider. This PR attempts to fix that.
- If the SMS client sends a status code that we do not recognize raise a ClientException and set the notification status to technical-failure
- Simplified the code in process_client_response, using a simple map.
2018-02-07 17:49:15 +00:00
Leo Hemsted
ba20010f27 remove organisation from api 2018-02-07 11:39:33 +00:00
Richard Chapman
a5343fb837 Merge pull request #1628 from alphagov/rc_updated_to_use_utils_statsd
Removed statsd from the api and use the statsd in the utils library.
2018-02-07 09:07:16 +00:00
Leo Hemsted
b9446b660d exclude test keys from template usage page
they were not included in nightly task since that runs off
NotificationHistory, which doesn't include test keys. However, when you
load the page we top up the nightly stats with today's data from the
Notifications table, which *does* include test data.
2018-02-06 14:31:12 +00:00
Leo Hemsted
0c67a61604 ensure old route still returns json in same shape 2018-02-06 12:10:00 +00:00
Leo Hemsted
2f79da8702 create, edit and use email branding instead of organisation
notable things that have been kept until migration is complete:

* passing in `organisation` to update_service will update email branding
* both `/email-branding` and `/organisation` hit the same code
* service endpoints still return organisation as well as email branding
2018-02-06 11:23:34 +00:00
Leo Hemsted
cea52929d3 Merge pull request #1621 from alphagov/email-branding-mapping-table
Email branding mapping table
2018-02-06 09:56:31 +00:00
Richard Chapman
d855b4e4ec Removed statsd from the api and use the statsd in the utils library.
The statsd code was added to the utils library a while ago, uses the
statsd from the util library and therefore consolidates the code into
once place.
2018-02-06 09:52:15 +00:00
kentsanggds
4773e1b51b Merge pull request #1617 from alphagov/ken-set-page-count-0-fake-dvla-response
Update the dvla response data to 0 page count
2018-02-05 10:48:28 +00:00
Leo Hemsted
5d00abd6bc update service_email_branding mapping table alongside organisation_id 2018-02-02 12:50:53 +00:00
Leo Hemsted
800fbb4c6e Merge pull request #1613 from alphagov/international-500
fix 500 when receiving delivery receipt from some international nums
2018-01-30 13:58:39 +00:00
Leo Hemsted
3d389472b8 fix 500 when receiving delivery receipt from some international nums
if the international_billing_rates.yml has `dlr: null`, that means we
don't know what delivery receipts they provide - they might not provide
any. So if we do get an update, we don't know for sure that the message
was actually delivered - lets not update it.
2018-01-30 12:08:18 +00:00
Chris Hill-Scott
aab05ac8f1 Merge pull request #1600 from alphagov/letters-for-new-services
Turn letters on by default for new services
2018-01-30 11:07:55 +00:00
Ken Tsang
9122efc45e Update the dvla response data to 0 page count
- as the response is fake, the notifications billable_unit is left at 0, the fake dvla response should also be 0. Otherwise there will be confusing logs reporting mismatched page count and billable units which are just research ones.
2018-01-29 16:39:53 +00:00
Ken Tsang
54835b56e1 Remove sent to dvla task
- task not really necessary as the status is already set to 'sending' before the task is called if it is not sending i.e. in reseach mode or using a test key
2018-01-29 14:34:22 +00:00
Ken Tsang
5ef9b426bb Update letter notification processing for letter pdfs in research mode
- calls create fake response file to allow functional tests to run and trigger update of status to delivered only on preview and development so that FT response files don't pollute staging and live buckets
2018-01-26 15:05:02 +00:00
Ken Tsang
377afc3ed4 Update letter processing for letter pdfs in research mode
- call create fake response file task if in research mode only on preview and development environments to not impact response files on staging and live
2018-01-26 15:04:56 +00:00
Ken Tsang
c14452d8b1 Add create fake letter response file
- used by letter functional tests to ensure that we can create the response file necessary to trigger the update to a delivered state
2018-01-26 14:45:36 +00:00
Ken Tsang
04beff7d05 Return sorted ACK files
- also fixes unit test failure due to random order of filenames
2018-01-26 14:45:36 +00:00
Ken Tsang
edd030e5dd Refactor code to move business logic
- DVLA specific logic is now moved to letters_pdf_tasks
2018-01-26 14:45:36 +00:00
Ken Tsang
3355a29d01 Ensure letter personalisation is serialized correctly
The personalisation for letters can take different formats depending on
how the letter was generated, for example it can contain either
address_line_1 or addressline1. This change ensures that it is always
serialized in the same way.
2018-01-24 16:44:14 +00:00
Chris Hill-Scott
e9aba34c5e Turn letters on by default for new services
Letters is a mature enough feature now – and one that we’ve been talking
about offering for long enough – that we shouldn’t make people dig
around in the settings.

I think we’d want to wait a bit longer/indefinitely before deciding to
turn it on for existing services across the platform.
2018-01-24 13:42:11 +00:00
Venus Bailey
82e34f7699 Merge branch 'master' into letter-deskpro-ack-mod 2018-01-23 11:32:49 +00:00
venusbb
8cb8de8664 changed tests 2018-01-23 10:13:56 +00:00
Katie Smith
84e25d6b98 Compare letter page count with billable units in DVLA response file
We compare the page_count in the response file we receive from the DVLA
with the billable_units of the letter. If these don't match, we log an
error.
2018-01-23 08:59:01 +00:00
Katie Smith
f1c75c5c5d Change notification status of failed letters
- Changed the notification status of letters for letters that DVLA marks
as 'failed' from NOTIFICATION_TECHNICAL_FAILURE to
NOTIFICATION_TEMPORARY_FAILURE.
2018-01-23 08:59:01 +00:00
Ken Tsang
6a3c2734ca Update callback handling to process DVLA response files
- handle `RS.TXT` and `RSP.TXT` files
2018-01-23 08:59:01 +00:00