Files
notifications-api/app/v2/notifications/create_response.py
Steven Reilly ff4190a8eb Remove letters-related code (#175)
This deletes a big ol' chunk of code related to letters. It's not everything—there are still a few things that might be tied to sms/email—but it's the the heart of letters function. SMS and email function should be untouched by this.

Areas affected:

- Things obviously about letters
- PDF tasks, used for precompiling letters
- Virus scanning, used for those PDFs
- FTP, used to send letters to the printer
- Postage stuff
2023-03-02 20:20:31 -05:00

57 lines
1.5 KiB
Python

def create_post_sms_response_from_notification(
notification_id, client_reference, template_id, template_version, service_id,
content, from_number, url_root
):
resp = __create_notification_response(
notification_id, client_reference, template_id, template_version, service_id, url_root
)
resp['content'] = {
'from_number': from_number,
'body': content
}
return resp
def create_post_email_response_from_notification(
notification_id,
client_reference,
template_id,
template_version,
service_id,
content,
subject,
email_from,
url_root,
):
resp = __create_notification_response(
notification_id, client_reference, template_id, template_version, service_id, url_root
)
resp['content'] = {
"from_email": email_from,
"body": content,
"subject": subject
}
return resp
def __create_notification_response(
notification_id, client_reference, template_id, template_version, service_id, url_root
):
return {
"id": notification_id,
"reference": client_reference,
"uri": "{}v2/notifications/{}".format(url_root, str(notification_id)),
'template': {
"id": template_id,
"version": template_version,
"uri": "{}services/{}/templates/{}".format(
url_root,
str(service_id),
str(template_id)
)
},
"scheduled_for": None
}