(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
@@ -162,6 +162,7 @@ async def authorize_payment_gateway(
# Start by assuming failure:
success = False
message = ""
# ┏┓ ┏ • ┳┳┓ ┏┓ ┏┓
# ┗┓┏┓╋┏┓┏┓┓┏┏┓┏┳┓ ┃┃┃━━┃┃┏┓┏┏┓ ┣ ┓┏┏┓┏┓┏┓┏┏
@@ -191,6 +192,31 @@ async def authorize_payment_gateway(
session_token = inbound_headers["X-Session-Token"]
)
if inbound_data.client == "razorpay":
# Make the client controller test and save the auth:
response = await current_app.razorPay_controller.save_auth(
sql_conn=current_app.sql_writer,
mongo_data_conn=current_app.data_mongo,
auth=inbound_data.auth,
user=kwargs.get("session_info"),
session_token=inbound_headers.get("X-Session-Token")
)
# Note down the results:
success = response.success
message = response.message
token_id = response.token_id
auth_url_success = ""
auth_url_failed = ""
if token_id is not None:
auth_url_success = f"https://api.thecaoffice.com/shopify/razorpay/auth/template?status=1&token={token_id}&razorPayKeyId={inbound_data.auth.razorPayKeyId}&razorPayKeyId={inbound_data.auth.razorPayKeySecret}"
# auth_url_success = f"http://192.168.2.99:5220/shopify/razorpay/auth/template?status=1&token={token_id}&razorPayKeyId={inbound_data.auth.razorPayKeyId}&razorPayKeyId={inbound_data.auth.razorPayKeySecret}"
else:
auth_url_failed = f"https://api.thecaoffice.com/shopify/razorpay/auth/template?status=0&razorPayKeyId={inbound_data.auth.razorPayKeyId}&razorPayKeyId={inbound_data.auth.razorPayKeySecret}"
# auth_url_failed = f"http://192.168.2.99:5220/shopify/razorpay/auth/template?status=0&razorPayKeyId={inbound_data.auth.razorPayKeyId}&razorPayKeyId={inbound_data.auth.razorPayKeySecret}"
# ┳┓
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓
# ┛┗┗ ┛┣┛┗┛┛┗┛┗
@@ -198,11 +224,13 @@ async def authorize_payment_gateway(
# Done here:
return ResponseModel(
status_code = StatusCodes.OK if success else StatusCodes.FAILED,
http_code = HttpCodes.SUCCESS if success else HttpCodes.INTERNAL_SERVER_ERROR,
data = {
status_code=StatusCodes.OK if success else StatusCodes.FAILED,
http_code=HttpCodes.SUCCESS if success else HttpCodes.INTERNAL_SERVER_ERROR,
message=message,
data={
"client": inbound_data.client,
"authorized": success
"authorized": success,
"authorizationUrl": auth_url_success if success else auth_url_failed
}
)
+10
View File
@@ -99,6 +99,7 @@ from controllers_v2.finstitutions.trading.all_trading import AllTradingControlle
from controllers_v2.finstitutions.trading.zerodha_kite import ZerodhaKiteTradingController
#from controllers_v2.finstitutions.trading.icici_breeze import ICICIBreezeTradingController
from controllers_v2.finstitutions.trading.paper_trading import PaperTradingController
from controllers_v2.finstitutions.payments.razorpay.razorpay import RazorPayAppController
# ---
from controllers_v2.finstitutions.payments.all_payments import AllPaymentsController
from controllers_v2.finstitutions.payments.safaricom_mpesa_express import SafaricomMPesaExpressPaymentsController
@@ -602,6 +603,15 @@ async def app_startup(**kwargs):
)
current_app.printer("Finstitutions/Payments (C) ready.")
current_app.razorPay_controller = RazorPayAppController(
cache=current_app.module_cache,
http_client=current_app.http_client,
alert_url=current_app.script_data["alerts"]["url"],
debug=enable_debugging
)
current_app.printer("Finstitutions/Payments (C) ready.")
# Software / Mikrotik:
current_app.mikrotik_controller = AllMikroTikController(
cache = current_app.module_cache,