This commit is contained in:
Kenneth Kehl
2024-08-19 12:53:18 -07:00
parent 9182ba0323
commit 7b1942c3fe
3 changed files with 30 additions and 12 deletions

View File

@@ -80,21 +80,36 @@ def send_sms_to_provider(notification):
# We start by trying to get the phone number from a job in s3. If we fail, we assume
# the phone number is for the verification code on login, which is not a job.
print(f"IN THE TRY AND JOB_ID is {notification.job_id}")
recipient = None
try:
recipient = get_phone_number_from_s3(
notification.service_id,
notification.job_id,
notification.job_row_number,
)
except Exception:
# It is our 2facode, maybe
# It is our 2facode, maybe
if notification.job_id is None:
print(f"IN THE IF AND WE ARE GOING TO GET THE 2FA KEY")
key = f"2facode-{notification.id}".replace(" ", "")
print(hilite(f"KEY IS SEND_TO_PROVIDERS IS {key}"))
recipient = redis_store.get(key)
if recipient:
recipient = recipient.decode("utf-8")
print(hilite(f"RECIPIENT IN SEND TO PROVIDERS IS {recipient}"))
else:
print(f"IN THE ELSE AND WE ARE GOING TO GET FROM S3")
try:
recipient = get_phone_number_from_s3(
notification.service_id,
notification.job_id,
notification.job_row_number,
)
except Exception:
# It is our 2facode, maybe
key = f"2facode-{notification.id}".replace(" ", "")
print(hilite(f"KEY IS SEND_TO_PROVIDERS IS {key}"))
recipient = redis_store.get(key)
print(hilite(f"RECIPIENT IN SEND TO PROVIDERS IS {recipient}"))
if recipient:
recipient = recipient.decode("utf-8")
if recipient is None:
si = notification.service_id
ji = notification.job_id