Save recipient address in the "to" field of a notification

When a precompiled letter is sent via the admin app, we now pass in the address which can be set in the Notifications.to field.
Once a precompiled letters sent by the API has passed validation we can set the address in Notifications.to field.

The celery tasks to validate precompiled letters sent by the API will be done in another PR.
This commit is contained in:
Rebecca Law
2020-01-02 16:35:18 +00:00
parent 5ebd9a473c
commit bb2b514e12
6 changed files with 29 additions and 15 deletions

View File

@@ -75,8 +75,10 @@ def post_precompiled_letter_notification():
template = get_precompiled_letter_template(authenticated_service.id)
# For precompiled letters the to field will be set to Provided as PDF until the validation passes,
# then the address of the letter will be set as the to field
form['personalisation'] = {
'address_line_1': form['reference']
'address_line_1': 'Provided as PDF'
}
reply_to = get_reply_to_text(LETTER_TYPE, form, template)