ensure we're passing through api keys and key types from notifications

when we made the change to async persist notifications, we forgot to
pass through api_key_id and key_type. in send_sms/email, for legacy
reasons, they default to None/KEY_TYPE_NORMAL, so regardless of what
your api key was set up as, we would send real messages!

TODO: Once the PaaS transition is complete and the task changes are
reverted, remove the api_key_id and key_type params from the send_*
tasks entirely, as those are only called from the csv job flow, and
don't need them
This commit is contained in:
Leo Hemsted
2017-03-28 13:14:46 +01:00
parent d5f8b4d80b
commit 25d1777937
4 changed files with 85 additions and 20 deletions

View File

@@ -124,7 +124,14 @@ def process_row(row_number, recipient, personalisation, template, job, service):
def send_notification_to_persist_queue(
notification_id, service, template_type, encrypted, priority=False, research_mode=False
notification_id,
service,
template_type,
encrypted,
api_key_id,
key_type,
priority=False,
research_mode=False
):
queues = {
SMS_TYPE: 'db-sms',
@@ -150,8 +157,12 @@ def send_notification_to_persist_queue(
str(service.id),
notification_id,
encrypted,
datetime.utcnow().strftime(DATETIME_FORMAT)
datetime.utcnow().strftime(DATETIME_FORMAT),
),
kwargs={
'api_key_id': api_key_id,
'key_type': key_type
},
queue=queue_name
)