Commit Graph

1347 Commits

Author SHA1 Message Date
Imdad Ahad
0f7093fc38 Refactor and add filename in logging 2017-05-12 14:32:01 +01:00
Imdad Ahad
37165e5b6a Add autoconfirm sns in dvla callback 2017-05-12 14:24:27 +01:00
Imdad Ahad
8a5e82904e Update to pull from correct bucket and fix tests not mocking out correctly 2017-05-12 14:24:26 +01:00
Imdad Ahad
20bb91bfdd Update DVLA callback to process request and call task (if it can) 2017-05-12 14:24:26 +01:00
Imdad Ahad
f766f90207 Add task to process a DVLA response file:
* Currently we do nothing with the parsed response. We will
* update the status of the notifications in a separate PR
2017-05-12 14:24:26 +01:00
Leo Hemsted
4d0b90bbe2 Merge pull request #943 from alphagov/schema-validation
fix v2 schema phone/email validation when non-str passed in
2017-05-11 14:42:22 +01:00
Leo Hemsted
466c833c39 marshmallow schemas no longer return _status_enum column
now return `status`, as they should
2017-05-10 17:30:09 +01:00
Leo Hemsted
348183d93b Merge pull request #942 from alphagov/status-as-table
notification status as table
2017-05-10 13:54:49 +01:00
Leo Hemsted
5ec4829d00 fix v2 schema phone/email validation when non-str passed in
jsonschema states:

> A format attribute can generally only validate a given set of
> instance types. If the type of the instance to validate is not in
> this set, validation for this format attribute and instance SHOULD
> succeed.

We were not checking for the type of the input, and our validators were
behaving in unexpected manners (throwing TypeErrors etc etc). Despite
us declaring that the phone_number field is of type `str`, we still
need to make sure the validator passes gracefully, so that the inbuilt
type check can be the bit that catches if someone passes in a non-str
value. We've seen this with people passing in integers instead of strs
for phone numbers. This'll make them receive a nice 400 error
(e.g. "phone_number 12345 is not of type string"), rather than us
having a 500 internal server error
2017-05-10 11:04:12 +01:00
Leo Hemsted
4ff4717fdf make sure we update both statuses when updating notification history 2017-05-09 11:09:16 +01:00
Rebecca Law
a564b9aeb0 Update /service/{}/notifications to look for a "to" query string, if it exists call the search notifications_by_to_field method. 2017-05-08 17:20:21 +01:00
Rebecca Law
d252dc8976 New endpoint to search by "to" field of the notification.
The query ignores case and spaces.
2017-05-05 14:12:50 +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
Rebecca Law
81e10896ea Remove print statement 2017-05-04 09:47:27 +01:00
Rebecca Law
93e76d2362 Update the valid_from date for the rate that is intended to start at the begining of the financial year.
It was the start of the financial year in BST, needed to convert it to UTC.
Small change to the logic to find the rates.
2017-05-03 17:11:48 +01:00
Ken Tsang
03885fea2f Update tests with new rates 2017-05-03 13:13:13 +01:00
Ken Tsang
a1a8397f74 Update billing data to handle future dates 2017-05-02 19:23:57 +01:00
Sakis
01e3a88d55 Merge pull request #920 from alphagov/autoconfirm_http_subscriptions
Autoconfirm http subscriptions
2017-05-02 17:03:41 +01:00
minglis
2dcebc0b52 Merge pull request #917 from alphagov/rate-limit-api-calls
Rate limit api calls
2017-05-02 15:07:54 +01:00
Rebecca Law
c40111a576 Split up a test 2017-05-02 11:20:01 +01:00
Martyn Inglis
a9539d892c Merge branch 'master' into rate-limit-api-calls
Conflicts:
	requirements.txt
	tests/app/notifications/rest/test_send_notification.py
	tests/app/notifications/test_validators.py
	tests/app/v2/notifications/test_post_notifications.py
2017-05-02 10:56:56 +01:00
Rebecca Law
3e0221adec Change get_financial_year to return ending date as 1 microsecond earlier.
That way we can write the queries as between start and end dates, making it easier to read.
This makes more sense.
2017-05-02 10:00:47 +01:00
Rebecca Law
88d92d6070 Fix the logic gettting the rates for a financial year.
The is_between_end_date_exclusive is a bit funny.
Perhaps the better way to handle it is to make the function is_between but change the financial year function return an enddate that is one millisecond less. That way we can always use the between logic and it will be easier to use.
2017-04-28 16:55:41 +01:00
Athanasios Voutsadakis
c99b65252f Fix some typos 2017-04-28 16:11:27 +01:00
Athanasios Voutsadakis
336462cdb2 Fix whitespaces 2017-04-28 15:11:36 +01:00
Athanasios Voutsadakis
74433c9335 Add tests for autoconfirmation 2017-04-28 15:11:36 +01:00
Imdad Ahad
34de722e73 Add test to check for sent notification 2017-04-28 13:32:23 +01:00
Leo Hemsted
f577e91134 treat sent as delivered in detailed service api
this is for when we fetch the large blue numbers for viewing
notifications for an entire service
2017-04-28 11:56:12 +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
Ken Tsang
baf84b53d3 Update test to check it doesn't get email usage 2017-04-28 10:10:49 +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
Rebecca Law
e1e55edd9c Add new fields to the usage queries: rate_multiplier, international, phone_prefix. 2017-04-28 10:10:48 +01:00
Rebecca Law
4c37c8bdbb New query to get billing data per month. 2017-04-28 10:10:48 +01:00
Rebecca Law
6dc336ad6c Created new queries to return the rate with the sum of billable units for the year totals.
Once we have the new columns in notifications table, the query will need to include the rate multiplier and if the number is international.
The monthly billing query will be built next.
2017-04-28 10:10:48 +01:00
Imdad Ahad
e450f15b2b Fix typo and update test now that we expect sent for international 2017-04-27 16:57:04 +01:00
Imdad Ahad
c5bd685cef Don't update sent notifications (dao) 2017-04-27 16:55:39 +01:00
Martyn Inglis
349fb3529e Handle case for international SMS - use correct phone validator, and also set status correctly.
This relies on some other code so this commit has placeholder failing tests to be populated when other PRs are merged.
2017-04-27 16:27:14 +01:00
Chris Hill-Scott
698b20596f Remove references to old utils code
These methods don’t exist any more.

Not doing this reformatting in the tests probably makes the tests more
robust too 😬
2017-04-27 16:03:27 +01:00
Imdad Ahad
162fc8de04 Merge pull request #925 from alphagov/feat-use-intl-provider-send-sms
Feat use intl provider send sms
2017-04-27 15:33:45 +01:00
Imdad Ahad
3de93cbcd0 Assume that we will only receive a UK number:
* We currently don't validate the number so this test
* will fail assuming an invalid number was passed.
* Since we do validation on the front end, for now
* we'll assume a valid number. This does need to be
* looked at in future.
2017-04-27 13:24:48 +01:00
Imdad Ahad
252c3235d7 Persist intl fields on notification 2017-04-27 13:24:36 +01:00
minglis
a8ea333606 Merge pull request #923 from alphagov/validate-int-numbers-on-api
Validate International phone numbers
2017-04-27 13:21:04 +01:00
Martyn Inglis
99081488f1 Mock out some SQS calls 2017-04-27 12:47:08 +01:00
Martyn Inglis
bedbd8e21f Removed unneeded test case 2017-04-27 12:15:47 +01:00
Martyn Inglis
cdd3ad687c updated the fixture 2017-04-27 12:14:31 +01:00
Martyn Inglis
109b1727f2 Fish out the international provider if needed. 2017-04-27 12:14:22 +01:00
Martyn Inglis
ba58c55c3b Filter provider details by international flags 2017-04-27 12:13:58 +01:00