block one-off sms with long content counts

This commit is contained in:
Leo Hemsted
2017-06-15 13:40:38 +01:00
parent 10b851b456
commit 729faf579d
4 changed files with 203 additions and 6 deletions

View File

@@ -595,6 +595,6 @@ def handle_sql_errror(e):
@service_blueprint.route('/<uuid:service_id>/send-notification', methods=['POST'])
def post_notification(service_id):
def create_one_off_notification(service_id):
resp = send_one_off_notification(service_id, request.get_json())
return jsonify(resp), 201

View File

@@ -1,8 +1,8 @@
from app.config import QueueNames
from app.notifications.validators import (
check_service_over_daily_message_limit,
check_sms_content_char_count,
validate_and_format_recipient,
validate_template,
)
from app.notifications.process_notifications import (
create_content_for_notification,
@@ -27,9 +27,7 @@ def send_one_off_notification(service_id, post_data):
personalisation = post_data.get('personalisation', None)
if template.template_type == SMS_TYPE:
template_with_content = create_content_for_notification(template, personalisation)
check_sms_content_char_count(template_with_content.content_count)
validate_template(template.id, personalisation, service, template.template_type)
check_service_over_daily_message_limit(KEY_TYPE_NORMAL, service)