(20250225) fml

This commit is contained in:
2025-02-25 13:29:21 +05:30
parent 34d606b72d
commit babc1f9123
+37 -3
View File
@@ -220,6 +220,7 @@ async def generate_otp(
seconds = inbound_data.seconds seconds = inbound_data.seconds
) )
) )
print("OTP RESPONSE:", otp_response)
# If the OTP generation failed: # If the OTP generation failed:
if not otp_response.success: return ResponseModel( if not otp_response.success: return ResponseModel(
@@ -329,16 +330,49 @@ async def verify_otp(
) )
) )
# If the OTP failed:
if not otp_response.success: return ResponseModel(
status_code = StatusCodes.FAILED,
http_code = HttpCodes.UNAUTHORIZED,
message = otp_response.message
)
# ┏┓ ┓ ┓ ┏┓┓• ┓ ┏• ┓ ┳┓
# ┣┫┏┫┏┫ ┃ ┃┓┏┓┏┓╋ ┃┃┃┓╋┣┓ ┃┃┏┓╋┏┓┏
# ┛┗┗┻┗┻ ┗┛┗┗┗ ┛┗┗ ┗┻┛┗┗┛┗ ┛┗┗┛┗┗ ┛
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": inbound_data.phoneNo,
"city": None,
"pincode": None,
"panCard": None,
"gst": None,
"entity": None,
"country": None,
"startDate": None,
"period": None,
"amount": None
}
)
api_json = api_response.json()
print("ADD CLIENT WITH NOTES:", json.to_string(api_json))
# ┳┓ # ┳┓
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓ # ┣┫┏┓┏┏┓┏┓┏┓┏┏┓
# ┛┗┗ ┛┣┛┗┛┛┗┛┗ # ┛┗┗ ┛┣┛┗┛┛┗┛┗
# ┛ # ┛
# Done here: # Done here:
success = api_response.is_success
return ResponseModel( return ResponseModel(
status_code = StatusCodes.OK if otp_response.success else StatusCodes.FAILED, status_code = StatusCodes.OK if success else StatusCodes.FAILED,
http_code = HttpCodes.SUCCESS if otp_response.success else HttpCodes.UNAUTHORIZED, http_code = HttpCodes.SUCCESS if success else HttpCodes.UNAUTHORIZED
message = otp_response.message
) )