Commit Graph

573 Commits

Author SHA1 Message Date
kentsanggds
549601a6df Merge pull request #1200 from alphagov/ken-refactor-inbound_numbers
Refactor inbound numbers
2017-08-25 13:27:16 +01:00
Rebecca Law
d4422dd35f Added a proper error response if the notification type is not supported. 2017-08-23 14:56:03 +01:00
Ken Tsang
d99ab329eb Refactored code to use inbound_number.number
- Removed filter on sms_sender for `dao_fetch_services_by_inbound_number`
2017-08-23 14:14:32 +01:00
Ken Tsang
667ee57a35 Refactor code to use inbound_numbers if set 2017-08-16 12:50:44 +01:00
Leo Hemsted
13917c9c57 give test letter api notifications a different filename
so they can be distinguished on the frontend.

Also, some related cleanup:

* don't show test api letters on the frontpage
* make sure the subject is returned from the API for letters
* make sure the letter's address is returned for letters
2017-08-01 18:23:29 +01:00
Leo Hemsted
2ab105aaf4 add tests for letter api notifications 2017-07-27 16:43:55 +01:00
Leo Hemsted
2746bf0318 process letters from api traffic
there are three steps to this

1. Create a job
  * Starts in status 'ready to send'
  * Created by None, since it's from the API
  * original file name 'letter submitted via api'
2. Create a single notification for that job
  * job_row_number 0
  * client reference if provided
  * address line 1 as recipient
3. Trigger the build_dvla_file task
  we know that all the notifications have been created for this job
  (since we just created them ourselves synchronously), so this will
  just create the dvla-format file for the job, and upload it to s3.
2017-07-27 11:12:09 +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
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
0e3d84c91c Merge pull request #1084 from alphagov/add-logging-to-sms-drs
Add logging to SMS delivery receipts
2017-07-21 12:29:45 +01:00
Leo Hemsted
cfbf7ba2d1 Merge pull request #1092 from alphagov/old-queue-split
[1/3] add separate send-sms and send-email queues
2017-07-21 11:31:48 +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
4d33040653 add separate send-sms and send-email queues
we're reading from those two queues as well as teh existing send queue,
however for now we don't send anything to them
2017-07-20 16:19:38 +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
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
301339e689 Merge branch 'master' into add-logging-to-sms-drs 2017-07-19 14:30:51 +01:00
Rebecca Law
49d1f52aef Fix code style 2017-07-12 15:49:43 +01:00
Rebecca Law
d18ce47114 Make sure we don't log the phone number 2017-07-12 15:32:59 +01:00
Rebecca Law
6fb4e16067 Added logging to show the entire form posted to us by the SMS client providers.
This can be useful information when debugging what happened to a notificaiton.
Recently there was a discrepancy between the failure type used by each provider for a particular number, this logging would have helped.
2017-07-12 14:19:39 +01:00
Leo Hemsted
1a03248317 temp fix to sort out circular imports 2017-07-12 13:02:19 +01:00
Martyn Inglis
786adb5d71 Move Queuenames in with the celery code, revamp config to allow move to celery 4.x 2017-07-12 12:01:52 +01:00
Ken Tsang
8b04039a5a Refactor to abstract inbound_sms perms check 2017-07-06 12:31:02 +01:00
Ken Tsang
e96a67c59b Firetext tests 2017-07-06 12:31:01 +01:00
Ken Tsang
5a82fe0a70 Add inbound sms permission check 2017-07-06 12:31:01 +01:00
Ken Tsang
72000c38aa Refactor to abstract out post notification errors 2017-07-06 12:27:58 +01:00
Ken Tsang
23618a186c Further refactoring 2017-07-06 12:27:57 +01:00
Ken Tsang
0b3277b8a4 Refactored to make code clearer 2017-07-06 12:27:57 +01:00
Ken Tsang
e0fbcb0dc6 Add permission check in for v2 post notification 2017-07-06 12:27:57 +01:00
Ken Tsang
46a55c1cdb Refactor code 2017-07-06 12:27:57 +01:00
Ken Tsang
542bbb2f34 Refactor code 2017-07-06 12:27:56 +01:00
Ken Tsang
815f4d0a81 Removed prints 2017-07-06 12:27:56 +01:00
Ken Tsang
c1caa4a5da Add tests for when email / sms disabled 2017-07-06 12:27:56 +01:00
Ken Tsang
b04d01ba27 Refactored code to use new service permissions only 2017-07-06 12:27:55 +01:00
Ken Tsang
98cd838510 ken-use-only-new-service-permissions 2017-07-06 12:27:55 +01:00
venusbb
2d8048654c deleted last check 2017-06-29 11:11:08 +01:00
venusbb
16571c5b3c IP restriction for inbound sms test 2 2017-06-29 10:47:27 +01:00
Venus Bailey
73e0432a69 Merge pull request #1047 from alphagov/inboundsms_checkip
add logs to see the IP address of the inbound sms
2017-06-26 16:47:40 +01:00
venusbb
c5cb70210e add logs to see the IP address of the inbound sms 2017-06-26 16:15:58 +01:00
Leo Hemsted
350133e6db ensure created_by_id is being persisted correctly
(also make sure it's well tested 🎉 )
2017-06-23 15:56:47 +01:00
Rebecca Law
e0d23f40f6 Merge pull request #1038 from alphagov/push-inbound-sms
Push inbound sms
2017-06-21 15:49:32 +01:00
Rebecca Law
6559da3239 Updates as per review comments 2017-06-21 15:29:55 +01:00
Rebecca Law
c608f5997b New task to send the inbound sms to the service.
If the service has not set the url then nothing happens.
If the request to the service url returns with 500 or greater the task is retries.
The task is created when the SMS provider post the inbound SMS.
2017-06-20 17:13:40 +01:00
Leo Hemsted
ac7665bfc6 celery test cleanup
* Alter config so an error will be raised if you forget to mock out a
  celery call in one of your tests
* Remove an unneeded exception type that was masking errors
2017-06-20 12:06:49 +01:00
Leo Hemsted
a1e570dea7 persist created_by_id when using the one off notification endpoint 2017-06-20 12:06:49 +01:00
Leo Hemsted
10b851b456 add send_notification file for handling sending one off messages
currently, they're made by creating a one-line job, but we want to
reduce task/csv file noise so we're moving them to persist in the
same vein as API usage. However, we can't just call through to that
since there are some differences:

* no api keys
* tighter control over API format
* no scheduling
* no client references

etc.

So, re-using as much of the v2 validation stuff as possible, I've
created this file that just does basic validation, and then calls
through to persist_notification and schedules a task. Woo.
2017-06-20 11:51:36 +01:00
Imdad Ahad
dfeda93bc5 Merge pull request #1015 from alphagov/imdad-feat-return-content-outbound
Return notification content for outbound messages
2017-06-13 12:27:16 +01:00
Martyn Inglis
29455b6d3b Strip leading 44 from inbound SMS numbers to normalise to how we store things. 2017-06-06 11:50:30 +01:00
Imdad Ahad
3177a6ddc4 Return personalisation dump of notifications + small refactor 2017-06-05 15:54:40 +01:00
Martyn Inglis
b296e736f2 Reorder the migrations. 2017-06-05 11:51:30 +01:00