(20241216) Payment auth bug fix.

This commit is contained in:
2024-12-16 16:00:52 +05:30
parent 064495163f
commit 0b9976fadb
19 changed files with 589 additions and 473 deletions
+13 -25
View File
@@ -170,33 +170,21 @@ async def authorize_payment_gateway(
if inbound_data.client == "safaricomMPesaExpress":
auth_token = CoreAuthTokenModel(
serviceType = "paymentGateway",
client = inbound_data.client,
authType = "auth",
auth = inbound_data.auth.model_dump(),
user = kwargs.get("session_info"),
clientUserId = {
"businessShortCode": inbound_data.auth.businessShortCode
},
status = "active",
syncFreq = 60
)
token_id = await current_app.core_auth_token_controller.get_token_id(
success = await current_app.payment_controller.set_token_direct(
db_conn = current_app.sql_writer,
mongo_conn = current_app.data_mongo,
auth_token = auth_token,
token_notes = {},
session_token = inbound_headers["X-Session-Token"]
)
success = await current_app.core_auth_token_controller.set_token(
db_conn = current_app.sql_writer,
mongo_conn = current_app.data_mongo,
token_id = token_id,
auth_token = auth_token,
token_notes = {},
auth_token = CoreAuthTokenModel(
serviceType = "paymentGateway",
client = inbound_data.client,
authType = "auth",
auth = inbound_data.auth.model_dump(),
user = kwargs.get("session_info"),
clientUserId = {
"businessShortCode": inbound_data.auth.businessShortCode
},
status = "active",
syncFreq = 60
),
session_token = inbound_headers["X-Session-Token"]
)
+1 -1
View File
@@ -63,7 +63,7 @@ from utils_v2.api.async_quart import (
# GMail-related utils:
from utils_v2.goog.gmail.gmail_client import SCOPES_GMAIL_MAIL_MANAGEMENT
from utils_v2.goog.models.data.auth_tokens import GoogleAuthTokens
from utils_v2.goog.models.auth_tokens import GoogleAuthTokens
# Common:
from shared import constants
+1 -1
View File
@@ -64,7 +64,7 @@ from utils_v2.api.async_quart import (
# GMail-related utils:
from utils_v2.goog.gmail.gmail_client import SCOPES_GMAIL_MAIL_MANAGEMENT
from utils_v2.goog.models.data.auth_tokens import GoogleAuthTokens
from utils_v2.goog.models.auth_tokens import GoogleAuthTokens
# Common:
from shared import constants
+1 -1
View File
@@ -64,7 +64,7 @@ from utils_v2.api.async_quart import (
# GMail-related utils:
from utils_v2.goog.gmail.gmail_client import SCOPES_GMAIL_MAIL_MANAGEMENT
from utils_v2.goog.models.data.auth_tokens import GoogleAuthTokens
from utils_v2.goog.models.auth_tokens import GoogleAuthTokens
# Common:
from shared import constants
+1 -1
View File
@@ -63,7 +63,7 @@ from utils_v2.api.async_quart import (
# GMail-related utils:
from utils_v2.goog.gmail.gmail_client import SCOPES_GMAIL_MAIL_MANAGEMENT
from utils_v2.goog.models.data.auth_tokens import GoogleAuthTokens
from utils_v2.goog.models.auth_tokens import GoogleAuthTokens
# Common:
from shared import constants
+2 -2
View File
@@ -166,7 +166,7 @@ async def authorize_sms_client(
if inbound_data.smsClient == "nimbusSmsIndia":
success = await current_app.sms_controller.set_token(
success = await current_app.sms_controller.set_token_direct(
db_conn = current_app.sql_writer,
mongo_conn = current_app.data_mongo,
auth_token = CoreAuthTokenModel(
@@ -193,7 +193,7 @@ async def authorize_sms_client(
elif inbound_data.smsClient == "savvyBulkSmsKenya":
success = await current_app.sms_controller.set_token(
success = await current_app.sms_controller.set_token_direct(
db_conn = current_app.sql_writer,
mongo_conn = current_app.data_mongo,
auth_token = CoreAuthTokenModel(
+6 -4
View File
@@ -63,13 +63,14 @@ from utils_v2.api.async_quart import (
from utils_v2.goog.gmail.gmail_client import AsyncGMailClient
# Core Controller Models:
from controllers.core.message import MessageController
from controllers.core.auth_token import AuthTokenController
from controllers.core.message import CoreMessageController
from controllers.core.auth_token import CoreAuthTokenController
from controllers.core.ai.llm import LLMController
# API Controller Models:
from controllers.api.mail import MailController
from controllers.api.sms import SMSController
from controllers.api.payment import PaymentController
# # Old Behaviour Models:
# from controllers.mail.oauth_v3 import MailOAuthModel
@@ -328,7 +329,7 @@ async def app_startup(**kwargs):
# ┃ ┏┓┏┓┏┓ ┃┃┃┏┓┏┫┏┓┃┏
# ┗┛┗┛┛ ┗ ┛ ┗┗┛┗┻┗ ┗┛
current_app.core_auth_token_controller = AuthTokenController(
current_app.core_auth_token_controller = CoreAuthTokenController(
cache = current_app.module_cache,
alert_url = current_app.script_data["alerts"]["url"],
http_client = current_app.http_client,
@@ -336,7 +337,7 @@ async def app_startup(**kwargs):
debug_prefix = "Message (CM) | ",
debug_only_errors = True
)
current_app.core_message_controller = MessageController(
current_app.core_message_controller = CoreMessageController(
cache = current_app.module_cache,
alert_url = current_app.script_data["alerts"]["url"],
http_client = current_app.http_client,
@@ -351,6 +352,7 @@ async def app_startup(**kwargs):
current_app.mail_controller = MailController()
current_app.sms_controller = SMSController()
current_app.payment_controller = PaymentController()
# ┏┓ ┓ ┏┓┓•
# ┃ ┏┓┏┓┏┓┏┓┏╋┏┓┏┓┏ ┏┓┏┓┏┫ ┃ ┃┓┏┓┏┓╋┏