Commit Graph

3266 Commits

Author SHA1 Message Date
Imdad Ahad
d7d2ff7af4 Query the correct table for monthly billing usage:
* Query `MonthlyBilling` for the monthly usage and transform
 response for admin
2017-08-18 13:38:53 +01:00
Imdad Ahad
2371c2c9a7 Add helper to get months for a financial year:
* No tests have been added as this was taken from the admin
  where it is already tested thoroughly.
* TODO: Move to utils
2017-08-18 12:45:05 +01:00
Chris Hill-Scott
953e2ae5bd Merge pull request #1180 from alphagov/return-template-name
Return template name in public API
2017-08-17 12:44:24 +01:00
Imdad Ahad
f30b6c4386 Merge pull request #1181 from alphagov/imdad-feat-add-new-billing-endpoints
Add endpoints to retrieve billing data
2017-08-17 11:22:15 +01:00
Imdad Ahad
f40889e6e0 This adds new endpoints to retrieve billing data from the new table:
1. Create a separate billing blueprint to house these endpoints

2. Return monthly breakdown in same format as we did before

3. Return yearly breakdown but only return {billing units, rate,
notification_type}. Admin only makes use of these.
2017-08-17 11:10:42 +01:00
Imdad Ahad
9085cc1a57 Merge pull request #1185 from alphagov/imdad-feat-update-billing-data-for-services
Update command populate billing data for services that require it
2017-08-17 09:56:06 +01:00
Katie Smith
2f84e1cc45 Merge pull request #1159 from alphagov/pyup-update-sqlalchemy-utils-0.32.9-to-0.32.14
Update sqlalchemy-utils to 0.32.14
2017-08-16 15:58:06 +01:00
Katie Smith
a4372b901e Merge pull request #1102 from alphagov/pyup-update-psycopg2-2.6.2-to-2.7.3
Update psycopg2 to 2.7.3
2017-08-16 15:57:58 +01:00
Katie Smith
12155fe1a4 Merge pull request #1107 from alphagov/pyup-update-marshmallow-sqlalchemy-0.8.0-to-0.13.1
Update marshmallow-sqlalchemy to 0.13.1
2017-08-16 15:57:49 +01:00
Imdad Ahad
9b88dadb83 Update command populate billing data for services that require it 2017-08-16 15:15:34 +01:00
Katie Smith
83c0380c35 Merge pull request #1161 from alphagov/pyup-update-gunicorn-19.6.0-to-19.7.1
Update gunicorn to 19.7.1
2017-08-16 14:10:35 +01:00
Katie Smith
343eae57a1 Merge pull request #1182 from alphagov/pyup-update-coveralls-1.1-to-1.2.0
Update coveralls to 1.2.0
2017-08-16 14:10:21 +01:00
Katie Smith
cc76e0ef19 Merge pull request #1183 from alphagov/pyup-update-apispec-0.14.0-to-0.25.0
Update apispec to 0.25.0
2017-08-16 14:09:42 +01:00
Imdad Ahad
fbe505a991 Merge pull request #1172 from alphagov/imdad-feat-get-billing-from-new-table
Populate and retrieve billing data from the new MonthlyBilling table
2017-08-16 12:35:12 +01:00
pyup-bot
050c94d7d4 Update apispec from 0.14.0 to 0.25.0 2017-08-16 04:45:35 +01:00
pyup-bot
e8a8f72551 Update coveralls from 1.1 to 1.2.0 2017-08-16 04:20:36 +01:00
Imdad Ahad
94605d31fa Change how we populate and retrieve MonthlyBilling totals:
1. For both email and sms, store [] in monthly_totals if
there is no billing data (no notifications sent etc.) and
return this via the API

2. General refactoring of indentation
2017-08-15 16:09:42 +01:00
Chris Hill-Scott
04e41e3147 Return template name in public API
The use for the public template API is for building caseworking systems
or similar, where you might need a list of templates to pick from (ie
instead of using the Notify web interface to pick from and send a
message).

Right now our API isn’t returning the template name as part of the
response. The name is a useful, human-friendly way of identifying a
template.

This commit changes the response to include the name.

Some clients will need updating before this can be useful.
2017-08-15 14:46:30 +01:00
Chris Hill-Scott
7879bc0e7e Merge pull request #1177 from alphagov/fix-migration-order
Fix order of DB migrations
2017-08-14 14:18:15 +01:00
Chris Hill-Scott
6f18415997 Fix order of DB migrations
More migrations got merged in between me making 0114 and merging the PR
that contained 0114.

If we named the files as just 0114.py then this would get flagged as a
merge conflict…
2017-08-14 13:54:18 +01:00
Chris Hill-Scott
eb43629576 Merge pull request #1171 from alphagov/ch-letter-logo
Add letter organisation for Companies House
2017-08-14 13:48:12 +01:00
Imdad Ahad
46ca086aa2 Update command to populate monthly billing data for email and sms 2017-08-11 16:57:18 +01:00
Imdad Ahad
69845e9f37 Add helper methods to retrieve billing data from the new table:
Get yearly and monthly billing data from the new table
with filter by notification type. Additionally let's calculate
current day delta totals
2017-08-11 16:57:18 +01:00
Imdad Ahad
35ad5d74f9 Retrieve billing data (for month) by notification type:
* Previously we were only returning SMS. Let's make this return for
a given notification type.
* General refactor of the monthly retrieval query
* Return an empty BillingData tuple if email billing data is empty
2017-08-11 16:57:18 +01:00
Imdad Ahad
839c161628 Update monthly billing for SMS and Email:
* Refactor code to update for EMAIL_TYPE and SMS_TYPE
* Make tests more robust (overlapping rates, multiple months, multiple noti
* types)
*
2017-08-11 16:57:18 +01:00
Imdad Ahad
ae76fd0f30 Small refactor to a test 2017-08-11 16:57:18 +01:00
Imdad Ahad
63e1167098 Make sure we update the correct month for billing:
When populating the monthly billing records on a schedule, we need
to ensure the correct month is being updated.

As an example, if the current datetime is 31 Mar 2016, 23:00. The
BST equivalent is the 1st April. Therefore we need to ensure we
update billing for April, not March. This takes care of that.
2017-08-11 16:57:17 +01:00
Imdad Ahad
782f3ea693 Rename method to get start and end date of a month for clarity 2017-08-11 16:56:47 +01:00
Imdad Ahad
19b09f2a27 Rename method to convert from utc to bst for consistency 2017-08-11 16:56:46 +01:00
kentsanggds
955ec60fe3 Merge pull request #1157 from alphagov/ken-add-inbound-number-model-dao
Add inbound number model and DAO
2017-08-11 15:17:47 +01:00
Rebecca Law
8658f691e7 Merge pull request #1173 from alphagov/turn-off-purge-dvla-resp-files
Stop purging the DVLA response files from S3
2017-08-11 13:40:20 +01:00
Ken Tsang
2b92c95c22 Update migration script 2017-08-11 13:25:09 +01:00
Ken Tsang
976be24cbc Refactor test 2017-08-11 12:56:59 +01:00
Ken Tsang
9a55e167f7 Refactored inbound_number dao 2017-08-11 12:56:59 +01:00
Ken Tsang
cfabab0785 Refactor code to add updated_at 2017-08-11 12:56:59 +01:00
Ken Tsang
2cfe85a2af Refactored inbound_number dao tests 2017-08-11 12:56:59 +01:00
Ken Tsang
e80bc9deb2 Refactor conftest 2017-08-11 12:56:59 +01:00
Ken Tsang
d101e262b5 Renamed migration scripts 2017-08-11 12:56:59 +01:00
Ken Tsang
668811197c Remove whitespace 2017-08-11 12:56:59 +01:00
Ken Tsang
c9f871c0c9 Refatored tests and fixtures for inbound_number 2017-08-11 12:56:59 +01:00
Ken Tsang
a127a6e871 Added active flag setting in inbound_number_dao 2017-08-11 12:56:59 +01:00
Ken Tsang
5e2d0bf5c6 Update test fixture to provide default provider 2017-08-11 12:56:59 +01:00
Ken Tsang
ffc2da2369 Update serialization for services 2017-08-11 12:56:59 +01:00
Ken Tsang
61c09f142c Refactored model and dao 2017-08-11 12:56:59 +01:00
Ken Tsang
3c392596a3 Add backref in InboundNumber model 2017-08-11 12:56:59 +01:00
Ken Tsang
4efb3238db Added test for allocating a service an inbound number twice 2017-08-11 12:56:59 +01:00
Ken Tsang
4de6060694 Add data models, dao for inbound_numbers 2017-08-11 12:56:59 +01:00
Imdad Ahad
d3e5f3a753 Merge pull request #1150 from alphagov/imdad-migration-remove-month-year-monthly-billing
Drop unused month and year columns from MonthlyBilling
2017-08-11 12:31:38 +01:00
Rebecca Law
4b33f7e987 Stop purging the DVLA response files from S3
We are not processing the data in these files yet so we need to stop deleting them until the data is recorded.
2017-08-11 12:00:20 +01:00
Imdad Ahad
dcecd21f82 Drop unused month and year columns from monthlybilling 2017-08-11 10:44:34 +01:00