(20250225) ohone no fml

This commit is contained in:
2025-02-25 14:25:14 +05:30
parent 7b5910d110
commit a1fde43976
+13 -1
View File
@@ -47,6 +47,7 @@ from shared import constants
# My utils: # My utils:
from utils_v2.string import json from utils_v2.string import json
from utils_v2.string import regex
from utils_v2.date_time import date_time from utils_v2.date_time import date_time
from utils_v2.security.otp import HashedOTP from utils_v2.security.otp import HashedOTP
from utils_v2.api.response import ResponseModel 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( api_response = await current_app.http_client.post(
url = "https://api.thecaoffice.com/client/add/with/notes", url = "https://api.thecaoffice.com/client/add/with/notes",
headers = {"X-Session-Token": inbound_headers["X-Session-Token"]}, headers = {"X-Session-Token": inbound_headers["X-Session-Token"]},
@@ -352,7 +364,7 @@ async def verify_otp(
"email": inbound_data.email, "email": inbound_data.email,
"clientName": inbound_data.username, "clientName": inbound_data.username,
"address": None, "address": None,
"phoneNo": inbound_data.phoneNo, "phoneNo": phone_no,
"city": None, "city": None,
"pincode": None, "pincode": None,
"panCard": None, "panCard": None,