Commit Graph

1667 Commits

Author SHA1 Message Date
Rebecca Law
0f26584761 Merge pull request #1164 from alphagov/check-service-name-is-unique
Check service name is unique
2017-08-10 10:21:58 +01:00
Leo Hemsted
e7b13e727a don't capture logs directly from stdout
previously in run_app_paas.sh, we captured stdout from the app and
piped that into the log file. However, this came up with a bunch of
problems, mainly:

* exceptions with stack traces often weren't formatted properly,
  and kibana could not parse them
* celery logs were duplicated - we'd collect both the json logs and
  the human readable stdout logs.

instead, with the updated utils library, we can use that to log json
straight to the appropriate directory directly.
2017-08-09 15:29:39 +01:00
Rebecca Law
1ec6a3b73d Created a new service endpoint that checks if the service name or email_from is unique.
Why is this needed?
When a user updates a service name they enter the new name in a form, are then asked to confirm the change by entering their password. Then the API call to update_service is called. If we let the update serivce API call fail with the integrity constraint it will be ackward for the user.
2017-08-09 15:12:52 +01:00
Leo Hemsted
14dd18aefc Merge pull request #1163 from alphagov/letter-template-subject
make sure template serialises letter subjects
2017-08-09 12:33:34 +01:00
Leo Hemsted
da02ffa32f ensure template history serializes using template serialize fn 2017-08-09 12:24:35 +01:00
Leo Hemsted
c9762f75a1 make sure template serialises letter subjects 2017-08-09 11:56:52 +01:00
Imdad Ahad
4d53481737 Merge pull request #1134 from alphagov/imdad-feat-check-notification-table-for-last-template-usage
Update the last template usage query to check Notification table
2017-08-09 10:22:21 +01:00
Leo Hemsted
5491adcabd address_line_2 is a required field 2017-08-07 14:23:44 +01:00
Imdad Ahad
864e356163 Add test to check with notificationhistory but no notification 2017-08-07 13:33:10 +01:00
Imdad Ahad
f5e38a896c Update the last template usage query to check Notification table:
* Don't check the NotificationHistory table (this can cause a timeout)
* Check template actually exists first
2017-08-07 10:19:21 +01:00
Imdad Ahad
e148fafd53 Merge pull request #1144 from alphagov/imdad-feat-schedule-billing-and-adjust-backfill
Populate monthly billing on a schedule and make backfill less granular
2017-08-03 10:54:16 +01:00
Leo Hemsted
9c940ab8b4 Merge pull request #1136 from alphagov/letter-api
Letter api
2017-08-02 16:15:30 +01:00
Leo Hemsted
372b10f19c fix up tests to be internally consistent
notifications should always have at least one of job and api key, and
the key type should match the api key's key type (or be 'normal')
2017-08-02 15:35:56 +01:00
Imdad Ahad
824063ddb8 Fix to return billing data before a rate begins 2017-08-02 15:32:34 +01:00
Leo Hemsted
5d61b3644c add tests for new test-key handling 2017-08-02 11:14:05 +01:00
Leo Hemsted
075d2a3346 tighten key_type validation on letters api
when in research mode or test key, dont send letters via api - instead,
just put them straight to success state

when using a team key, flat out reject the request (403)
2017-08-01 15:49:00 +01:00
Imdad Ahad
dc7a1051a6 Refactor 2017-08-01 14:04:17 +01:00
Leo Hemsted
76ea0dbc76 Merge branch 'master' of github.com:alphagov/notifications-api into letter-api 2017-07-31 18:15:16 +01:00
Imdad Ahad
d01d875f7e Fix issue where monthly billing data was not being updated: 2017-07-31 17:47:53 +01:00
Leo Hemsted
8e738b783e update test_send_notification to account for new uuid mock 2017-07-31 11:10:05 +01:00
Leo Hemsted
11f8603319 Remove custom error message from personalisation validation
There's no longer a single err msg that fits all problems with
personalisation - since letters expect specific fields there
2017-07-27 16:49:37 +01:00
Leo Hemsted
2ab105aaf4 add tests for letter api notifications 2017-07-27 16:43:55 +01:00
Leo Hemsted
f528236eda make job.created_by nullable
Since letter jobs from the API aren't created by any single individual,
lets make created_by nullable. Note: We'll have to make sure that we
update the admin app to handle these jobs nicely
2017-07-27 12:58:13 +01:00
kentsanggds
2df411a985 Merge pull request #1131 from alphagov/ken-update-email-logo-use-cdn
Update email logo to use logo CDN
2017-07-27 11:50:00 +01:00
Leo Hemsted
11458c421b ensure permissions are correct in sample letter fixtures
sample_letter_* should always include a service that has letter
permissions.

Also, print out the JSON response in the admin_request fixture if the
response code doesn't match
2017-07-27 11:12:09 +01:00
Rebecca Law
c1f2634c90 Removed month and year and replaced it with start_date and end_date.
This will allow us to sort the data properly.
2017-07-26 13:19:17 +01:00
Ken Tsang
3e6e75998b Update config to use logo cdn 2017-07-26 11:05:31 +01:00
Rebecca Law
3878ece9ea Merge pull request #1129 from alphagov/use-bst-for-month
Use BST to calculate monthly billing
2017-07-26 09:56:15 +01:00
Rebecca Law
f73b5140ed Bah! style check 2017-07-25 17:47:08 +01:00
Rebecca Law
b62ee8380c Use BST to calculate monthly billing 2017-07-25 17:38:53 +01:00
venusbb
fb601daedc Merge branch 'master' of https://github.com/alphagov/notifications-api into sms_whitelist 2017-07-25 17:14:59 +01:00
Rebecca Law
3d3703750c Merge pull request #1126 from alphagov/month-billing-table
Add transactional for new query
2017-07-25 16:07:53 +01:00
Rebecca Law
e23d38de26 Fix bug in get rates function. 2017-07-25 15:50:14 +01:00
Leo Hemsted
0ce9b94c36 Merge pull request #1075 from alphagov/letter-api-refactor
Letter api step 1 - refactor
2017-07-25 14:53:39 +01:00
Rebecca Law
5612ca023e - Add transactional
- Rename function for clarity
2017-07-25 14:26:42 +01:00
Rebecca Law
eaf5cbb868 Add labels to query so that the named tuples can be referenced later.
Remove unnecessary function
2017-07-25 11:43:41 +01:00
Rebecca Law
91f29517eb Merge branch 'master' into month-billing-table 2017-07-24 15:17:36 +01:00
Rebecca Law
3e2b8190b9 - Added a scheduled task to create or update billing for the month, yesterday is used to calculate the start and end date for the month.
- The new task has not been added to the beat application yet.
- Added an updated_at column to the monthly billing table, we may want to only calculate from the last updated date rather than the entire month.
2017-07-24 15:13:18 +01:00
Leo Hemsted
6059dcfe11 Merge pull request #1093 from alphagov/queue-split-part-2
[2/3] send to new queues
2017-07-24 15:11:37 +01:00
Leo Hemsted
614880f6d9 send to send-sms-tasks and send-email-tasks instead of send-tasks 2017-07-21 13:49:37 +01:00
Rebecca Law
d4bbca2592 Fix for simulated notifications.
When a post is made for a simulated number the id is empty in the notificaiton object that we return.
This fixes that.
2017-07-20 17:56:51 +01:00
Leo Hemsted
79e33073c9 raise 404 when unknown url
consistent with other endpoints.

also refactor of notification_schema to separate some fns to a different file
2017-07-20 15:23:51 +01:00
Leo Hemsted
9caf45451e make persist_notification require kwargs
when functions get as big as that, it's confusing to try and work out what
things are what. By including a * as the first arg, we require that anyone
calling the function has to use kwargs to reference the parameters
2017-07-19 17:02:19 +01:00
Leo Hemsted
7f4eec79e4 add POST letter schema
similar to sms/email, however, for consistency with response values
and internal storage, rather than supplying an "email_address" field
or a "phone_number" field, supply an "address_line_1" and "postcode"
field within the personalisation object.
2017-07-19 17:02:19 +01:00
Leo Hemsted
6c61a3fc2a Revert celery4
Revert the following three pull requests:
https://github.com/alphagov/notifications-api/pull/1085
https://github.com/alphagov/notifications-api/pull/1086
https://github.com/alphagov/notifications-api/pull/1088

celery 4.0.2 looked promising, however, on staging under mild load
(5/sec api calls) the performance was actually worse than 3.1.25
2017-07-19 15:17:19 +01:00
Rebecca Law
9400988d72 Monthly billing - part 1
This is still a work in progress but it would be good to get some eyes on it.
This commit includes creating and updating a row in the monthly billing table and a method to fetch the results.
There is a command to populate the monthly billing for a service and month so we can try it out.
The total cost at the moment are wrong, they do not take into account the free allowance - see notes below about adding that to the table.
Left to do:
create a nightly task to run to update the monthly totals.
create an endpoint to return the yearly billing, the current day will need to be calculated on the fly and added to the totals.
Add the free allowance into the total costs.
2017-07-18 18:21:35 +01:00
venusbb
d1861b2620 Merge branch 'master' of https://github.com/alphagov/notifications-api into sms_whitelist 2017-07-14 16:40:44 +01:00
Rebecca Law
4b05c32b62 Create a new table to warehouse the monthly billing numbers 2017-07-13 17:22:11 +01:00
Leo Hemsted
2aae0f9300 Merge pull request #1085 from alphagov/celery4
Celery 4 (attempt 2)
2017-07-13 11:54:32 +01:00
venusbb
a5cf8ff60f put more log messages to view what env returns 2017-07-12 13:49:20 +01:00