Added the mechanism to differentiate between signup and reset requests.
This commit is contained in:
@@ -360,8 +360,9 @@ async def verify_otp(
|
||||
if phone_no.startswith("0"): phone_no = phone_no[1:]
|
||||
phone_no = "+254" + phone_no
|
||||
|
||||
|
||||
# hit Omkar's API:
|
||||
# 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"]},
|
||||
@@ -383,6 +384,32 @@ async def verify_otp(
|
||||
}
|
||||
)
|
||||
|
||||
# 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
|
||||
}
|
||||
)
|
||||
|
||||
# ┳┓
|
||||
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓
|
||||
# ┛┗┗ ┛┣┛┗┛┛┗┛┗
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user