Added the mechanism to differentiate between signup and reset requests.

This commit is contained in:
2025-04-07 16:26:12 +05:30
parent 8cc656c929
commit aad9d664cd
3 changed files with 65 additions and 23 deletions
+49 -22
View File
@@ -359,29 +359,56 @@ async def verify_otp(
if phone_no.startswith("254"): phone_no = phone_no[3:]
if phone_no.startswith("0"): phone_no = phone_no[1:]
phone_no = "+254" + 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"]},
json = {
"email": inbound_data.email,
"clientName": inbound_data.username,
"password": inbound_data.password,
"address": None,
"phoneNo": phone_no,
"city": None,
"pincode": None,
"panCard": None,
"gst": None,
"entity": None,
"country": None,
"startDate": None,
"period": None,
"amount": None
}
)
# Do this when the user is trying a new sign-up:
# Hit Omkar's API:
if inbound_data.isSignup:
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,
"password": inbound_data.password,
"address": None,
"phoneNo": phone_no,
"city": None,
"pincode": None,
"panCard": None,
"gst": None,
"entity": None,
"country": None,
"startDate": None,
"period": None,
"amount": None
}
)
# When this is not a new sign-up. it is a password reset request:
# Hit Omkar's API:
else:
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 = {
"idClient": inbound_data.idClient,
"email": inbound_data.email,
"clientName": inbound_data.clientName,
"username": inbound_data.username,
"password": inbound_data.password,
"address": inbound_data.address,
"phoneNo": phone_no,
"city": inbound_data.city,
"pincode": inbound_data.pincode,
"panCard": inbound_data.panCard,
"gst": inbound_data.gst,
"entity": inbound_data.entity,
"country": inbound_data.country,
"startDate": inbound_data.startDate,
"period": inbound_data.period,
"amount": inbound_data.amount
}
)
# ┳┓
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓
+15
View File
@@ -189,11 +189,26 @@ class VerifyTimedOTPRequestData(BaseModel):
id: str | Dict | List
otp: str
isSignup: bool
username: str
password: str
email: EmailStr
phoneNo: str
idClient: int | None = Field(default = None)
clientName: str | None = Field(default = None)
address: str | None = Field(default = None)
city: str | None = Field(default = None)
pincode: str | None = Field(default = None)
country: str | None = Field(default = None)
panCard: str | None = Field(default = None)
gst: str | None = Field(default = None)
entity: str | None = Field(default = None)
startDate: str | None = Field(default = None)
period: str | None = Field(default = None)
amount: float | int | None = Field(default = None)
class Config:
extra = "forbid"
+1 -1
View File
@@ -18,7 +18,7 @@ echo "Files added."
# Make the commit:
git commit -m "$COMMENT"
echo "Commit done."
echo "Commit done."get
# Push th commit to git:
git push -u https://wtt.ditscentre.in/ditscentre/api_utils_converse_v2.git "$BRANCH"