Set reply_to_text for letter notifications posted to /notifications/letter

This commit is contained in:
Rebecca Law
2017-11-24 16:17:25 +00:00
parent e0d0b2f4fd
commit d779751bae
4 changed files with 29 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ from app.models import LETTER_TYPE
from app.notifications.process_notifications import persist_notification
def create_letter_notification(letter_data, template, api_key, status):
def create_letter_notification(letter_data, template, api_key, status, reply_to_text=None):
notification = persist_notification(
template_id=template.id,
template_version=template.version,
@@ -18,6 +18,7 @@ def create_letter_notification(letter_data, template, api_key, status):
job_row_number=None,
reference=create_random_identifier(),
client_reference=letter_data.get('reference'),
status=status
status=status,
reply_to_text=reply_to_text
)
return notification

View File

@@ -183,8 +183,12 @@ def process_letter_notification(*, letter_data, api_key, template):
# if we don't want to actually send the letter, then start it off in SENDING so we don't pick it up
status = NOTIFICATION_CREATED if should_send else NOTIFICATION_SENDING
notification = create_letter_notification(letter_data, template, api_key, status=status)
letter_contact_block = api_key.service.get_default_letter_contact()
notification = create_letter_notification(letter_data=letter_data,
template=template,
api_key=api_key,
status=status,
reply_to_text=letter_contact_block)
if not should_send:
update_letter_notifications_to_sent_to_dvla.apply_async(