diff --git a/api/blueprints/finstitutions/trading/oauth/request.py b/api/blueprints/finstitutions/trading/oauth/request.py index e180109..5569de4 100644 --- a/api/blueprints/finstitutions/trading/oauth/request.py +++ b/api/blueprints/finstitutions/trading/oauth/request.py @@ -263,40 +263,40 @@ async def request_oauth_authorization_url( # URL that will take him to ICICI's official site to log in. When he logs in, ICICI will hit our callback # URL and give us the authentication details. - if inbound_data.client == "iciciBreeze": - - # 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 = { - "userId": inbound_data.auth.userId, - "apiKey": inbound_data.auth.apiKey - }, - auth = inbound_data.auth.model_dump(), - status = "active", - syncFreq = None - ), - token_notes = { - "userId": inbound_data.auth.userId, - "apiKey": inbound_data.auth.apiKey, - "authUrl": auth_url - }, - display_name = inbound_data.auth.userId, - display_picture = None, - session_token = inbound_headers["X-Session-Token"] - ) - - # Check if things were successful: - if not success: auth_url = None + # if inbound_data.client == "iciciBreeze": + # + # # 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 = { + # "userId": inbound_data.auth.userId, + # "apiKey": inbound_data.auth.apiKey + # }, + # auth = inbound_data.auth.model_dump(), + # status = "active", + # syncFreq = None + # ), + # token_notes = { + # "userId": inbound_data.auth.userId, + # "apiKey": inbound_data.auth.apiKey, + # "authUrl": auth_url + # }, + # display_name = inbound_data.auth.userId, + # display_picture = None, + # session_token = inbound_headers["X-Session-Token"] + # ) + # + # # Check if things were successful: + # if not success: auth_url = None # ┳┓ # ┣┫┏┓┏┏┓┏┓┏┓┏┏┓ @@ -471,40 +471,40 @@ async def request_oauth_authorization_update_url( # URL that will take him to ICICI's official site to log in. When he logs in, ICICI will hit our callback # URL and give us the authentication details. - if inbound_data.client == "iciciBreeze": - - # 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 = { - "userId": inbound_data.auth.userId, - "apiKey": inbound_data.auth.apiKey - }, - auth = inbound_data.auth.model_dump(), - status = "active", - syncFreq = None - ), - token_notes = { - "userId": inbound_data.auth.userId, - "apiKey": inbound_data.auth.apiKey, - "authUrl": auth_url - }, - display_name = inbound_data.auth.userId, - display_picture = None, - session_token = inbound_headers["X-Session-Token"] - ) - - # Check if things were successful: - if not success: auth_url = None + # if inbound_data.client == "iciciBreeze": + # + # # 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 = { + # "userId": inbound_data.auth.userId, + # "apiKey": inbound_data.auth.apiKey + # }, + # auth = inbound_data.auth.model_dump(), + # status = "active", + # syncFreq = None + # ), + # token_notes = { + # "userId": inbound_data.auth.userId, + # "apiKey": inbound_data.auth.apiKey, + # "authUrl": auth_url + # }, + # display_name = inbound_data.auth.userId, + # display_picture = None, + # session_token = inbound_headers["X-Session-Token"] + # ) + # + # # Check if things were successful: + # if not success: auth_url = None # ┳┓ # ┣┫┏┓┏┏┓┏┓┏┓┏┏┓ diff --git a/api/main.py b/api/main.py index 8af2955..e65f5e7 100644 --- a/api/main.py +++ b/api/main.py @@ -571,12 +571,14 @@ 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.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,