Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -68,15 +68,12 @@ async def book_ticket(request: Request):
|
|
68 |
"message": f"Ticket booked for '{movie_name}'. Username: {username}, Time: {time}, Price: {price}"
|
69 |
}
|
70 |
|
71 |
-
class AgentActionContent(BaseModel):
|
72 |
-
email: str = None
|
73 |
-
from_number: str = None
|
74 |
-
to_number: str
|
75 |
-
|
76 |
|
77 |
class AgentAction(BaseModel):
|
78 |
name: str
|
79 |
-
|
|
|
|
|
80 |
|
81 |
class Payload(BaseModel):
|
82 |
agent_action_id: int
|
@@ -86,19 +83,19 @@ class Payload(BaseModel):
|
|
86 |
async def generate_otp(payload: Payload, token: str = Depends(verify_token)):
|
87 |
otp = random.randint(10000, 99999)
|
88 |
|
89 |
-
if payload.agent_action.
|
90 |
-
print(f"[AMSService][generate_otp] Generating OTP for email: {payload.agent_action.
|
91 |
result = {
|
92 |
"status": "success",
|
93 |
"verification_code": otp,
|
94 |
-
"message": f"OTP generated for email: {payload.agent_action.
|
95 |
}
|
96 |
else:
|
97 |
-
print(f"[AMSService][generate_otp] Generating OTP for phone number: {payload.agent_action.
|
98 |
result = {
|
99 |
"status": "success",
|
100 |
"verification_code": otp,
|
101 |
-
"message": f"OTP generated for phone number: {payload.agent_action.
|
102 |
}
|
103 |
|
104 |
return result
|
|
|
68 |
"message": f"Ticket booked for '{movie_name}'. Username: {username}, Time: {time}, Price: {price}"
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
class AgentAction(BaseModel):
|
73 |
name: str
|
74 |
+
email: str = None
|
75 |
+
from_number: str = None
|
76 |
+
to_number: str = None
|
77 |
|
78 |
class Payload(BaseModel):
|
79 |
agent_action_id: int
|
|
|
83 |
async def generate_otp(payload: Payload, token: str = Depends(verify_token)):
|
84 |
otp = random.randint(10000, 99999)
|
85 |
|
86 |
+
if payload.agent_action.from_number is None:
|
87 |
+
print(f"[AMSService][generate_otp] Generating OTP for email: {payload.agent_action.email}")
|
88 |
result = {
|
89 |
"status": "success",
|
90 |
"verification_code": otp,
|
91 |
+
"message": f"OTP generated for email: {payload.agent_action.email}"
|
92 |
}
|
93 |
else:
|
94 |
+
print(f"[AMSService][generate_otp] Generating OTP for phone number: {payload.agent_action.from_number}")
|
95 |
result = {
|
96 |
"status": "success",
|
97 |
"verification_code": otp,
|
98 |
+
"message": f"OTP generated for phone number: {payload.agent_action.from_number}"
|
99 |
}
|
100 |
|
101 |
return result
|