Commit Graph

1704 Commits

Author SHA1 Message Date
Ken Tsang
3a70d63a7c Test for inbound_number when no inbound_sms permissions 2017-08-16 16:28:56 +01:00
Ken Tsang
902b28e00f Refactor to check active flag 2017-08-16 16:27:42 +01:00
Ken Tsang
fbe1a14304 Removed create_inbound_numberfrom fixture 2017-08-16 14:23:32 +01:00
Ken Tsang
c36423aac6 Refactor code for dao_fetch_servies_by_sms_sender to use inbound_numbers
This will need to be refactored after the deployment of api and admin and after the update script for existing services using inbound numbers has been executed.
2017-08-16 12:51:31 +01:00
Ken Tsang
667ee57a35 Refactor code to use inbound_numbers if set 2017-08-16 12:50:44 +01:00
Ken Tsang
e14fa2d87e Refactored to use service_id to set flag 2017-08-16 12:50:44 +01:00
Ken Tsang
7f1de19592 Refactored to put logic into API 2017-08-16 12:50:44 +01:00
Ken Tsang
22956b7427 Refactor code 2017-08-16 12:50:44 +01:00
Ken Tsang
d2a618cf0a Refactor set_inbound_number_for_service
As don't need the check for available inbound numbers
2017-08-16 12:50:44 +01:00
Ken Tsang
0c4c467cac Added extra tests after refactoring 2017-08-16 12:50:44 +01:00
Ken Tsang
c81b1aa6a0 Correct test for inbound_number 2017-08-16 12:50:44 +01:00
Ken Tsang
838401ebb3 Refactored endpoints 2017-08-16 12:50:44 +01:00
Ken Tsang
104fc93503 Refactor code 2017-08-16 12:50:44 +01:00
Ken Tsang
d5b91f9911 Fixed admin_request bug 2017-08-16 12:50:44 +01:00
Ken Tsang
468048797a Refactor conftest 2017-08-16 12:50:44 +01:00
Ken Tsang
6908ec4821 Add inbound_number rest and tests 2017-08-16 12:50:44 +01:00
Ken Tsang
47a1403591 Refactor code to add updated_at 2017-08-16 12:50:44 +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
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
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
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
5e2d0bf5c6 Update test fixture to provide default provider 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
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