mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 15:56:45 -04:00
Remove the template_postage parameter for persist_notification
It was confusing to have 2 differnt postage parameters.
This commit is contained in:
@@ -19,7 +19,6 @@ def create_letter_notification(
|
||||
notification = persist_notification(
|
||||
template_id=template.id,
|
||||
template_version=template.version,
|
||||
template_postage=template.postage,
|
||||
# we only accept addresses_with_underscores from the API (from CSV we also accept dashes, spaces etc)
|
||||
recipient=PostalAddress.from_personalisation(letter_data['personalisation']).normalised,
|
||||
service=service,
|
||||
@@ -34,9 +33,9 @@ def create_letter_notification(
|
||||
status=status,
|
||||
reply_to_text=reply_to_text,
|
||||
billable_units=billable_units,
|
||||
# letter_data.get('postage') is only set for precompiled letters
|
||||
# letter_data.get('postage') is only set for precompiled letters (if international it is set after sanitise)
|
||||
# letters from a template will pass in 'europe' or 'rest-of-world' if None then use postage from template
|
||||
postage=postage or letter_data.get('postage'),
|
||||
postage=postage or letter_data.get('postage') or template.postage,
|
||||
updated_at=updated_at
|
||||
)
|
||||
return notification
|
||||
|
||||
@@ -107,7 +107,6 @@ def persist_notification(
|
||||
reply_to_text=None,
|
||||
billable_units=None,
|
||||
postage=None,
|
||||
template_postage=None,
|
||||
document_download_count=None,
|
||||
updated_at=None
|
||||
):
|
||||
@@ -147,8 +146,8 @@ def persist_notification(
|
||||
elif notification_type == EMAIL_TYPE:
|
||||
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.postage = postage
|
||||
notification.international = postage in INTERNATIONAL_POSTAGE_TYPES
|
||||
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
|
||||
|
||||
@@ -120,7 +120,7 @@ def send_notification(notification_type):
|
||||
simulated = simulated_recipient(notification_form['to'], notification_type)
|
||||
notification_model = persist_notification(template_id=template.id,
|
||||
template_version=template.version,
|
||||
template_postage=template.postage,
|
||||
postage=template.postage,
|
||||
recipient=request.get_json()['to'],
|
||||
service=authenticated_service,
|
||||
personalisation=notification_form.get('personalisation', None),
|
||||
|
||||
Reference in New Issue
Block a user