(20250811) - Added RazorPay Integration class with auth api and requires validations and many more.
This commit is contained in:
@@ -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}'")
|
||||
|
||||
Reference in New Issue
Block a user