Commit Graph

2296 Commits

Author SHA1 Message Date
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
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
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
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
venusbb
125b810050 Merge branch 'master' of https://github.com/alphagov/notifications-api into letter_ack_send_deskpro_prod_only 2018-01-22 14:54:06 +00:00
venusbb
2edb0c0883 Grammar change to despro ticket
Grammar change to despro ticket
Strip sets of empty elements
Strip subfolder in returned zip file list
ar change to despro ticket
2018-01-22 14:51:06 +00:00
venusbb
cf30e69e8c Processing ack files only send alerts in production environment.
Processing ack files only send alerts in production environment.
Deskpro alerts include bucket names for debugging purpose.
2018-01-22 12:44:03 +00:00
Chris Hill-Scott
01cf175cb2 Don’t respect the whitelist for one off sending
The whitelist was built to help developers and designers making
prototypes to do realistic usability testing of them, without having to
go through the whole go live process.

These users are sending messages using the API. The whitelist wasn’t
made available to users uploading spreadsheets. The users sending one
off messages are similar to those uploading spreadsheets, not those
using the API. Therefore they shouldn’t be able to use the whitelist to
expand the range of recipients they can send to.

Passing the argument through three methods doesn’t feel that great, but
can’t think of a better way without major refactoring…
2018-01-22 11:42:37 +00:00
venusbb
4ffb84de36 Comparison of date needs to use AWS S3 format 2018-01-19 09:24:03 +00:00
venusbb
6a790b59aa Merge branch 'master' of https://github.com/alphagov/notifications-api into letter-S3zipchange-deskpro 2018-01-18 14:45:04 +00:00
venusbb
99dda99890 Use set rather than list to compare ack file and zip files difference 2018-01-18 14:44:23 +00:00
venusbb
357ec3a7d5 Call Deskpro ticket when there is an error 2018-01-18 11:06:07 +00:00