Fix the from number in the post_sms_response. If the service.sms_sender is not set the FROM_NUMBER from the config is returned, which is the default for the notification.

This commit is contained in:
Rebecca Law
2016-12-12 15:07:03 +00:00
parent 32a21bfd3a
commit 9973d74d09
3 changed files with 6 additions and 5 deletions

View File

@@ -148,7 +148,7 @@ sms_content = {
"body": {"type": "string"},
"from_number": {"type": "string"}
},
"required": ["body"]
"required": ["body", "from_number"]
}
post_sms_response = {

View File

@@ -1,4 +1,4 @@
from flask import request, jsonify
from flask import request, jsonify, current_app
from sqlalchemy.orm.exc import NoResultFound
from app import api_user
@@ -40,10 +40,10 @@ def post_sms_notification():
key_type=api_user.key_type,
reference=form.get('reference'))
send_notification_to_queue(notification, service.research_mode)
sms_sender = service.sms_sender if service.sms_sender else current_app.config.get('FROM_NUMBER')
resp = create_post_sms_response_from_notification(notification,
template_with_content.rendered,
service.sms_sender,
sms_sender,
request.url_root)
return jsonify(resp), 201