Merge pull request #1387 from alphagov/fix-post-notification-response

Update the from number in the response of post notification.
This commit is contained in:
Rebecca Law
2017-11-10 15:12:16 +00:00
committed by GitHub
4 changed files with 5 additions and 4 deletions

View File

@@ -155,7 +155,7 @@ def check_service_sms_sender_id(service_id, sms_sender_id, notification_type):
message = 'sms_sender_id is not a valid option for {} notification'.format(notification_type)
raise BadRequestError(message=message)
try:
dao_get_service_sms_senders_by_id(service_id, sms_sender_id)
return dao_get_service_sms_senders_by_id(service_id, sms_sender_id).sms_sender
except NoResultFound:
message = 'sms_sender_id {} does not exist in database for service id {}'\
.format(sms_sender_id, service_id)

View File

@@ -71,7 +71,7 @@ def post_notification(notification_type):
check_rate_limiting(authenticated_service, api_user)
check_service_email_reply_to_id(str(authenticated_service.id), service_email_reply_to_id, notification_type)
check_service_sms_sender_id(str(authenticated_service.id), service_sms_sender_id, notification_type)
sms_sender = check_service_sms_sender_id(str(authenticated_service.id), service_sms_sender_id, notification_type)
template, template_with_content = validate_template(
form['template_id'],
@@ -98,7 +98,7 @@ def post_notification(notification_type):
if notification_type == SMS_TYPE:
create_resp_partial = functools.partial(
create_post_sms_response_from_notification,
from_number=authenticated_service.get_default_sms_sender()
from_number=sms_sender or authenticated_service.get_default_sms_sender()
)
elif notification_type == EMAIL_TYPE:
create_resp_partial = functools.partial(