(20241230) Accepting ICICI Breeze's auth. now.

This commit is contained in:
2024-12-30 14:16:46 +05:30
parent 3e6d927a99
commit 95b6d08b4a
9 changed files with 359 additions and 138 deletions
@@ -213,6 +213,8 @@ async def request_oauth_authorization_url(
if inbound_data.client == "zerodhaKite":
print("Zerodha")
# Prepare the inputs:
auth_url = await current_app.zerodha_kite_controller.get_authorization_url(api_key = inbound_data.auth.apiKey)
@@ -244,6 +246,45 @@ async def request_oauth_authorization_url(
# Check if things were successful:
if not success: auth_url = None
# ┏┓ ┳┏┓┳┏┓┳ ┳┓
# ┣ ┏┓┏┓ ┃┃ ┃┃ ┃ ┣┫┏┓┏┓┏┓┓┏┓
# ┻ ┗┛┛ ┻┗┛┻┗┛┻ ┻┛┛ ┗ ┗ ┗┗
if inbound_data.client == "iciciBreeze":
print("ICICI")
# Prepare the inputs:
auth_url = await current_app.icici_breeze_controller.get_authorization_url(api_key = inbound_data.auth.apiKey)
# Immediately save the details against that token id:
success = await current_app.icici_breeze_controller.set_token_direct(
sql_conn = current_app.sql_writer,
mongo_data_conn = current_app.data_mongo,
auth_token = CoreAuthTokenModel(
serviceType = "stockTrading",
client = inbound_data.client,
authType = "oauth",
user = kwargs["session_info"],
clientUserId = {
"apiKey": inbound_data.auth.apiKey
},
auth = inbound_data.auth.model_dump(),
status = "active",
syncFreq = 1500
),
token_notes = {
"apiKey": inbound_data.auth.apiKey,
"authUrl": auth_url
},
display_name = None,
display_picture = None,
session_token = inbound_headers["X-Session-Token"]
)
# Check if things were successful:
if not success: auth_url = None
# ┳┓
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓
# ┛┗┗ ┛┣┛┗┛┛┗┛┗
+7
View File
@@ -82,6 +82,7 @@ from controllers_v2.message.sms.savvy_bulk_sms_kenya import SavvyBulkSMSKenyaCon
# ---
from controllers_v2.finstitutions.trading.all_trading import AllTradingController
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.all_payments import AllPaymentsController
@@ -467,6 +468,12 @@ async def app_startup(**kwargs):
alert_url = current_app.script_data["alerts"]["url"],
debug = enable_debugging
)
current_app.icici_breeze_controller = ICICIBreezeTradingController(
cache = current_app.module_cache,
http_client = current_app.http_client,
alert_url = current_app.script_data["alerts"]["url"],
debug = enable_debugging
)
current_app.paper_trading_controller = PaperTradingController(
cache = current_app.module_cache,
http_client = current_app.http_client,