Merge branch 'test' of DigiFi/digifi-EventManager into master
This commit is contained in:
+2
-1
@@ -43,6 +43,7 @@ class Config:
|
|||||||
# SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{DATABASE_USER}:{DATABASE_PASSWORD}@{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_NAME}"
|
# SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{DATABASE_USER}:{DATABASE_PASSWORD}@{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_NAME}"
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
# SQLALCHEMY_ECHO = True
|
# SQLALCHEMY_ECHO = True
|
||||||
|
OVERRIDE_COLLECTION_TRANCATION_ID = int(os.getenv("OVERRIDE_COLLECTION_TRANCATION_ID", 100))
|
||||||
|
|
||||||
|
|
||||||
MAIL_SERVER = os.getenv('MAIL_SERVER','smtp.zoho.com')
|
MAIL_SERVER = os.getenv('MAIL_SERVER','smtp.zoho.com')
|
||||||
@@ -60,7 +61,7 @@ class Config:
|
|||||||
BANK_CALL_COLLECT_LOAN_ENDPOINT = os.getenv("BANK_CALL_COLLECT_LOAN_ENDPOINT","/CollectLoan")
|
BANK_CALL_COLLECT_LOAN_ENDPOINT = os.getenv("BANK_CALL_COLLECT_LOAN_ENDPOINT","/CollectLoan")
|
||||||
BANK_CALL_TRANSACTION_VERIFY = os.getenv("BANK_CALL_TRANSACTION_VERIFY", "/TransactionVerify")
|
BANK_CALL_TRANSACTION_VERIFY = os.getenv("BANK_CALL_TRANSACTION_VERIFY", "/TransactionVerify")
|
||||||
BANK_HEALTH_CHECK_ENDPOINT = os.getenv("BANK_HEALTH_CHECK_ENDPOINT", "/system-health-check")
|
BANK_HEALTH_CHECK_ENDPOINT = os.getenv("BANK_HEALTH_CHECK_ENDPOINT", "/system-health-check")
|
||||||
BANK_CALL_AUTH_ENDPOINT = os.getenv("BANK_CALL_AUTH_ENDPOINT", "/api/Auth/generate-token")
|
BANK_CALL_AUTH_ENDPOINT = os.getenv("BANK_CALL_AUTH_ENDPOINT", "/Auth/generate-token")
|
||||||
BANK_GRANT_TYPE = os.getenv("BANK_GRANT_TYPE", "password")
|
BANK_GRANT_TYPE = os.getenv("BANK_GRANT_TYPE", "password")
|
||||||
TEST_NO = os.getenv("TEST_NO", "2347038224367")
|
TEST_NO = os.getenv("TEST_NO", "2347038224367")
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ from app.services.repayment import RepaymentService
|
|||||||
from app.services.loan import LoanService
|
from app.services.loan import LoanService
|
||||||
from app.helpers.response_helper import ResponseHelper
|
from app.helpers.response_helper import ResponseHelper
|
||||||
from app.utils.logger import logger
|
from app.utils.logger import logger
|
||||||
from decimal import Decimal, ROUND_HALF_UP
|
from app.config import settings
|
||||||
from app.services.loan_repayment_schedule import LoanRepaymentScheduleService
|
|
||||||
from app.enums.loan_status import LoanStatus
|
OVERRIDE_COLLECTION_TRANCATION_ID = settings.OVERRIDE_COLLECTION_TRANCATION_ID
|
||||||
|
|
||||||
class CollectLoanHelper:
|
class CollectLoanHelper:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -27,9 +27,13 @@ class CollectLoanHelper:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _build_collect_loan_payload(loan_data, repayment_data, data, collectionMethod):
|
def _build_collect_loan_payload(loan_data, repayment_data, data, collectionMethod):
|
||||||
debtId = str(loan_data.get('debtId', "")).strip().zfill(6)
|
logger.info(f"building CollectLoan endpoint with data: {loan_data}")
|
||||||
t_id = ''.join(random.choices(string.ascii_uppercase, k=22))
|
|
||||||
|
|
||||||
|
debtId = str(loan_data.get('debtId', "")).strip().zfill(6)
|
||||||
|
#this can be overridden based on config
|
||||||
|
t_id = ''.join(random.choices(string.ascii_uppercase, k=22))
|
||||||
|
if OVERRIDE_COLLECTION_TRANCATION_ID == 100:
|
||||||
|
t_id = loan_data['transactionId']
|
||||||
return {
|
return {
|
||||||
"transactionId": t_id,
|
"transactionId": t_id,
|
||||||
"fbnTransactionId": loan_data['transactionId'],
|
"fbnTransactionId": loan_data['transactionId'],
|
||||||
|
|||||||
@@ -18,9 +18,8 @@ from app.services.salary import SalaryService
|
|||||||
from app.enums.loan_status import LoanStatus
|
from app.enums.loan_status import LoanStatus
|
||||||
from app.models.loan_repayment_schedule import LoanRepaymentSchedule
|
from app.models.loan_repayment_schedule import LoanRepaymentSchedule
|
||||||
from decimal import Decimal, ROUND_HALF_UP
|
from decimal import Decimal, ROUND_HALF_UP
|
||||||
from requests.exceptions import SSLError, RequestException,Timeout
|
from requests.exceptions import SSLError, RequestException,Timeout,ReadTimeout, ConnectTimeout
|
||||||
import sys
|
import sys
|
||||||
from requests.exceptions import ReadTimeout, ConnectTimeout
|
|
||||||
import socket
|
import socket
|
||||||
from app.helpers.collect_loan_helper import CollectLoanHelper
|
from app.helpers.collect_loan_helper import CollectLoanHelper
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -41,7 +41,7 @@ def get_headers():
|
|||||||
|
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
logger.error(f"Failed to get auth token: {e}")
|
logger.error(f"Failed to get auth token: {e}")
|
||||||
return {"error": "Authentication request failed"}
|
raise
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logger.error(f"Failed to parse auth response JSON: {e}")
|
logger.error(f"Failed to parse auth response JSON: {e}")
|
||||||
return {"error": "Invalid authentication response"}
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user