mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Set postage on basis of postage argument or template postage
This commit is contained in:
@@ -23,8 +23,7 @@ from app.models import (
|
||||
LETTER_TYPE,
|
||||
NOTIFICATION_CREATED,
|
||||
Notification,
|
||||
ScheduledNotification,
|
||||
CHOOSE_POSTAGE
|
||||
ScheduledNotification
|
||||
)
|
||||
from app.dao.notifications_dao import (
|
||||
dao_create_notification,
|
||||
@@ -108,13 +107,7 @@ def persist_notification(
|
||||
elif notification_type == EMAIL_TYPE:
|
||||
notification.normalised_to = format_email_address(notification.to)
|
||||
elif notification_type == LETTER_TYPE:
|
||||
if postage:
|
||||
notification.postage = postage
|
||||
else:
|
||||
if service.has_permission(CHOOSE_POSTAGE) and template_postage:
|
||||
notification.postage = template_postage
|
||||
else:
|
||||
notification.postage = service.postage
|
||||
notification.postage = postage or template_postage
|
||||
|
||||
# if simulated create a Notification model to return but do not persist the Notification to the dB
|
||||
if not simulated:
|
||||
|
||||
@@ -28,6 +28,7 @@ from app.models import (
|
||||
NOTIFICATION_SENDING,
|
||||
NOTIFICATION_DELIVERED,
|
||||
NOTIFICATION_PENDING_VIRUS_CHECK,
|
||||
SECOND_CLASS
|
||||
)
|
||||
from app.notifications.process_letter_notifications import (
|
||||
create_letter_notification
|
||||
@@ -355,6 +356,7 @@ def get_precompiled_letter_template(service_id):
|
||||
hidden=True,
|
||||
subject='Pre-compiled PDF',
|
||||
content='',
|
||||
postage=SECOND_CLASS
|
||||
)
|
||||
|
||||
dao_create_template(template)
|
||||
|
||||
Reference in New Issue
Block a user