Call the create letters pdf task in api calls for services with letters as pdf

This commit is contained in:
Ken Tsang
2017-12-11 16:23:09 +00:00
parent f42df8af73
commit ab72d6f555
2 changed files with 32 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ from app.models import (
NOTIFICATION_CREATED,
NOTIFICATION_SENDING
)
from app.celery.letters_pdf_tasks import create_letters_pdf
from app.celery.tasks import update_letter_notifications_to_sent_to_dvla
from app.notifications.process_notifications import (
persist_notification,
@@ -187,6 +188,12 @@ def process_letter_notification(*, letter_data, api_key, template):
queue=QueueNames.RESEARCH_MODE
)
if api_key.service.has_permission('letters_as_pdf'):
create_letters_pdf.apply_async(
[str(notification.id)],
queue=QueueNames.CREATE_LETTERS_PDF
)
return notification