Added the mechanism to differentiate between signup and reset requests.
This commit is contained in:
@@ -360,28 +360,55 @@ async def verify_otp(
|
|||||||
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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# hit Omkar's API:
|
# When this is not a new sign-up. it is a password reset request:
|
||||||
api_response = await current_app.http_client.post(
|
# Hit Omkar's API:
|
||||||
url = "https://api.thecaoffice.com/client/add/with/notes",
|
else:
|
||||||
headers = {"X-Session-Token": inbound_headers["X-Session-Token"]},
|
api_response = await current_app.http_client.post(
|
||||||
json = {
|
url = "https://api.thecaoffice.com/client/update/with/notes",
|
||||||
"email": inbound_data.email,
|
headers = {"X-Session-Token": inbound_headers["X-Session-Token"]},
|
||||||
"clientName": inbound_data.username,
|
json = {
|
||||||
"password": inbound_data.password,
|
"idClient": inbound_data.idClient,
|
||||||
"address": None,
|
"email": inbound_data.email,
|
||||||
"phoneNo": phone_no,
|
"clientName": inbound_data.clientName,
|
||||||
"city": None,
|
"username": inbound_data.username,
|
||||||
"pincode": None,
|
"password": inbound_data.password,
|
||||||
"panCard": None,
|
"address": inbound_data.address,
|
||||||
"gst": None,
|
"phoneNo": phone_no,
|
||||||
"entity": None,
|
"city": inbound_data.city,
|
||||||
"country": None,
|
"pincode": inbound_data.pincode,
|
||||||
"startDate": None,
|
"panCard": inbound_data.panCard,
|
||||||
"period": None,
|
"gst": inbound_data.gst,
|
||||||
"amount": None
|
"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
|
id: str | Dict | List
|
||||||
otp: str
|
otp: str
|
||||||
|
isSignup: bool
|
||||||
|
|
||||||
username: str
|
username: str
|
||||||
password: str
|
password: str
|
||||||
email: EmailStr
|
email: EmailStr
|
||||||
phoneNo: str
|
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:
|
class Config:
|
||||||
extra = "forbid"
|
extra = "forbid"
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ echo "Files added."
|
|||||||
|
|
||||||
# Make the commit:
|
# Make the commit:
|
||||||
git commit -m "$COMMENT"
|
git commit -m "$COMMENT"
|
||||||
echo "Commit done."
|
echo "Commit done."get
|
||||||
|
|
||||||
# Push th commit to git:
|
# Push th commit to git:
|
||||||
git push -u https://wtt.ditscentre.in/ditscentre/api_utils_converse_v2.git "$BRANCH"
|
git push -u https://wtt.ditscentre.in/ditscentre/api_utils_converse_v2.git "$BRANCH"
|
||||||
|
|||||||
Reference in New Issue
Block a user