Commit Graph

371 Commits

Author SHA1 Message Date
Ken Tsang
54446d5f4d Add default permissions when creating a service 2017-05-17 14:18:12 +01:00
Martyn Inglis
83a1b1526e Merge branch 'master' into async-job-stats
Conflicts:
	app/notifications/notifications_ses_callback.py
2017-05-17 09:49:43 +01:00
Rebecca Law
1034762489 Ensure the relationship between Notification and ScheduledNotification is one-to-one.
Update db script with the right number
2017-05-16 15:29:31 +01:00
Rebecca Law
3c0da9c8fd Merge branch 'master' into schedule-api-notification 2017-05-16 10:50:53 +01:00
Rebecca Law
f0e2713bef Add scheduled_for in the post notification request form.
Return scheduled for in get_notification requests.
2017-05-15 17:27:38 +01:00
Ken Tsang
380bc22f22 Add relationship for service in ServicePermission 2017-05-15 13:44:52 +01:00
Rebecca Law
75a4dad8c1 New table to hold scheduled_notifications. 2017-05-15 12:59:44 +01:00
Ken Tsang
359c4d2138 add service permissions model + migration script 2017-05-15 12:52:28 +01:00
Martyn Inglis
835dcc6273 Not null job_id and rebuilt the migration script to include this 2017-05-12 13:18:12 +01:00
Martyn Inglis
63b7a4e9fe New status grouping - success 2017-05-12 12:19:44 +01:00
Martyn Inglis
d324d72926 Merge branch 'master' into async-job-stats 2017-05-11 15:41:20 +01:00
Martyn Inglis
f0e47029f2 "Created at" on the model 2017-05-11 15:23:18 +01:00
Martyn Inglis
a5caed5ac8 Changed job_stats table to have an update at time stamp 2017-05-09 14:04:19 +01:00
Martyn Inglis
d647640b65 Added job statistics table 2017-05-09 11:22:05 +01:00
Leo Hemsted
4ff4717fdf make sure we update both statuses when updating notification history 2017-05-09 11:09:16 +01:00
Leo Hemsted
7e52fa4d13 add new notification_status column to models.py
We now have a new column in the database, but it isn't being
populated. The first step is to make sure we update this column,
while still keeping the old enum based column up to date as well.

A couple of changes have had to happen to support this - one irritating
thing is that if we're ever querying columns individually, including
`Notification.status`, then we'll need to give that column a label,
since under the hood it translates to `Notification._status_enum`.
Accessing status through the ORM (i.e., my_noti.status = 'sending' or
similar) will work fine.
2017-05-04 17:24:28 +01:00
kentsanggds
56e5045e9a Merge pull request #928 from alphagov/update-billing-api-with-rate
Update billing api with rate
2017-04-28 11:40:05 +01:00
Leo Hemsted
fd4e27bfd3 add type conversion to report downloads
"sent" is fine as an internal marker but not very obvious to the end
user that it specifically refers to international messages. We now
say "Sent internationally" in the CSV
2017-04-28 11:00:55 +01:00
Rebecca Law
3b41478a0a Updated Notification model to use Float(asdecimal=False) for rate_mutliplier.
Added test with multiple rows for a month.
2017-04-28 10:10:49 +01:00
Rebecca Law
1a64509186 Change the resultset from the yearly and monthly billing data queries.
Fix some formatting of the return objects.
2017-04-28 10:10:49 +01:00
Rebecca Law
a186fc95be Added new endpoints to return the yearly-usage and monthly-usage for a given financial year and service id.
Since the response has changed I have created new endpoints so that the deployments for Admin are more managable.

Removed print statements from some tests.
2017-04-28 10:10:48 +01:00
Imdad Ahad
164ba0c6b3 as_decimal defaults to False 2017-04-27 13:50:51 +01:00
Imdad Ahad
868e102f8a Make rate_multiplier on notification return non-decimal 2017-04-27 13:24:42 +01:00
Leo Hemsted
a138ec478a Merge branch 'master' into sent-status 2017-04-26 16:52:16 +01:00
Imdad Ahad
26b35c5d15 Add intl notificiation fields 2017-04-26 11:31:05 +01:00
Imdad Ahad
5171547990 Remove blank lines 2017-04-26 09:52:02 +01:00
Imdad Ahad
25ce3851eb Add international support flag for providers 2017-04-25 17:33:16 +01:00
Leo Hemsted
02e8f454e1 add new notification status 'sent'
for international text messages, when we may not ever receive callback info,
so we need a separate status that doesn't get timed out etc
2017-04-25 17:08:29 +01:00
Rebecca Law
e8a7762688 Merge branch 'master' into update-sms-rate 2017-04-25 10:15:54 +01:00
Rebecca Law
6c8ff80440 Rename class to be singular 2017-04-25 09:53:43 +01:00
Rebecca Law
43226dc932 Added a new rates table.
We only need one rate per channel. This reflects that. The provider_rates has been left for now, it is still not being used.
New dao has been added to select the right rate for the given notification_type and date of notificaiton.
2017-04-24 16:20:03 +01:00
Ken Tsang
04796b39a8 Add international sms feature flag in db 2017-04-24 12:43:19 +01:00
Imdad Ahad
c4fac1d937 Revert "Revert "add DVLA organisations to API"" 2017-04-21 16:05:07 +01:00
Imdad Ahad
9fbd43c072 Serialise notifications for csv separately:
* Introduces separate method on Notification to serialise the notification
* ready for csv output
* Fixes issue where job_row_number = 0 not being accounted for correctly
2017-04-20 11:52:00 +01:00
Ken Tsang
89e244ccd2 First commit 2017-04-19 10:51:12 +01:00
Martyn Inglis
8956338d31 Add a new task to update a job to error - note it leaves the notifications in whatever state they were in. 2017-04-18 11:42:48 +01:00
Rebecca Law
add0cfa62f Add a task for the FTP app to call that will update the job to sent to dvla and all the notifications for that job as sending. 2017-04-06 17:16:08 +01:00
Ken Tsang
9e4b1b2bfc Add schemas, endpoints and supporting tests 2017-03-14 15:40:38 +00:00
Rebecca Law
ecb63a8008 Add new job status.
ready to send == we have created a dvla file in S3, the job id is in the file name
sent to dvla == we have created an aggregate dvla file to send for the day and have sent the file via sftp
2017-03-10 16:33:15 +00:00
Imdad Ahad
19df677315 Add created_by to provider and provider history table 2017-03-03 10:54:20 +00:00
Leo Hemsted
f5511a19a2 add letter_contact_block text field to service 2017-03-02 16:42:06 +00:00
Leo Hemsted
a47672f7e3 Add current_session_id to the user model, update on login
when we change the last logged in time, set the current session id to
a random uuid

this way, we can compare it to the cookie a user has, and if they
differ then we can log them out

also update user.logged_in_at at 2FA rather than password check, since
that feels more accurate
2017-02-22 17:30:55 +00:00
Chris Hill-Scott
c2999ed5ad Use pycodestyle instead of PEP8
PEP8 was renamed to pycodestyle; this issue explains why:
https://github.com/PyCQA/pycodestyle/issues/466

This commit changes our tests to use pycodestyle instead of pep8.

It also means:
- making a couple of whitespace changes to appease the linter
- disabling warnings for bare `Except`s (ie `Except` instead of `Except
  ValueError`) – this seems like a sensible thing to catch but I’m not
  going to make meaningful code changes in this commit
2017-02-01 09:19:32 +00:00
Rebecca Law
701851118e Update templates.process_type to be normal and set the column as not null. 2017-01-16 11:15:48 +00:00
Rebecca Law
6c79ddbe41 This is the first deploy in series of deploys to give certain templates priority in processing.
If the template is marked as priority the notification will be sent using the `notify` queue.
The `notify` queue is a low volume queue, messages here will not be queue behind a large job and should be delivered with in a more consistent time frame.

- Added templates.process_type and templates_history.process_type column.
- Added a template_process_type table to handle the enum for templates.process_type, initial values are normal and priority

https://www.pivotaltracker.com/story/show/135429147
2017-01-13 12:14:34 +00:00
Leo Hemsted
f1899c6d53 add updated_at to provider_details
it's set to utcnow from dao_update_provider_details
2016-12-19 17:45:46 +00:00
Leo Hemsted
9d1b1328af add version to provider_details and _history
set all existing rows to have a version of 1 (also copy across values
to populate the new provider_details_history table in the upgrade
script)

in dao_update_provider_details bump the provider_details.version by 1
and then duplicate into the history table as a new row
(done manually as opposed to the decorator used in template_history
since this is only edited in this one place and the decorator is icky)
2016-12-19 17:13:10 +00:00
Leo Hemsted
a197754906 add new provider_details_history table
* to be used for auditing changes to provider details
* not hooked in yet
* also made provider_details.active non-nullable. set all existing null
  provider_details.active to FALSE. none are set false on live so
  should hopefully be fairly uncontroversial
* refactored NotificationHistory.from_notification and update from noti
  to share with provider_details_history
2016-12-19 17:13:10 +00:00
minglis
9c161df2b6 Merge pull request #771 from alphagov/fix-missing-template-id
Fix for missing template IDs.
2016-12-16 14:41:54 +00:00
Martyn Inglis
2924f01f95 Fix for missing template IDs.
- Problem was that on notification creation we pass the template ID not the template onto the new notification object
- We then set the history object from this notification object by copying all the fields. This is OK at this point.
- We then set the relationship on the history object based on the template, which we haven't passed in. We only passed the ID. This means that SQLAlchemy nulls the relationship, removing the template_id.
- Later we update the history row when we send the message, this fixes the data. BUT if we ever have a send error, then this never happens and the template is never set on the history table.

Fix:
Set only the template ID when creating the history object.
2016-12-15 16:59:03 +00:00