(20250811) - Added RazorPay Integration class with auth api and requires validations and many more.

This commit is contained in:
yatmesh
2025-08-11 14:19:24 +05:30
parent 1732e12adf
commit ddc29a7fe1
9 changed files with 723 additions and 7 deletions
+32 -3
View File
@@ -105,6 +105,34 @@ class SafaricomMPesaExpressAuth(BaseModel):
class Config:
extra = "forbid"
# ----------------------------------------------------------------------------------------------------------------------
class RazorPayAuth(BaseModel):
razorPayKeyId: str = Field(
description = "the app's consumer key given by razorpay; found in 'my apps'",
frozen = True
)
razorPayKeySecret: str = Field(
description = "the app's consumer secret given by razorpay; found in 'my apps'",
frozen = True
)
displayName: str = Field(
description="Display Name",
frozen=True
)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "forbid"
# ---------------------------------------------------------------------------------------------------------------------
@@ -135,8 +163,8 @@ class PGAuthRequestHeaders(BaseModel):
class PGAuthRequestData(BaseModel):
client: Literal["safaricomMPesaExpress"] = Field(alias = "client")
auth: Union[SafaricomMPesaExpressAuth]
client: Literal["safaricomMPesaExpress", "razorpay"] = Field(alias = "client")
auth: Union[SafaricomMPesaExpressAuth, RazorPayAuth]
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
@@ -155,7 +183,8 @@ class PGAuthRequestData(BaseModel):
client = values.client
auth = values.auth
harmony_map = {
"safaricomMPesaExpress": SafaricomMPesaExpressAuth
"safaricomMPesaExpress": SafaricomMPesaExpressAuth,
"razorpay": RazorPayAuth
}
if not isinstance(auth, harmony_map[client]):
raise ValueError(f"incorrect 'auth' for selected client '{client}'")