done with collect loan setup

This commit is contained in:
2025-04-14 13:44:56 +01:00
parent 020ab3b946
commit c76d3075af
3 changed files with 57 additions and 13 deletions
+35 -3
View File
@@ -6,7 +6,6 @@ from flask import jsonify
class SimbrellaClient:
BASE_URL = settings.BANK_CALL_BASE_URL
BANK_CALL_BASE_URL = settings.BANK_CALL_BASE_URL
@staticmethod
@@ -14,7 +13,7 @@ class SimbrellaClient:
BANK_CALL_BASE_URL = "https://bank-emulator.dev.simbrellang.net"
api_url = f"{BANK_CALL_BASE_URL}/Disbursement"
logger.info(f"BANK_CALL_BASE_URL = {BANK_CALL_BASE_URL}")
logger.info(f"Calling disbursement endpoint with data: {data}")
logger.info(f"Calling Disbursement endpoint with data: {data}")
data={
"requestId": "RQID1743987402764",
@@ -47,9 +46,42 @@ class SimbrellaClient:
logger.info(f"Disbursement response: {response.json()}")
except Exception as e:
logger.info(f"Failed to call disbursement endpoint: {e}")
logger.info(f"Failed to call Disbursement endpoint: {e}")
#raise
return 0
# return jsonify(response.json()), response.status_code
return 1
@staticmethod
def collect_loan(data):
BANK_CALL_BASE_URL = "https://bank-emulator.dev.simbrellang.net"
api_url = f"{BANK_CALL_BASE_URL}/CollectLoan"
logger.info(f"BANK_CALL_BASE_URL = {BANK_CALL_BASE_URL}")
logger.info(f"Calling CollectLoan endpoint with data: {data}")
collect_loan_data = {
"transactionId": "T002",
"fbnTransactionId": "FBN20231123",
"debtId": "273194670",
"customerId": "CN621868",
"accountId": "2017821799",
"productId": "101",
"collectAmount": 80000,
"penalCharge": 0,
"collectionMethod": 1,
"lienAmount": 80000,
"countryId": "01",
"comment": "Testing CollectionLoanRequest"
}
try:
logger.info(f"Here is your CollectLoan Request data ***** : {collect_loan_data}")
response = requests.post(api_url, json=collect_loan_data, headers=get_headers())
logger.info(f"CollectLoan response: {response.json()}")
except Exception as e:
logger.info(f"Failed to call CollectLoan endpoint: {e}")
return 0
return 1