Spaces:
Sleeping
Sleeping
updated get otp to support login and register, implemented protected apis and other improvements
1a3a466 | from pydantic import BaseModel, EmailStr, Field | |
| from typing import Optional, Literal | |
| from datetime import datetime | |
| class MerchantRegister(BaseModel): | |
| """ | |
| Pydantic model for Merchant registration request payload. | |
| """ | |
| merchant_name: str = Field(..., description="The name of the Merchant") | |
| merchant_id: Optional[str] = None #The unique identifier for the Merchant | |
| country: str = Field(..., description="The country where the Merchant is located") | |
| city: str = Field(..., description="The city where the Merchant is located") | |
| area: str = Field(..., description="The area where the Merchant is located") | |
| email: EmailStr = Field(..., description="The email address of the customer") | |
| mobile: str = Field(..., description="The 10-digit mobile number of the customer") | |
| status: Optional[str] = Field("pending-verification", description="The status of the customer account") | |
| email_ver_code: Optional[str] = None #(..., description="The email verification code") | |
| mobile_ver_code: Optional[str] = None #(..., description="The mobile verification code") | |
| created_at: Optional[datetime] = Field(default_factory=datetime.now, description="The timestamp when the customer was created") | |
| class LoginOtpRequest(BaseModel): | |
| identifier: str = Field(..., description="Email or Mobile number") | |
| class RefreshTokenRequest(BaseModel): | |
| identifier: str = Field(..., description="Email or Mobile number") | |
| refresh_token: str = Field(..., description="Refresh token") | |
| class GetOtpRequest(BaseModel): | |
| identifier: str = Field(..., description="The email or mobile number to retrieve the OTP for") | |
| type: Literal["register", "login"] = Field(..., description="The type of OTP (register or login)") | |
| class MerchantDetailsResponse(BaseModel): | |
| merchant_id: str | |
| merchant_name: str | |
| mobile: str | |
| email: EmailStr | |
| country: str |