Check service is not in trial mode for uploaded letters

This adds an api check that the service is not in trial mode when
someone tries to send an uploaded letter.
This commit is contained in:
Katie Smith
2019-10-22 09:13:01 +01:00
parent 35602b96fc
commit 9b8e0ed856
2 changed files with 21 additions and 0 deletions

View File

@@ -140,6 +140,13 @@ def send_pdf_letter_notification(service_id, post_data):
check_service_has_permission(UPLOAD_LETTERS, service.permissions)
check_service_over_daily_message_limit(KEY_TYPE_NORMAL, service)
validate_created_by(service, post_data['created_by'])
validate_and_format_recipient(
send_to=post_data['filename'],
key_type=KEY_TYPE_NORMAL,
service=service,
notification_type=LETTER_TYPE,
allow_whitelisted_recipients=False,
)
template = get_precompiled_letter_template(service.id)
file_location = 'service-{}/{}.pdf'.format(service.id, post_data['file_id'])