diff --git a/api/blueprints/common/otp/timed_otp.py b/api/blueprints/common/otp/timed_otp.py index 8c3f9c0..a45b525 100644 --- a/api/blueprints/common/otp/timed_otp.py +++ b/api/blueprints/common/otp/timed_otp.py @@ -47,6 +47,7 @@ from shared import constants # My utils: from utils_v2.string import json +from utils_v2.string import regex from utils_v2.date_time import date_time from utils_v2.security.otp import HashedOTP from utils_v2.api.response import ResponseModel @@ -345,6 +346,17 @@ async def verify_otp( # ┣┫┏┫┏┫ ┃ ┃┓┏┓┏┓╋ ┃┃┃┓╋┣┓ ┃┃┏┓╋┏┓┏ # ┛┗┗┻┗┻ ┗┛┗┗┗ ┛┗┗ ┗┻┛┗┗┛┗ ┛┗┗┛┗┗ ┛ + # Fix the phone no. to have the country code: + phone_no = regex.replace( + text = inbound_data.phoneNo, + pattern = r"[^\d]", + substitute_text = "" + ) + if not phone_no.startswith("254"): phone_no = "254" + phone_no + phone_no = "+" + phone_no + print("CLEANED PHONE NO:", phone_no) + + # hit Omkar's API: api_response = await current_app.http_client.post( url = "https://api.thecaoffice.com/client/add/with/notes", headers = {"X-Session-Token": inbound_headers["X-Session-Token"]}, @@ -352,7 +364,7 @@ async def verify_otp( "email": inbound_data.email, "clientName": inbound_data.username, "address": None, - "phoneNo": inbound_data.phoneNo, + "phoneNo": phone_no, "city": None, "pincode": None, "panCard": None,