Update 'api/blueprints/common/otp/timed_otp.py'

Update the password in case the client id is specified while verify otp
This commit is contained in:
Bhushan Thakkar
2025-03-24 09:03:19 +00:00
parent fafdea5d4e
commit e6cb3f2e24
+61 -20
View File
@@ -359,28 +359,69 @@ async def verify_otp(
if phone_no.startswith("254"): phone_no = phone_no[3:] if phone_no.startswith("254"): phone_no = phone_no[3:]
if phone_no.startswith("0"): phone_no = phone_no[1:] if phone_no.startswith("0"): phone_no = phone_no[1:]
phone_no = "+254" + phone_no phone_no = "+254" + phone_no
# if client id is not none then hit update the client add with notes else - add client with notes
# 24/03/2025 -client_id = inbound_data.id.get("idClient")
if client_id is not None: # hit Omkar's API:
api_response = await current_app.http_client.post(
url="https://api.thecaoffice.com/client/update/with/notes",
headers={"X-Session-Token": inbound_headers["X-Session-Token"]},
json={
"email": inbound_data.id.get("email"),
"clientName": inbound_data.id.get("clientName"),
"address": inbound_data.id.get("address"),
"phoneNo": inbound_data.id.get("phoneNo"),
"city": inbound_data.id.get("city"),
"pincode": inbound_data.id.get("pincode"),
"panCard": inbound_data.id.get("panCard"),
"gst": inbound_data.id.get("gst"),
"entity": inbound_data.id.get("entity"),
"country": inbound_data.id.get("country"),
"startDate": inbound_data.id.get("startDate"),
"period": inbound_data.id.get("period"),
"amount": inbound_data.id.get("amount"),
"idClient": inbound_data.id.get("idClient"),
"username": inbound_data.id.get("username"),
"password": inbound_data.id.get("password")
} )
else: # 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"]}, json = {
"email": inbound_data.email,
"clientName": inbound_data.username,
"address": None,
"phoneNo": phone_no,
"city": None,
"pincode": None,
"panCard": None,
"gst": None,
"entity": None,
"country": None,
"startDate": None,
"period": None,
"amount": None }
)
# hit Omkar's API: # 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"]},
json = { # json = {
"email": inbound_data.email, # "email": inbound_data.email,
"clientName": inbound_data.username, # "clientName": inbound_data.username,
"password": inbound_data.password, # "password": inbound_data.password,
"address": None, # "address": None,
"phoneNo": phone_no, # "phoneNo": phone_no,
"city": None, # "city": None,
"pincode": None, # "pincode": None,
"panCard": None, # "panCard": None,
"gst": None, # "gst": None,
"entity": None, # "entity": None,
"country": None, # "country": None,
"startDate": None, # "startDate": None,
"period": None, # "period": None,
"amount": None # "amount": None
} # }
) #)
# ┳┓ # ┳┓
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓ # ┣┫┏┓┏┏┓┏┓┏┓┏┏┓