Add postage for send-one-off letters.

The postage is set to europe or rest-of-world for international letters, otherwise the template postage is used.

Also set international for letters.
This commit is contained in:
Rebecca Law
2020-07-29 14:52:18 +01:00
parent ed5e73d548
commit 10fe7d9fe8
11 changed files with 216 additions and 66 deletions

View File

@@ -27,7 +27,7 @@ from app.models import (
LETTER_TYPE,
NOTIFICATION_CREATED,
Notification,
)
INTERNATIONAL_POSTAGE_TYPES)
from app.dao.notifications_dao import (
dao_create_notification,
dao_delete_notifications_by_id,
@@ -148,6 +148,7 @@ def persist_notification(
notification.normalised_to = format_email_address(notification.to)
elif notification_type == LETTER_TYPE:
notification.postage = postage or template_postage
notification.international = True if postage in INTERNATIONAL_POSTAGE_TYPES else False
notification.normalised_to = ''.join(notification.to.split()).lower()
# if simulated create a Notification model to return but do not persist the Notification to the dB