add postage to notification + noti_history

if it's a letter notification, postage must equal "first" or "second",
else it must equal null
This commit is contained in:
Leo Hemsted
2018-09-19 10:49:11 +01:00
parent 645da3f33d
commit 918e4b390f
6 changed files with 62 additions and 25 deletions

View File

@@ -178,7 +178,8 @@ def create_notification(
one_off=False,
sms_sender_id=None,
reply_to_text=None,
created_by_id=None
created_by_id=None,
postage=None
):
if created_at is None:
created_at = datetime.utcnow()
@@ -196,6 +197,9 @@ def create_notification(
if not api_key:
api_key = create_api_key(template.service, key_type=key_type)
if template.template_type == 'letter' and postage is None:
postage = 'second'
data = {
'id': uuid.uuid4(),
'to': to_field,
@@ -224,7 +228,8 @@ def create_notification(
'phone_prefix': phone_prefix,
'normalised_to': normalised_to,
'reply_to_text': reply_to_text,
'created_by_id': created_by_id
'created_by_id': created_by_id,
'postage': postage
}
notification = Notification(**data)
dao_create_notification(notification)